Skip to content

Commit

Permalink
added initialization to all variables (#115)
Browse files Browse the repository at this point in the history
* added initialization to all variables

* Update pyfabm actions

* Removing all profiling tests

* Updating 0D installation

* Updating gotm test

* Updating fabm0d test

---------

Co-authored-by: Michael Wathen <[email protected]>
  • Loading branch information
glessin and wathen authored Nov 10, 2023
1 parent 2e88016 commit a018ee0
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ git clone https://github.com/pmlmodelling/ersem-setups.git
cd ersem-setups/0d-aquarium

echo "Running FABM with repo configuration"
~/local/fabm/0d/bin/fabm0d -y ../L4/fabm.yaml
~/local/fabm/0d/bin/fabm0d -y ../../ersem/testcases/fabm-ersem-15.06-L4-ben-docdyn-iop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

echo "Installing netCDF"
sudo apt update
sudo apt install libnetcdff-dev
sudo apt install libnetcdff-dev cmake
1 change: 1 addition & 0 deletions github-actions/gotm-fabm-ersem/gotm-tut-config-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
echo "Cloning config repo"
git clone https://github.com/pmlmodelling/ersem-setups.git

cp ersem/testcases/fabm-ersem-15.06-L4-ben-docdyn-iop.yaml ersem-setups/L4/fabm.yaml
cd ersem-setups/L4

echo "Running GOTM with repo configuration"
Expand Down
6 changes: 5 additions & 1 deletion github-actions/gotm-fabm-ersem/test_profiling.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_ersem_func_names(self):
name = self.ersem["name"].tolist()
name_expected = self.ersem_expected["name"].tolist()
self.assertListEqual(sorted(name_expected), sorted(name))

@pytest.mark.skip()
def test_gotm_func_names(self):
"""
Expand Down Expand Up @@ -154,6 +154,7 @@ def test_netcdf_func_names(self):
name_expected = self.netcdf_expected["name"].tolist()
self.assertListEqual(sorted(name_expected), sorted(name))

@pytest.mark.skip()
def test_ersem_func_calls(self):
"""
Check the number of func calls for ERSEM modules stays the same
Expand All @@ -169,6 +170,7 @@ def test_ersem_func_calls(self):
self.ersem["name"], self.ersem['self calls'])}
assert calls == calls_expected

@pytest.mark.skip()
def test_gotm_func_calls(self):
"""
Check the number of func calls for GOTM modules stays the same
Expand All @@ -182,6 +184,7 @@ def test_gotm_func_calls(self):
{n: c for n, c in zip(self.gotm["name"], self.gotm['self calls'])}
assert calls == calls_expected

@pytest.mark.skip()
def test_fabm_func_calls(self):
"""
Check the number of func calls for FABM modules stays the same
Expand All @@ -195,6 +198,7 @@ def test_fabm_func_calls(self):
{n: c for n, c in zip(self.fabm["name"], self.fabm['self calls'])}
assert calls == calls_expected

@pytest.mark.skip()
def test_netcdf_func_calls(self):
"""
Check the number of func calls for NETCDF modules stays the same
Expand Down
8 changes: 5 additions & 3 deletions github-actions/pyfabm-ersem/pyfabm-ersem-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ git clone https://github.com/fabm-model/fabm.git
echo "Checking out branch: $BRANCH"
cd ersem && git checkout $BRANCH && cd ..

echo "Moving ERSEM config files for pyFABM"
cp github-actions/pyfabm-ersem/setup.cfg fabm

echo "Building PyFABM-ERSEM"
mkdir build && cd build
cmake ../fabm/src/drivers/python -DFABM_ERSEM_BASE=../ersem
make install
cd fabm
python -m pip install .
4 changes: 4 additions & 0 deletions github-actions/pyfabm-ersem/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[build_ext]
cmake_opts=-DFABM_ERSEM_BASE=../ersem
force=1
debug=1
4 changes: 4 additions & 0 deletions testcases/fabm-ersem-15.06-L4-ben-docdyn-iop-denit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ instances:
iswbioalk: 1 # use bioalkalinity (0: off, 1: on), default = 1
initialization:
c: 2130.0 # total dissolved inorganic carbon (mmol C/m^3)
bioalk: 0 # bioalkalinity (mmol/m^3)
R1:
long_name: labile dissolved organic matter
model: ersem/pelagic_base
Expand Down Expand Up @@ -803,6 +804,7 @@ instances:
minD: 0.0001 # minimum depth of zero-concentration isocline (m)
initialization:
o: 0.0225 # oxygen (mmol/m^2)
o_deep: 0 # oxygen below zero isocline (mmol/m^2)
coupling:
o_pel: O2/o # pelagic oxygen (mmol/m^3)
G3:
Expand Down Expand Up @@ -863,6 +865,8 @@ instances:
K4n2: K4/per_layer/n2 # benthic ammonium in 2nd layer (mmol N/m^2)
G2o2: G2/per_layer/o2 # oxygen in 2nd layer (mmol O_2/m^2)
layer2_thickness: ben_col/layer2_thickness # thickness of 2nd layer (m)
initialization:
G4n: 0 # dinitrogen gas (mmol N/m^2)
H1:
long_name: benthic aerobic bacteria
model: ersem/benthic_bacteria
Expand Down
4 changes: 4 additions & 0 deletions testcases/fabm-ersem-15.06-L4-ben-docdyn-iop-n2o.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ instances:
iswbioalk: 1 # use bioalkalinity (0: off, 1: on), default = 1
initialization:
c: 2130.0 # total dissolved inorganic carbon (mmol C/m^3)
bioalk: 0 # bioalkalinity (mmol/m^3)
R1:
long_name: labile dissolved organic matter
model: ersem/pelagic_base
Expand Down Expand Up @@ -796,6 +797,7 @@ instances:
minD: 0.0001 # minimum depth of zero-concentration isocline (m)
initialization:
o: 0.0225 # oxygen (mmol/m^2)
o_deep: 0 # oxygen below zero isocline (mmol/m^2)
coupling:
o_pel: O2/o # pelagic oxygen (mmol/m^3)
G5:
Expand Down Expand Up @@ -868,6 +870,8 @@ instances:
K4n2: K4/per_layer/n2 # benthic ammonium in 2nd layer (mmol N/m^2)
G2o2: G2/per_layer/o2 # oxygen in 2nd layer (mmol O_2/m^2)
layer2_thickness: ben_col/layer2_thickness # thickness of 2nd layer (m)
initialization:
G4n: 0 # dinitrogen gas (mmol N/m^2)
H1:
long_name: benthic aerobic bacteria
model: ersem/benthic_bacteria
Expand Down
4 changes: 4 additions & 0 deletions testcases/fabm-ersem-15.06-L4-ben-docdyn-iop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ instances:
iswbioalk: 1 # use bioalkalinity (0: off, 1: on), default = 1
initialization:
c: 2130.0 # total dissolved inorganic carbon (mmol C/m^3)
bioalk: 0 # bioalkalinity (mmol/m^3)
R1:
long_name: labile dissolved organic matter
model: ersem/pelagic_base
Expand Down Expand Up @@ -787,6 +788,7 @@ instances:
minD: 0.0001 # minimum depth of zero-concentration isocline (m)
initialization:
o: 0.0225 # oxygen (mmol/m^2)
o_deep: 0 # oxygen below zero isocline (mmol/m^2)
coupling:
o_pel: O2/o # pelagic oxygen (mmol/m^3)
G3:
Expand Down Expand Up @@ -847,6 +849,8 @@ instances:
K4n2: K4/per_layer/n2 # benthic ammonium in 2nd layer (mmol N/m^2)
G2o2: G2/per_layer/o2 # oxygen in 2nd layer (mmol O_2/m^2)
layer2_thickness: ben_col/layer2_thickness # thickness of 2nd layer (m)
initialization:
G4n: 0 # dinitrogen gas (mmol N/m^2)
H1:
long_name: benthic aerobic bacteria
model: ersem/benthic_bacteria
Expand Down
1 change: 1 addition & 0 deletions testcases/fabm-ersem-15.06-L4-noben-docdyn-iop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ instances:
iswbioalk: 1 # use bioalkalinity (0: off, 1: on), default = 1
initialization:
c: 2130.0 # total dissolved inorganic carbon (mmol C/m^3)
bioalk: 0 # bioalkalinity (mmol/m^3)
R1:
long_name: labile dissolved organic matter
model: ersem/pelagic_base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ instances:
iswbioalk: 1 # use bioalkalinity (0: off, 1: on), default = 1
initialization:
c: 2130.0 # total dissolved inorganic carbon (mmol C/m^3)
bioalk: 0 # bioalkalinity (mmol/m^3)
R1:
long_name: labile dissolved organic matter
model: ersem/pelagic_base
Expand Down Expand Up @@ -768,6 +769,7 @@ instances:
minD: 0.0001 # minimum depth of zero-concentration isocline (m)
initialization:
o: 0.0225 # oxygen (mmol/m^2)
o_deep: 0 # oxygen below zero isocline (mmol/m^2)
coupling:
o_pel: O2/o # pelagic oxygen (mmol/m^3)
G3:
Expand Down Expand Up @@ -828,6 +830,8 @@ instances:
K4n2: K4/per_layer/n2 # benthic ammonium in 2nd layer (mmol N/m^2)
G2o2: G2/per_layer/o2 # oxygen in 2nd layer (mmol O_2/m^2)
layer2_thickness: ben_col/layer2_thickness # thickness of 2nd layer (m)
initialization:
G4n: 0 # dinitrogen gas (mmol N/m^2)
H1:
long_name: benthic aerobic bacteria
model: ersem/benthic_bacteria
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ instances:
iswbioalk: 1 # use bioalkalinity (0: off, 1: on), default = 1
initialization:
c: 2130.0 # total dissolved inorganic carbon (mmol C/m^3)
bioalk: 0 # bioalkalinity (mmol/m^3)
R1:
long_name: labile dissolved organic matter
model: ersem/pelagic_base
Expand Down

0 comments on commit a018ee0

Please sign in to comment.