Skip to content

Commit

Permalink
Merge branch 'main' into C++Example-CustomODEs
Browse files Browse the repository at this point in the history
  • Loading branch information
paulblum authored Sep 6, 2020
2 parents 46b39b8 + 986f44b commit 13745ae
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
run: |
sudo apt-get install libboost-dev gfortran scons python3-numpy \
python3-pip python3-setuptools python3-h5py python3-pandas \
python3-ruamel.yaml cython libsundials-dev liblapack-dev \
python3-ruamel.yaml python-numpy cython3 libsundials-dev liblapack-dev \
libblas-dev
- name: Build Cantera
run: scons build python_cmd=/usr/bin/python3 blas_lapack_libs=lapack,blas -j2
Expand Down
15 changes: 10 additions & 5 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1347,11 +1347,6 @@ if env['python_package'] != 'none':
ruamel_yaml_version, ruamel_min_version))
sys.exit(1)

if len(info) > expected_output_lines:
print("WARNING: Unexpected output while checking Python "
"dependency versions:")
print('| ' + '\n| '.join(info[expected_output_lines:]))

if warn_no_python:
if env['python_package'] == 'default':
print('WARNING: Not building the Python package because the Python '
Expand All @@ -1370,7 +1365,17 @@ if env['python_package'] != 'none':
elif env["python_package"] == "default":
print(msg.format("WARNING", python_version, python_min_version))
env["python_package"] = "none"
elif env['python_package'] == 'minimal':
# If the minimal package was specified, no further checking
# needs to be done
print('INFO: Building the minimal Python package for Python {}'.format(python_version))
else:

if len(info) > expected_output_lines:
print("WARNING: Unexpected output while checking Python "
"dependency versions:")
print('| ' + '\n| '.join(info[expected_output_lines:]))

warn_no_full_package = False
if python_version >= LooseVersion("3.8"):
# Reset the minimum Cython version if the Python version is 3.8 or higher
Expand Down
1 change: 1 addition & 0 deletions samples/cxx/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Import('env', 'build', 'install', 'buildSample')
samples = [
('combustor', 'combustor', ['cpp'], False),
('custom', 'custom', ['cpp'], False),
('demo', 'demo', ['cpp'], False),
('flamespeed', 'flamespeed', ['cpp'], False),
('kinetics1', 'kinetics1', ['cpp'], False),
('gas_transport', 'gas_transport', ['cpp'], False),
Expand Down
6 changes: 3 additions & 3 deletions samples/cxx/demo.cpp → samples/cxx/demo/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void demoprog()

// create a transport manager for the gas that computes
// mixture-averaged properties
std::unique_ptr<Transport> tr(newTransportMgr("Mix", &gas, 0));
std::unique_ptr<Transport> tr(newTransportMgr("Mix", sol->thermo().get()));

// print the viscosity, thermal conductivity, and diffusion
// coefficients
Expand All @@ -101,9 +101,9 @@ void demoprog()
vector_fp diff(nsp);
tr->getMixDiffCoeffs(&diff[0]);
int k;
writelog("\n\n{:20s} {:26s}\n", "Species", "Diffusion Coefficient");
writelog("\n\n{:20s} {:21s}\n", "Species", "Diffusion Coefficient");
for (k = 0; k < nsp; k++) {
writelog("{:20s} {:14.5g} m2/s \n", gas->speciesName(k), diff[k]);
writelog("{:20s} {:14.5g} m2/s\n", gas->speciesName(k), diff[k]);
}
}

Expand Down
3 changes: 3 additions & 0 deletions test_problems/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ Test('cxx-combustor', 'cxx_samples', '#build/samples/cxx/combustor/combustor', N
Test('cxx-custom', 'cxx_samples', '#build/samples/cxx/custom/custom', None,
comparisons=[('custom_cxx_blessed.csv', 'custom_cxx.csv')],
threshold=1e-10, tolerance=2e-4)
Test('cxx-demo', 'cxx_samples', '#build/samples/cxx/demo/demo',
'cxx_demo_blessed.txt',
threshold=1e-10, tolerance=2e-4)
Test('cxx-flamespeed', 'cxx_samples', '#build/samples/cxx/flamespeed/flamespeed',
'cxx_flamespeed_blessed.txt',
comparisons=[('flamespeed_blessed.csv', 'flamespeed.csv')],
Expand Down
68 changes: 68 additions & 0 deletions test_problems/cxx_samples/cxx_demo_blessed.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

**** C++ Test Program ****


Initial state:

Temperature: 1200 K
Pressure: 1.0132e+05 Pa
Density: 0.28921 kg/m3
Molar Enthalpy: 2.3514e+07 J/kmol
Molar Entropy: 2.0594e+05 J/kmol-K
Molar cp: 27056 J/kmol-K


Equilibrium state:

Temperature: 2800.9 K
Pressure: 1.0133e+05 Pa
Density: 0.13658 kg/m3
Molar Enthalpy: 2.592e+07 J/kmol
Molar Entropy: 2.4314e+05 J/kmol-K
Molar cp: 32363 J/kmol-K


2 O + M <=> O2 + M 0.0056821 0.0056821 7.8063e-18 kmol/m3/s
H + O + M <=> OH + M 0.0056583 0.0056583 9.541e-18 kmol/m3/s
H2 + O <=> H + OH 134.45 134.45 5.6843e-13 kmol/m3/s
HO2 + O <=> O2 + OH 0.22106 0.22106 1.9151e-15 kmol/m3/s
H2O2 + O <=> HO2 + OH 0.014203 0.014203 -9.0206e-17 kmol/m3/s
H + O2 + M <=> HO2 + M 0.027607 0.027607 -3.1225e-17 kmol/m3/s
H + 2 O2 <=> HO2 + O2 0.014337 0.014337 -8.6736e-17 kmol/m3/s
H + H2O + O2 <=> H2O + HO2 0.64778 0.64778 2.6645e-15 kmol/m3/s
AR + H + O2 <=> AR + HO2 0.069116 0.069116 2.7756e-16 kmol/m3/s
H + O2 <=> O + OH 142.55 142.55 3.1264e-13 kmol/m3/s
2 H + M <=> H2 + M 0.0015624 0.0015624 2.6021e-18 kmol/m3/s
2 H + H2 <=> 2 H2 8.8217e-05 8.8217e-05 3.2526e-19 kmol/m3/s
2 H + H2O <=> H2 + H2O 0.0054975 0.0054975 1.8215e-17 kmol/m3/s
H + OH + M <=> H2O + M 0.13038 0.13038 -4.4409e-16 kmol/m3/s
H + HO2 <=> H2O + O 0.019776 0.019776 -6.9389e-17 kmol/m3/s
H + HO2 <=> H2 + O2 0.2078 0.2078 -1.1935e-15 kmol/m3/s
H + HO2 <=> 2 OH 0.42115 0.42115 2.1649e-15 kmol/m3/s
H + H2O2 <=> H2 + HO2 0.0073139 0.0073139 -4.0766e-17 kmol/m3/s
H + H2O2 <=> H2O + OH 0.0010271 0.0010271 -5.6379e-18 kmol/m3/s
H2 + OH <=> H + H2O 229.06 229.06 -1.3927e-12 kmol/m3/s
2 OH (+M) <=> H2O2 (+M) 0.54038 0.54038 -1.3323e-15 kmol/m3/s
2 OH <=> H2O + O 375.33 375.33 -3.8085e-12 kmol/m3/s
HO2 + OH <=> H2O + O2 0.40738 0.40738 -7.7716e-16 kmol/m3/s
H2O2 + OH <=> H2O + HO2 0.00166 0.00166 -1.0192e-17 kmol/m3/s
H2O2 + OH <=> H2O + HO2 7.7286 7.7286 -4.7073e-14 kmol/m3/s
2 HO2 <=> H2O2 + O2 2.9976e-06 2.9976e-06 1.5247e-20 kmol/m3/s
2 HO2 <=> H2O2 + O2 0.00083671 0.00083671 4.12e-18 kmol/m3/s
HO2 + OH <=> H2O + O2 5.7067 5.7067 -1.1546e-14 kmol/m3/s


Viscosity: 0.00010415 Pa-s
Thermal conductivity: 0.16396 W/m/K


Species Diffusion Coefficient
H2 0.0036495 m2/s
H 0.0061986 m2/s
O 0.0015513 m2/s
O2 0.00099488 m2/s
OH 0.001528 m2/s
H2O 0.0014315 m2/s
HO2 0.00097725 m2/s
H2O2 0.00097012 m2/s
AR 0.00075972 m2/s

0 comments on commit 13745ae

Please sign in to comment.