-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run isothermal Soret channel as a test (#441)
* run isothermal Soret channel as a test * fix warns * remove unused input from isothermal soret * remove more unused * add python test to verify species conservation * add a bit of documentation on Soret + isothermal * fix typos in docs * fix up copy/paste stuff in python test * uncomment fpe trapping * re-comment out some FPE trapping stuff * fix another typo in docs --------- Co-authored-by: Thomas Howarth <[email protected]>
- Loading branch information
1 parent
176deb4
commit d7c123c
Showing
7 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
import numpy.testing as npt | ||
import pandas as pd | ||
import unittest | ||
|
||
class SpeciesBalTestCase(unittest.TestCase): | ||
"""Test species balance with isothermal walls and soret""" | ||
|
||
def test_composition(self): | ||
"""Verify species conservation""" | ||
|
||
# Load the data | ||
fdir = os.path.abspath(".") | ||
fname = os.path.join(fdir, "temporals/tempSpecies") | ||
df = pd.read_csv(fname) | ||
print(df) | ||
for col in df.columns: | ||
if col.startswith('rhoYnew'): | ||
init_value = df[col][0] | ||
if init_value != 0.0: | ||
print('testing (relative)', col) | ||
npt.assert_allclose(df[col], init_value, rtol=1e-13) | ||
else: | ||
print('testing (absolute)', col) | ||
npt.assert_allclose(df[col], init_value, atol=1e-13) | ||
if col.startswith('netFlux'): | ||
print('testing (absolute)', col) | ||
npt.assert_allclose(df[col], 0.0, atol=1e-13) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters