diff --git a/interfaces/matlab_experimental/LoadCantera.m b/interfaces/matlab_experimental/LoadCantera.m index 659783f854..690034159d 100644 --- a/interfaces/matlab_experimental/LoadCantera.m +++ b/interfaces/matlab_experimental/LoadCantera.m @@ -1,6 +1,6 @@ function LoadCantera addpath('Class', 'Utility', 'PresetMixtures', 'PresetReactors', ... - 'PresetObjects', '1D', 'Examples'); + 'PresetObjects', '1D'); if ispc ctname = 'cantera_shared.dll'; elseif ismac @@ -22,6 +22,8 @@ 'ctonedim','addheader','ctreactor', ... 'addheader','ctrpath','addheader','ctsurf', ... 'addheader','ctxml'); + example_dir = [cantera_root, '/samples/matlab_new']; + addpath(example_dir); end disp('Cantera is ready for use'); end diff --git a/interfaces/matlab_experimental/readme.txt b/interfaces/matlab_experimental/readme.txt index 5bbb52ac7b..3ca168570e 100644 --- a/interfaces/matlab_experimental/readme.txt +++ b/interfaces/matlab_experimental/readme.txt @@ -8,7 +8,8 @@ https://cantera.org/install/compiling-install.html 3) Here is a list of cantera.conf options I used for development: python_package = 'full' matlab_toolbox = 'y' -4) After building and installing Cantera from source. Move [path/to/cantera/source/code/interfaces/Matlab_Toolbox_Revamp] to [/path/to/cantera/installation/matlab] +4) After building and installing Cantera from source. Move [path/to/cantera/source/code/interfaces/Matlab_Toolbox_Revamp] to [/path/to/cantera/installation/matlab] *Temporary +4.1) Copy [path/to/cantera/source/code/samples/matlab_new] to [/path/to/cantera/installation/samples] *Temporary 5) Launch Matlab, then navigate to [/path/to/cantera/installation/matlab/Matlab_Toolbox_Revamp] using "Browse for Folder". 6) In the Matlab command window, type SetCanteraPath('path/to/cantera/installation'). This should generate a cantera_root.mat file under the Matlab_Toolbox_Revamp/Utility folder, which stores the path as a Matlab variable. 7) In the command window, type LoadCantera to start using Cantera. diff --git a/samples/matlab_experimental/conhp.m b/samples/matlab_experimental/conhp.m index 5e1de06a99..ef42f79149 100644 --- a/samples/matlab_experimental/conhp.m +++ b/samples/matlab_experimental/conhp.m @@ -13,15 +13,17 @@ % energy equation wdot = gas.netProdRates; + H = gas.enthalpies_RT'; gas.basis = 'mass'; - tdot = - gas.T * gasconstant * gas.enthalpies_RT .* wdot / (gas.D * gas.cp); + tdot = - gas.T * gasconstant /(gas.D * gas.cp).* wdot * H; % set up column vector for dydt - dydt = [tdot' + dydt = [tdot zeros(nsp, 1)]; % species equations rrho = 1.0/gas.D; for i = 1:nsp dydt(i+1) = rrho * mw(i) * wdot(i); + end end diff --git a/samples/matlab_experimental/conuv.m b/samples/matlab_experimental/conuv.m index 1bede4c6e7..4f27104d3c 100644 --- a/samples/matlab_experimental/conuv.m +++ b/samples/matlab_experimental/conuv.m @@ -14,12 +14,12 @@ % energy equation wdot = gas.netProdRates; + H = (gas.enthalpies_RT - ones(1, nsp))'; gas.basis = 'mass'; - tdot = - gas.T * gasconstant * (gas.enthalpies_RT - ones(1, nsp)) ... - .* wdot / (gas.D * gas.cv); + tdot = - gas.T * gasconstant / (gas.D * gas.cv).* wdot * H; % set up column vector for dydt - dydt = [tdot' + dydt = [tdot zeros(nsp, 1)]; % species equations