Skip to content

Instantly share code, notes, and snippets.

View speth's full-sized avatar

Ray Speth speth

View GitHub Profile
@speth
speth / reactornet-restart.cpp
Created February 16, 2012 16:39
Cantera reactor network restart example
// Example demonstrating how to restart a Reactor network using a new
// initial condition.
#include <cantera/zerodim.h>
#include <cantera/IdealGasMix.h>
#include <iostream>
using namespace Cantera;
@speth
speth / ct_defs.h
Created May 30, 2012 13:52
Cantera physical constants
#define _USE_MATH_DEFINES
#include <cmath>
/*!
* All physical constants are stored here.
*
* @defgroup physConstants Physical Constants
* %Cantera uses the MKS system of units. The unit for moles
* is defined to be the kmol. All values of physical constants
* are consistent with the 2010 CODATA recommendations.
@speth
speth / 00-input-files.md
Last active December 5, 2019 15:21
Cantera input file format sandbox

Issues with CTI Input Files

  • Loss of opportunity for interoperability with other software that is easier with a standard format
  • Run-time Python dependency is a source of never-ending difficulty for users
  • Extra work required to implement new input file features, since they need to be implemented in both CTI and XML, which leads to incompleteness in the CTI interface and requries users to use the XML interface in certain cases.

Issues with XML input files

  • The format itself is needlessly verbose. Consider the definition of a single 'falloff' reaction in XML:
@speth
speth / H2flame.m
Last active December 10, 2015 21:18 — forked from mohsenayoobi/H2flame.m
% FLAME1 - A burner-stabilized flat flame
%
% This script simulates a burner-stablized lean hydrogen-oxygen flame
% at low pressure.
help flame1;
%disp('press any key to begin the simulation');
%pause;
t0 = cputime; % record the starting time
@speth
speth / co2_RK.cti
Last active December 18, 2015 14:29
Cantera CTML writer
units(length = "cm", time = "s", quantity = "mol", act_energy = "cal/mol")
RedlichKwongMFTP(name = "carbondioxide",
elements = " C O H ",
species = """ CO2 H2O """,
activity_coefficients = (pureFluidParameters(species="CO2", a_coeff = [7.54e12, -4.13e9], b_coeff = 27.80),
pureFluidParameters(species="H2O", a_coeff = [1.7458E13, -8.0E9], b_coeff = 18.18),
crossFluidParameters(species="CO2 H2O", a_coeff = [7.897e12, 0]) ),
initial_state = state(temperature = 300.0,
@speth
speth / cantera-files.txt
Created April 28, 2015 19:52
List of Cantera files installed using Homebrew
/usr/local/Cellar/cantera/HEAD/AUTHORS
/usr/local/Cellar/cantera/HEAD/bin/ck2cti
/usr/local/Cellar/cantera/HEAD/bin/csvdiff
/usr/local/Cellar/cantera/HEAD/bin/ctml_writer
/usr/local/Cellar/cantera/HEAD/bin/mixmaster
/usr/local/Cellar/cantera/HEAD/bin/setup_cantera
/usr/local/Cellar/cantera/HEAD/include/cantera/base/Array.h
/usr/local/Cellar/cantera/HEAD/include/cantera/base/clockWC.h
/usr/local/Cellar/cantera/HEAD/include/cantera/base/config.h
/usr/local/Cellar/cantera/HEAD/include/cantera/base/config.h.in
@speth
speth / ctmatlab.h
Created November 7, 2016 18:31
Cantera Matlab interface using "loadlibrary"
#include "ct.h"
#include "ctfunc.h"
#include "ctmultiphase.h"
#include "ctonedim.h"
#include "ctreactor.h"
#include "ctrpath.h"
#include "ctsurf.h"
#include "ctxml.h"

Contributing to Cantera

  • For significant changes, consider starting a discussion on the Cantera Users' Group to plan your modifications so that they can be implemented efficiently and in a way that doesn't conflict with any other planned future development
  • Fork the Cantera/cantera repository on Github
  • Clone your new repository or add it as a remote to an existing repository
  • Check out the existing 'master' branch, then start a new feature branch for your work
@speth
speth / 01 debug=stacktrace
Last active November 29, 2016 03:27
SCons MinGW Shared library issue
scons: Reading SConscript files ...
Traceback (most recent call last):
File "c:\src\Canopy\User\Lib\site-packages\scons-2.5.1\SCons\Script\Main.py", line 1346, in main
_exec_main(parser, values)
File "c:\src\Canopy\User\Lib\site-packages\scons-2.5.1\SCons\Script\Main.py", line 1309, in _exec_main
_main(parser)
File "c:\src\Canopy\User\Lib\site-packages\scons-2.5.1\SCons\Script\Main.py", line 994, in _main
SCons.Script._SConscript._SConscript(fs, script)
File "c:\src\Canopy\User\Lib\site-packages\scons-2.5.1\SCons\Script\SConscript.py", line 250, in _SConscript
exec _file_ in call_stack[-1].globals
@speth
speth / ch4_ion.cti
Created April 12, 2017 23:13
faster IonFlow test case
units(length='cm', time='s', quantity='mol', act_energy='cal/mol')
ideal_gas(name='gas',
elements='O H C N E',
species=['''gri30: H2 H O O2 OH H2O HO2
H2O2 C CH CH2 CH2(S) CH3 CH4
CO CO2 HCO CH2O CH3O N2''',
'HCO+ H3O+ E'],
reactions=['gri30: all', 'all'],
transport='Mix',