Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
589 commits
Select commit Hold shift + click to select a range
c402249
minor bugfix
AndrewGraus Jun 6, 2023
bb9c5e2
yet more fixes
AndrewGraus Jun 6, 2023
8f82c58
changing capitalization because it may matter?
AndrewGraus Jun 8, 2023
e693a8e
trying another data test
AndrewGraus Jun 8, 2023
2cc8598
minor typo
AndrewGraus Jun 8, 2023
d41741a
trying the simplest version of the test I can find
AndrewGraus Jun 8, 2023
dbd85c2
typo
AndrewGraus Jun 8, 2023
4e196a6
syntax changes
AndrewGraus Jun 8, 2023
60b053a
minor fix to declarations
AndrewGraus Jun 8, 2023
fa7c8f3
removing multiple definitions of the data test
AndrewGraus Jun 8, 2023
2fb48f5
changing the mangling conventions
AndrewGraus Jun 8, 2023
e9fd5ca
removing previous definitions
AndrewGraus Jun 8, 2023
4d69bfa
changed to print an int
AndrewGraus Jun 8, 2023
550b0b0
pointer nonsense
AndrewGraus Jun 9, 2023
c9f27af
more pointer nonsense
AndrewGraus Jun 9, 2023
ca72779
adding the properties calls
AndrewGraus Jun 9, 2023
18a4375
adding the right headers
AndrewGraus Jun 9, 2023
5796a35
printing the data from props
AndrewGraus Jun 9, 2023
5390455
typo
AndrewGraus Jun 9, 2023
415edf8
printing size
Jun 12, 2023
44fa7d1
printing the size in the c++ side as well
AndrewGraus Jun 12, 2023
9f00275
trying a couple modifications
AndrewGraus Jun 12, 2023
707696b
testing the size setting modules
AndrewGraus Jun 12, 2023
7799de2
fixing typos and definitions
AndrewGraus Jun 12, 2023
4da6ddd
changes some pointer things
AndrewGraus Jun 12, 2023
77638a5
adding some tests
AndrewGraus Jun 12, 2023
f4a659f
modifications to pointers, and adding the data loop
AndrewGraus Jun 13, 2023
14408c5
added definitions
AndrewGraus Jun 13, 2023
ff06549
accessing data with c_f_pointer and alloating data
AndrewGraus Jun 13, 2023
094100b
changes to pointer calls in Engine
AndrewGraus Jun 13, 2023
602eb0c
more changes to function calls
AndrewGraus Jun 14, 2023
42fe3de
removing the test wrapper
AndrewGraus Jun 14, 2023
fac183e
more pointer stuff
AndrewGraus Jun 14, 2023
af82419
modified engine to pass sizes
AndrewGraus Jun 14, 2023
f4679c5
Many modifications to make sure sizes is defined everywhere
AndrewGraus Jun 14, 2023
a3861ed
minor typo
AndrewGraus Jun 14, 2023
2f9f489
more minor fixes
AndrewGraus Jun 14, 2023
509a723
fix
AndrewGraus Jun 14, 2023
01383fa
adding back in the engine version of the data test
AndrewGraus Jun 14, 2023
6517ae1
I don't think it actually creates the engine interface. Fixing
AndrewGraus Jun 14, 2023
09c6e60
bug
AndrewGraus Jun 14, 2023
63c9c50
adding in the atmospheric abundances
AndrewGraus Jun 21, 2023
8278100
various bugfixes
AndrewGraus Jun 21, 2023
bab9ea6
adding the surface properties to the code
AndrewGraus Jun 22, 2023
321233a
bugfix
AndrewGraus Jun 22, 2023
4b7ec9c
changed tags on surface evaluators
AndrewGraus Jun 27, 2023
00b7d8c
changing to tag current
AndrewGraus Jun 27, 2023
04fdf5d
minor fixes for the surface runs
Jun 28, 2023
71a0f59
added some simple testing of data
AndrewGraus Jun 29, 2023
7c6aabd
test to compare data at the beginning and end
AndrewGraus Jun 29, 2023
3ac315f
over wrote test array accidentally
AndrewGraus Jun 29, 2023
354ca55
adding to header so it's global?
AndrewGraus Jun 29, 2023
cff02eb
fixed the data holders for test
Jun 29, 2023
f5ff1da
added copy back to wrapper
AndrewGraus Jun 29, 2023
5ecc58a
Added new variables including bulk density, elevation, ect.
AndrewGraus Jul 10, 2023
47277b6
bug fix
AndrewGraus Jul 10, 2023
ad2b12f
minor typo
AndrewGraus Jul 10, 2023
42a3ca2
changes to memory
AndrewGraus Jul 10, 2023
fe9d6f0
removing some stufff
AndrewGraus Jul 10, 2023
711ee3d
typos
AndrewGraus Jul 10, 2023
799055e
why
AndrewGraus Jul 10, 2023
ba1c8fa
just getting rid of plant wilting factor since I don't need it
AndrewGraus Jul 11, 2023
dd1178a
oops
AndrewGraus Jul 11, 2023
9148bd8
added suction, aspect and slope.
AndrewGraus Jul 11, 2023
9517e77
minor fixes
Jul 12, 2023
922671a
adding test for the suction key
AndrewGraus Jul 12, 2023
854ec72
minor bug with the structs
AndrewGraus Jul 12, 2023
37f486d
testing the block map printing
AndrewGraus Jul 12, 2023
130dad4
minor changes adding suction test
AndrewGraus Jul 12, 2023
ca7555d
bugfixes
AndrewGraus Jul 12, 2023
54c3215
even more testing!
AndrewGraus Jul 13, 2023
809b866
various minor fixes to make the code work along with the tests
Jul 13, 2023
7309e2b
further testing of processes and suction key
AndrewGraus Jul 13, 2023
9496598
changes to code
Jul 14, 2023
2b1329f
adding rooting fraction and wilting point
AndrewGraus Jul 14, 2023
a3859e6
various minor fixes
Jul 18, 2023
caf52cd
added some more tests for parallelization
AndrewGraus Jul 18, 2023
0251217
minor fixes
Jul 18, 2023
16c15b0
more minor fixes
Jul 18, 2023
7ed2cd6
cleaning up print statements
AndrewGraus Jul 18, 2023
62b1fd9
test looping over procs
AndrewGraus Jul 18, 2023
bd93217
minor fixes to the mpi test
Jul 19, 2023
5263567
minor changes to print statements
Jul 19, 2023
2d18b37
added the initial refactoring of the code to loop over processes
AndrewGraus Jul 20, 2023
b32319a
Forgot to update the header
AndrewGraus Jul 20, 2023
f57e672
just cleaning up print statements
AndrewGraus Jul 20, 2023
708e5a1
finished refactoring the memory modules to accept higher-order data
AndrewGraus Jul 20, 2023
4985f2f
memory fixes related to the tensors
AndrewGraus Jul 26, 2023
6f08766
minor bugfixes
AndrewGraus Jul 27, 2023
0e2c275
removing serial versions of the functions because they error out.
AndrewGraus Jul 27, 2023
2c7c6c1
more minor fixes
AndrewGraus Jul 27, 2023
badb111
more fixes
AndrewGraus Jul 27, 2023
38f9d32
various bugfixes to get this to compile
Jul 27, 2023
994700d
other minor fixes
Jul 27, 2023
bd24057
testing for the surface variables
AndrewGraus Jul 27, 2023
a00dc59
minor fixes to make it compile
Jul 29, 2023
2ca47e3
changes to make the code compile
Jul 31, 2023
8c9acf4
reworking of the 3D array code
Aug 1, 2023
c8fec28
testing memory for ttc
AndrewGraus Aug 1, 2023
6ae9bb9
minor fixes
Aug 1, 2023
f8695e6
more testing
AndrewGraus Aug 1, 2023
400aeaf
more minor changes
Aug 1, 2023
a306ade
more testing
AndrewGraus Aug 1, 2023
8d98f59
even more testing
AndrewGraus Aug 1, 2023
6a98ade
fixes to tests
AndrewGraus Aug 1, 2023
0e49576
transport tests
AndrewGraus Aug 2, 2023
6d4f3d7
adding file paths
AndrewGraus Aug 15, 2023
f77fabf
fixing path
AndrewGraus Aug 15, 2023
c261c99
adding more files
AndrewGraus Aug 15, 2023
c58a83b
pushing changes to file paths in cmake
AndrewGraus Aug 16, 2023
3651f20
changes to cmake files to remove linking for now
Aug 17, 2023
04218a2
modifications to CMake (compiles again)
Aug 17, 2023
a3c1de3
testing the column varaibles, along with cleaning up var names
AndrewGraus Aug 17, 2023
675f7ee
making some modifications to tcc
AndrewGraus Aug 18, 2023
51addd3
committing some minor changes
Aug 18, 2023
8d40f7a
doing some variable cleanup
AndrewGraus Aug 22, 2023
6d23bb5
fixing domain
AndrewGraus Aug 22, 2023
0b5d738
adding some more tests of memory
AndrewGraus Aug 22, 2023
454ca1a
renaming variables for clarity and fixing a bug
AndrewGraus Aug 22, 2023
c9fac14
minor fixes
AndrewGraus Aug 22, 2023
6d70113
more variable renaming and fixes
AndrewGraus Aug 22, 2023
35204be
rewrittting loops
AndrewGraus Aug 23, 2023
7c39f57
minor typo
AndrewGraus Aug 23, 2023
5be5b3c
changes to loops
Aug 23, 2023
3c91691
working version of the processor refactoring
Aug 24, 2023
38feaf3
modifying cmake files
Aug 24, 2023
1454af1
more variable name changes for consistency and changing directory name
AndrewGraus Aug 24, 2023
1060278
changing cmake
Aug 24, 2023
12814c0
Merge branch 'master' of https://github.com/AndrewGraus/ats
Aug 24, 2023
75bdf68
adding CMake
Aug 24, 2023
3ff93ff
more CMake commits
Aug 24, 2023
18bbf4c
more CMake
Aug 25, 2023
f3edb79
more cmake
Aug 25, 2023
bcdf5ba
more cmake
Aug 25, 2023
403318d
more direct attempt at CMake fix
AndrewGraus Aug 28, 2023
e700e04
more cmake nonsense
AndrewGraus Aug 28, 2023
7efa9f6
cmake
AndrewGraus Aug 29, 2023
e29299d
trying method of linking libs
Aug 29, 2023
617a8e7
modifying library method
AndrewGraus Aug 29, 2023
bf480fd
more cmake changes
Aug 29, 2023
40de843
more cmake tests
AndrewGraus Aug 29, 2023
70af131
working version
Aug 29, 2023
bde8831
pushing reworked versions of the CMake files
Sep 1, 2023
3657772
modifications to beging initalization of ecosim
AndrewGraus Sep 5, 2023
613f5e1
compiled code with init ecosim
Sep 5, 2023
f49560a
minor changes
Sep 6, 2023
e6e4ee4
modifications to use sizes to init
AndrewGraus Sep 6, 2023
8f6a393
Initial push to test surface and subsurface sources
AndrewGraus Oct 2, 2023
7ef4d7c
minor fixes to make the first test run
Oct 3, 2023
63cf993
rewriting print statements to get rid of some old ones and add new ones
AndrewGraus Oct 3, 2023
e0ce5eb
minor fixes to interface
Oct 4, 2023
a8a874f
Added diagnostics for testing energy source sink
Oct 6, 2023
ea23c57
Adding the different source
AndrewGraus Oct 6, 2023
96a33c7
Working with EcoSIM source test
Oct 7, 2023
c4a3b38
initial commit of seb (debugging)
Oct 11, 2023
6f4e3de
various debugging tests for suction
Oct 23, 2023
8613b7f
trying to gain access to WRM
AndrewGraus Oct 24, 2023
87580b9
more suction testing
AndrewGraus Oct 24, 2023
370a38e
working version of surface balance
Nov 2, 2023
6a4075b
adding some print statements to the overlandflow PK
AndrewGraus Nov 2, 2023
a680520
Testing removing the copyback step
AndrewGraus Nov 6, 2023
3c133b8
changing the tags to default
AndrewGraus Nov 6, 2023
56a2590
printing data looking for a bug
AndrewGraus Nov 7, 2023
317004d
fixing bracket
AndrewGraus Nov 7, 2023
43da4a9
trying to print everything I can
AndrewGraus Nov 7, 2023
0bb3620
minor bugfix
AndrewGraus Nov 7, 2023
8267692
fixed version of the ecosim PK
Nov 8, 2023
e617def
testing new parameters
AndrewGraus Nov 8, 2023
7dc2240
adding WP and FC params
AndrewGraus Nov 9, 2023
428d01e
trying to add suction head
AndrewGraus Nov 13, 2023
b4e2e14
attempting to add suction head more broadly to flow
AndrewGraus Nov 14, 2023
c1eaa54
trying to add suction head
AndrewGraus Nov 15, 2023
b9aa19a
Merge branch 'master' of https://github.com/AndrewGraus/ats
AndrewGraus Nov 15, 2023
a32768c
original addition of the matric pressure evaluator
AndrewGraus Nov 15, 2023
28c62a4
various minor changes and add matric pressure
AndrewGraus Nov 16, 2023
909c9a9
minor fixes, adding matric to state
AndrewGraus Nov 16, 2023
228880d
modifying flow to acrtivate mp
AndrewGraus Nov 20, 2023
cf2fddb
minor fix
AndrewGraus Nov 20, 2023
50edee3
edit cmake files
AndrewGraus Nov 20, 2023
fdb0494
Moved matric pressure and made it work
Nov 27, 2023
4228fe7
adding some prints
AndrewGraus Nov 29, 2023
31165cf
checking depth variables
AndrewGraus Nov 30, 2023
7a2aae8
adding cumulative depth
AndrewGraus Nov 30, 2023
0fd4195
fixes to make reverse cumulative
Nov 30, 2023
d077d11
minor fixes
Dec 9, 2023
1884516
more changes
Dec 13, 2023
fb6f760
Testing different energy methods
AndrewGraus Dec 13, 2023
e4f093f
Removing some prints and fixing timestep error
AndrewGraus Dec 14, 2023
8324a3f
minor fix
AndrewGraus Dec 14, 2023
a5139b9
deleting matric pressure eval from flow
Dec 21, 2023
cad0d45
permafrost changes
AndrewGraus Dec 21, 2023
610f608
Changes to allow compilation even without EcoSIM
AndrewGraus Jan 23, 2024
34874aa
Fixing the ATS build to remove hard links
AndrewGraus Apr 17, 2024
35f14f6
various build fixes
AndrewGraus May 16, 2024
40175eb
added snow precipitation to the ATS side of the coupler
AndrewGraus Jul 1, 2024
a79b84f
minor bug fix
AndrewGraus Jul 3, 2024
b2b3d59
modifying prints and deleting some old ones
AndrewGraus Aug 1, 2024
1545504
Merge branch 'master' of https://github.com/AndrewGraus/ats
AndrewGraus Aug 1, 2024
9ad30f1
minor bugfix
AndrewGraus Aug 6, 2024
0fee417
removing snow precipitation
Aug 22, 2024
48082af
minor changes to prints
AndrewGraus Oct 1, 2024
5db6db5
adding snow depth dataset
AndrewGraus Oct 3, 2024
e6df55d
added snow-depth dataset
Oct 10, 2024
8f28d40
adding test dataset
AndrewGraus Oct 10, 2024
acb036a
added working surface-snow_depth dataset
AndrewGraus Oct 15, 2024
8ef13d0
Put in a fixed version of the snow_depth dataset
AndrewGraus Oct 22, 2024
488b041
Code cleanup from the snow depth test
AndrewGraus Oct 24, 2024
94be884
added data flattening for coupler
AndrewGraus Nov 12, 2024
57310cf
minor changes to reflect EcoSIM changes
AndrewGraus Feb 4, 2025
49c4284
Minor changes for snow buildup and mass balance check
AndrewGraus Feb 17, 2025
30d9332
merge with ats main
AndrewGraus Mar 4, 2025
49a5d24
changes to function calls to make code compile after rebase
AndrewGraus Mar 5, 2025
ce81ae2
minor bug fixes
AndrewGraus Mar 10, 2025
b6777a8
changing the ownership methods of the source variables, the coupler s…
AndrewGraus Mar 20, 2025
d213618
minor fixes to keys and shared libraries
AndrewGraus Apr 11, 2025
54e35f6
bugfixes to owned evaluators
AndrewGraus Apr 18, 2025
02402d1
minor clean up
AndrewGraus Apr 22, 2025
1dd5c7c
adding in the phenology dataset
AndrewGraus May 14, 2025
5343c95
minor tweaks to datasets - running
AndrewGraus May 15, 2025
c10fe49
Linking up subsurface sources
AndrewGraus May 15, 2025
9a83147
minor bugfix to sources
AndrewGraus May 15, 2025
9d8ceab
Updated precipitation handling and water tests
AndrewGraus May 15, 2025
3dcdb59
fix for parallel issues
AndrewGraus Jun 20, 2025
5c3664e
working version of coupled phenology
AndrewGraus Jul 25, 2025
60700c5
updated EcoSIM timers to be more stable and account for day and year
AndrewGraus Jul 30, 2025
0284856
adding some additonal vars
AndrewGraus Aug 1, 2025
6f1ee3c
minor updates to cmake files
AndrewGraus Aug 7, 2025
205a582
added snow albedo modifications
AndrewGraus Aug 21, 2025
f26e0ad
minor Cmakelists fixes to allow the coupler access to the plant api
AndrewGraus Sep 9, 2025
d1b858a
Adding runtime options
AndrewGraus Sep 13, 2025
ccdbd9f
Minor fix to CMake files
AndrewGraus Sep 30, 2025
00d2b93
First large code clean up
AndrewGraus Oct 13, 2025
52c2415
Second clean up commit
AndrewGraus Oct 14, 2025
2d4909f
Adding vars to ATS-EcoSIM
AndrewGraus Oct 16, 2025
d048d17
Adding flux component datasets
AndrewGraus Nov 17, 2025
9f73c16
Updated ATS-EcoSIM fork with ATS-1.6
AndrewGraus Nov 20, 2025
c794367
finishing 1.6 update
AndrewGraus Nov 20, 2025
1c51fa0
trying again to finish the merge
AndrewGraus Nov 20, 2025
a248d51
Working ATS-EcoSIM for ATS 1.6
AndrewGraus Nov 26, 2025
2ffda4f
Inital header documentation and code cleanup
AndrewGraus Dec 16, 2025
523b018
Adding a fix to area, add the column-area dataset
AndrewGraus Jan 7, 2026
f11cee2
Moving wrapper and removing old files
AndrewGraus Jan 7, 2026
59eecac
Switching density to molar density
AndrewGraus Jan 9, 2026
8fbdc8d
Updates to remove transport and ATS SEB PK
AndrewGraus Jan 13, 2026
b6b0fab
Minor update to parameter naming convention
AndrewGraus Jan 15, 2026
dc2046a
Adding diagnostic variables for transpiration and canopy evaporation
AndrewGraus Jan 15, 2026
8ab2951
Updates to coupling data structures and custom evaluators
AndrewGraus Jan 26, 2026
8576b76
cleaning old code that is no longer necessary
AndrewGraus Jan 27, 2026
f8cafd0
restoring files from master to eliminate IDE artifact issues
AndrewGraus Jan 27, 2026
405f44b
Updating precipitation_rain
AndrewGraus Feb 4, 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
23 changes: 22 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,19 @@ 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

# 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 +157,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()
119 changes: 119 additions & 0 deletions src/pks/ecosim/BGCEngine.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
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)
{
AllocateBGCProperties(&sizes_, &properties, ncells_per_col_, num_columns);
AllocateBGCState(&sizes_, &state, ncells_per_col_, num_components, num_columns);
}

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_);

}

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);

}

} // namespace
} // namespace
107 changes: 107 additions & 0 deletions src/pks/ecosim/BGCEngine.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
ATS-EcoSIM, Code Adapted for use from Alquimia

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.

Author: Jeffrey Johnson

This is a point of contact for the chemistry engine exposed by Alquimia
to the rest of Amanzi--it provides the ability to enforce geochemical
conditions and to integrate reactions given a chemical configuration.
*/

#ifndef BGC_ENGINE_HH_
#define BGC_ENGINE_HH_

#include <string>
#include <vector>
#include <map>

#include "BGC_memory.hh"
#include "BGC_containers.hh"

#include "VerboseObject.hh"

namespace Amanzi {
namespace EcoSIM {

class BGCEngine {
public:

// Constructs a chemistry engine using the given engine (backend) name and input file.
BGCEngine(const std::string& engineName, const std::string& inputFile);

// Destructor.
~BGCEngine();

// Returns the name of the backend that does the chemistry.
const std::string& Name() const;

// Returns true if the chemistry engine is thread-safe, false if not.
bool IsThreadSafe() const;

// Returns a reference to a "sizes" object that can be queried to find the sizes of the various
// arrays representing the geochemical state within the engine.
const BGCSizes& Sizes() const;

// Initializes the data structures that hold the chemical state information.
void InitState(BGCProperties& properties,
BGCState& state,
BGCAuxiliaryData& aux_data,
int ncells_per_col_,
int num_components,
int num_columns);

// Frees the data structures that hold the chemical state information.
void FreeState(BGCProperties& properties,
BGCState& state,
BGCAuxiliaryData& aux_data);

void DataTest();

bool Setup(BGCProperties& properties,
BGCState& state,
BGCSizes& sizes,
int num_iterations,
int num_columns,
int ncells_per_col_);

bool Advance(const double delta_time,
BGCProperties& properties,
BGCState& state,
BGCSizes& sizes,
int num_iterations,
int num_columns);

void CopyBGCState(const BGCState* const source,
BGCState* destination);
void CopyBGCProperties(const BGCProperties* const source,
BGCProperties* destination);

private:

// bgc data structures.
bool bgc_initialized_;
void* engine_state_;
BGCSizes sizes_;
BGCInterface bgc_;

Teuchos::RCP<VerboseObject> vo_;
// Back-end engine name and input file.
std::string bgc_engine_name_;
std::string bgc_engine_inputfile_;

// forbidden.
BGCEngine();
BGCEngine(const BGCEngine&);
BGCEngine& operator=(const BGCEngine&);

};

} // namespace
} // namespace

#endif
Loading