From ab251257e5980192cab9c73a54cdc56df405902d Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Fri, 18 Jul 2014 14:33:09 +0000 Subject: [PATCH] [Matlab] Trivial changes to variable names and whitespace for consistency --- .../matlab/toolbox/1D/@Domain1D/Domain1D.m | 10 +++---- .../toolbox/1D/@Domain1D/componentIndex.m | 3 +- .../toolbox/1D/@Domain1D/massFraction.m | 7 +++-- interfaces/matlab/toolbox/1D/@Domain1D/set.m | 20 ++++++------- .../matlab/toolbox/1D/@Domain1D/setBounds.m | 2 +- .../toolbox/1D/@Domain1D/setCoverageEqs.m | 10 +++---- .../1D/@Domain1D/setFixedTempProfile.m | 2 +- .../matlab/toolbox/1D/@Domain1D/setProfile.m | 4 +-- .../1D/@Domain1D/setSteadyTolerances.m | 3 +- .../1D/@Domain1D/setTransientTolerances.m | 3 +- interfaces/matlab/toolbox/1D/@Stack/Stack.m | 2 +- .../matlab/toolbox/1D/@Stack/domainIndex.m | 7 +++-- interfaces/matlab/toolbox/1D/@Stack/grid.m | 5 ++-- .../matlab/toolbox/1D/@Stack/plotSolution.m | 3 +- .../matlab/toolbox/1D/@Stack/setFlatProfile.m | 5 ++-- .../matlab/toolbox/1D/@Stack/setProfile.m | 13 ++++---- .../toolbox/1D/@Stack/setRefineCriteria.m | 5 ++-- interfaces/matlab/toolbox/1D/@Stack/subsref.m | 3 +- .../matlab/toolbox/1D/AxisymmetricFlow.m | 4 +-- interfaces/matlab/toolbox/1D/FreeFlame.m | 4 +-- interfaces/matlab/toolbox/1D/Inlet.m | 4 +-- interfaces/matlab/toolbox/1D/Outlet.m | 4 +-- interfaces/matlab/toolbox/1D/OutletRes.m | 4 +-- interfaces/matlab/toolbox/1D/Surface.m | 6 ++-- interfaces/matlab/toolbox/1D/SymmPlane.m | 4 +-- interfaces/matlab/toolbox/1D/npflame_init.m | 30 +++++++++---------- .../matlab/toolbox/@FlowDevice/FlowDevice.m | 4 +-- interfaces/matlab/toolbox/@FlowDevice/clear.m | 3 +- .../matlab/toolbox/@FlowDevice/install.m | 2 +- interfaces/matlab/toolbox/@Func/Func.m | 26 ++++++++-------- interfaces/matlab/toolbox/@Func/char.m | 16 +++++----- interfaces/matlab/toolbox/@Func/plus.m | 2 +- interfaces/matlab/toolbox/@Func/rdivide.m | 5 ++-- interfaces/matlab/toolbox/@Func/subsref.m | 4 +-- interfaces/matlab/toolbox/@Func/times.m | 5 ++-- .../matlab/toolbox/@Interface/Interface.m | 16 +++++----- .../toolbox/@Interface/concentrations.m | 6 ++-- .../matlab/toolbox/@Interface/coverages.m | 6 ++-- .../matlab/toolbox/@Interface/setCoverages.m | 4 +-- .../matlab/toolbox/@Kinetics/Kinetics.m | 10 +++---- interfaces/matlab/toolbox/@Kinetics/clear.m | 3 +- .../matlab/toolbox/@Kinetics/creationRates.m | 4 +-- .../toolbox/@Kinetics/destructionRates.m | 4 +-- .../toolbox/@Kinetics/destruction_rates.m | 9 +++--- .../matlab/toolbox/@Kinetics/equil_Kc.m | 7 +++-- .../toolbox/@Kinetics/fwdRateConstants.m | 2 +- .../matlab/toolbox/@Kinetics/isReversible.m | 2 +- .../matlab/toolbox/@Kinetics/multiplier.m | 4 +-- .../matlab/toolbox/@Kinetics/nReactions.m | 2 +- .../matlab/toolbox/@Kinetics/netProdRates.m | 4 +-- .../matlab/toolbox/@Kinetics/reactionEqn.m | 4 +-- .../toolbox/@Kinetics/revRateConstants.m | 2 +- interfaces/matlab/toolbox/@Kinetics/rop.m | 9 +++--- interfaces/matlab/toolbox/@Kinetics/rop_f.m | 4 +-- interfaces/matlab/toolbox/@Kinetics/rop_net.m | 5 ++-- interfaces/matlab/toolbox/@Kinetics/rop_r.m | 10 ++++++- .../matlab/toolbox/@Kinetics/setMultiplier.m | 8 +++-- .../matlab/toolbox/@Kinetics/stoich_net.m | 7 ++--- .../matlab/toolbox/@Kinetics/stoich_p.m | 13 ++++---- .../matlab/toolbox/@Kinetics/stoich_r.m | 13 ++++---- interfaces/matlab/toolbox/@Kinetics/ydot.m | 2 +- interfaces/matlab/toolbox/@Mixture/Mixture.m | 8 ++--- interfaces/matlab/toolbox/@Mixture/addPhase.m | 8 ++--- interfaces/matlab/toolbox/@Mixture/display.m | 4 +-- .../matlab/toolbox/@Mixture/equilibrate.m | 3 +- .../matlab/toolbox/@Mixture/phaseMoles.m | 2 +- interfaces/matlab/toolbox/@Mixture/pressure.m | 5 ++-- .../matlab/toolbox/@Mixture/temperature.m | 5 ++-- interfaces/matlab/toolbox/@Reactor/Reactor.m | 6 ++-- .../matlab/toolbox/@Reactor/massFraction.m | 8 ++++- .../matlab/toolbox/@Reactor/setEnergy.m | 10 +++---- .../toolbox/@Reactor/setInitialVolume.m | 5 ++-- .../matlab/toolbox/@ReactorNet/ReactorNet.m | 12 ++++---- .../matlab/toolbox/@ThermoPhase/ThermoPhase.m | 10 +++---- .../toolbox/@ThermoPhase/atomicMasses.m | 5 ++-- .../toolbox/@ThermoPhase/chemPotentials.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/clear.m | 5 ++-- interfaces/matlab/toolbox/@ThermoPhase/cp_R.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/cp_mass.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/cp_mole.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/critDensity.m | 5 ++-- .../toolbox/@ThermoPhase/critPressure.m | 5 ++-- .../toolbox/@ThermoPhase/critTemperature.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/cv_mass.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/cv_mole.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/density.m | 5 ++-- .../toolbox/@ThermoPhase/electricPotential.m | 5 ++-- .../toolbox/@ThermoPhase/elementIndex.m | 8 ++--- .../matlab/toolbox/@ThermoPhase/elementName.m | 5 ++-- .../toolbox/@ThermoPhase/enthalpies_RT.m | 5 ++-- .../toolbox/@ThermoPhase/enthalpy_mass.m | 5 ++-- .../toolbox/@ThermoPhase/enthalpy_mole.m | 3 +- .../matlab/toolbox/@ThermoPhase/entropies_R.m | 5 ++-- .../toolbox/@ThermoPhase/entropy_mass.m | 5 ++-- .../toolbox/@ThermoPhase/entropy_mole.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/eosType.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/equilibrate.m | 4 +-- .../matlab/toolbox/@ThermoPhase/gibbs_RT.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/gibbs_mass.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/gibbs_mole.m | 5 ++-- .../toolbox/@ThermoPhase/intEnergy_mass.m | 5 ++-- .../toolbox/@ThermoPhase/intEnergy_mole.m | 4 +-- .../matlab/toolbox/@ThermoPhase/isIdealGas.m | 5 ++-- .../@ThermoPhase/isothermalCompressibility.m | 6 ++-- .../toolbox/@ThermoPhase/massFraction.m | 12 ++++---- .../toolbox/@ThermoPhase/massFractions.m | 9 +++--- .../matlab/toolbox/@ThermoPhase/maxTemp.m | 5 ++-- .../toolbox/@ThermoPhase/meanMolarMass.m | 5 ++-- .../@ThermoPhase/meanMolecularWeight.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/minTemp.m | 5 ++-- .../toolbox/@ThermoPhase/molarDensity.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/molarMasses.m | 5 ++-- .../toolbox/@ThermoPhase/moleFraction.m | 12 ++++---- .../toolbox/@ThermoPhase/moleFractions.m | 7 +++-- .../matlab/toolbox/@ThermoPhase/nAtoms.m | 11 +++---- .../matlab/toolbox/@ThermoPhase/nElements.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/nSpecies.m | 5 ++-- interfaces/matlab/toolbox/@ThermoPhase/name.m | 5 ++-- interfaces/matlab/toolbox/@ThermoPhase/ph.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/pressure.m | 5 ++-- .../toolbox/@ThermoPhase/private/thermo_get.m | 6 ++-- .../matlab/toolbox/@ThermoPhase/refPressure.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/satPressure.m | 5 ++-- .../toolbox/@ThermoPhase/satTemperature.m | 5 ++-- interfaces/matlab/toolbox/@ThermoPhase/set.m | 6 ++-- .../matlab/toolbox/@ThermoPhase/setDensity.m | 7 +++-- .../@ThermoPhase/setElectricPotential.m | 5 ++-- .../toolbox/@ThermoPhase/setMassFractions.m | 16 +++++----- .../toolbox/@ThermoPhase/setMoleFractions.m | 16 +++++----- .../matlab/toolbox/@ThermoPhase/setName.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/setPressure.m | 7 +++-- .../matlab/toolbox/@ThermoPhase/setState.m | 6 ++-- .../matlab/toolbox/@ThermoPhase/setState_HP.m | 7 +++-- .../toolbox/@ThermoPhase/setState_Psat.m | 4 +-- .../matlab/toolbox/@ThermoPhase/setState_SP.m | 9 +++--- .../matlab/toolbox/@ThermoPhase/setState_SV.m | 9 +++--- .../toolbox/@ThermoPhase/setState_Tsat.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/setState_UV.m | 7 +++-- .../toolbox/@ThermoPhase/setState_satLiquid.m | 5 ++-- .../toolbox/@ThermoPhase/setState_satVapor.m | 5 ++-- .../toolbox/@ThermoPhase/setTemperature.m | 7 +++-- .../toolbox/@ThermoPhase/speciesIndex.m | 12 ++++---- .../matlab/toolbox/@ThermoPhase/speciesName.m | 9 +++--- .../toolbox/@ThermoPhase/speciesNames.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/temperature.m | 5 ++-- .../@ThermoPhase/thermalExpansionCoeff.m | 5 ++-- .../matlab/toolbox/@ThermoPhase/thermo_hndl.m | 5 ++-- .../toolbox/@ThermoPhase/vaporFraction.m | 5 ++-- .../matlab/toolbox/@Transport/Transport.m | 8 ++--- interfaces/matlab/toolbox/@Wall/Wall.m | 4 +-- interfaces/matlab/toolbox/@Wall/install.m | 3 +- interfaces/matlab/toolbox/@Wall/setKinetics.m | 2 +- .../matlab/toolbox/@XML_Node/XML_Node.m | 6 ++-- interfaces/matlab/toolbox/@XML_Node/attrib.m | 2 +- interfaces/matlab/toolbox/@XML_Node/build.m | 2 +- .../matlab/toolbox/@XML_Node/findByID.m | 3 +- .../matlab/toolbox/@XML_Node/findByName.m | 3 +- interfaces/matlab/toolbox/@XML_Node/value.m | 2 +- interfaces/matlab/toolbox/GRI30.m | 14 +++++---- interfaces/matlab/toolbox/Hydrogen.m | 5 ++-- interfaces/matlab/toolbox/IdealGasMix.m | 17 ++++++----- interfaces/matlab/toolbox/Methane.m | 5 ++-- interfaces/matlab/toolbox/Nitrogen.m | 3 +- interfaces/matlab/toolbox/Oxygen.m | 5 ++-- interfaces/matlab/toolbox/Valve.m | 7 +++-- interfaces/matlab/toolbox/Water.m | 3 +- interfaces/matlab/toolbox/adddir.m | 3 +- interfaces/matlab/toolbox/air.m | 3 +- interfaces/matlab/toolbox/ck2cti.m | 4 +-- interfaces/matlab/toolbox/cleanup.m | 1 + interfaces/matlab/toolbox/constants.m | 4 +-- interfaces/matlab/toolbox/importEdge.m | 2 +- 172 files changed, 576 insertions(+), 464 deletions(-) diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m b/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m index be9631872..1f0b2b976 100755 --- a/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m @@ -8,31 +8,31 @@ if nargin == 1 elseif nargin == 2 % a stagnation flow if a == 1 - if isa(b,'Solution') + if isa(b, 'Solution') d.dom_id = domain_methods(0, 1, thermo_hndl(b), kinetics_hndl(b), ... trans_hndl(b), 1); else error('Wrong argument type. Expecting instance of class Solution.'); end elseif a == 6 - if isa(b,'Interface') + if isa(b, 'Interface') d.dom_id = domain_methods(0, 6, kinetics_hndl(b)); else error('Wrong argument type. Expecting instance of class Interface.'); end else - error('wrong object type'); + error('Wrong object type.'); end elseif nargin == 3 if a == 1 - if isa(b,'Solution') + if isa(b, 'Solution') d.dom_id = domain_methods(0, 1, thermo_hndl(b), kinetics_hndl(b), ... trans_hndl(b), c); else error('Wrong argument type. Expecting instance of class Solution.'); end else - error('unknown domain type'); + error('Unknown domain type.'); end end if d.dom_id < 0 diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m b/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m index c3a357ae8..543e76693 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m @@ -1,7 +1,8 @@ function n = componentIndex(d, name) % COMPONENTINDEX - % -if isa(name,'double') + +if isa(name, 'double') n = name; else n = domain_methods(d.dom_id, 18, name); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m b/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m index c76c6373c..70f71225a 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m @@ -5,12 +5,13 @@ function y = massFraction(d, k) % k is the integer index of the species in the flow domain % to which the boundary domain is attached. % + if domainIndex(d) == 0 - error('no flow domain attached!') + error('No flow domain attached!') end if isInlet(d) - y = domain_methods(d.dom_id,16,k-1); + y = domain_methods(d.dom_id, 16, k-1); else - error('not yet...'); + error('Input domain must be an inlet'); end diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/set.m b/interfaces/matlab/toolbox/1D/@Domain1D/set.m index 2ecf6a5b0..44db158b8 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/set.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/set.m @@ -32,21 +32,21 @@ while length(property_argin) >= 2, property_argin = property_argin(3:end); switch prop case 'Temperature' - setTemperature(a,val); + setTemperature(a, val); case 'T' - setTemperature(a,val); + setTemperature(a, val); case 'MassFractions' - setMassFractions(a,val); + setMassFractions(a, val); case 'Y' - setMassFractions(a,val); + setMassFractions(a, val); case 'mdot' - setMdot(a,val); + setMdot(a, val); case 'MassFlux' - setMdot(a,val); + setMdot(a, val); case 'P' - setPressure(a,val); + setPressure(a, val); case 'Pressure' - setPressure(a,val); + setPressure(a, val); case 'tol' sz = size(val); if sz == nComponents(a) @@ -54,7 +54,7 @@ while length(property_argin) >= 2, elseif length(val) == 2 setSteadyTolerances(a, 'default', val(1), val(2)); else - error('wrong array size for error tolerances'); + error('Wrong array size for error tolerances.'); end case 'tol-time' sz = size(val); @@ -65,7 +65,7 @@ while length(property_argin) >= 2, at = val(2); setTransientTolerances(a, 'default', rt, at); else - error('wrong array size for error tolerances'); + error('Wrong array size for error tolerances.'); end case 'grid' setupGrid(a, val); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setBounds.m b/interfaces/matlab/toolbox/1D/@Domain1D/setBounds.m index 08762d61e..f42243e13 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setBounds.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setBounds.m @@ -1,5 +1,5 @@ function d = setBounds(d, component, lower, upper) % SETBOUNDS - % -n = componentIndex(d,component); +n = componentIndex(d, component); domain_methods(d.dom_id, 51, n, lower, upper); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setCoverageEqs.m b/interfaces/matlab/toolbox/1D/@Domain1D/setCoverageEqs.m index 91d982e88..b1d56437a 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setCoverageEqs.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setCoverageEqs.m @@ -1,4 +1,4 @@ -function d = setCoverageEqs(d,onoff) +function d = setCoverageEqs(d, onoff) % SETCOVERAGEEQS - Enable or disable solving the coverage equations. % if d.domain_type ~= 6 @@ -7,14 +7,14 @@ end ion = -1; if isa(onoff,'char') - if strcmp(onoff,'on') || strcmp(onoff,'yes') + if strcmp(onoff, 'on') || strcmp(onoff, 'yes') ion = 1; - elseif strcmp(onoff,'off') || strcmp(onoff,'no') + elseif strcmp(onoff, 'off') || strcmp(onoff, 'no') ion = 0; else - error(strcat('unknown option: ',onoff)) + error(strcat('unknown option: ', onoff)) end -elseif isa(onoff,'numeric') +elseif isa(onoff, 'numeric') ion = onoff; end domain_methods(d.dom_id, 120, ion); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setFixedTempProfile.m b/interfaces/matlab/toolbox/1D/@Domain1D/setFixedTempProfile.m index f18225fcc..a6d3b8b90 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setFixedTempProfile.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setFixedTempProfile.m @@ -10,6 +10,6 @@ if sz(1) == 2 elseif sz(2) == 2 domain_methods(d.dom_id, 64, profile(:,1), profile(:,2)); else - error('wrong temperature profile array shape'); + error('Wrong temperature profile array shape.'); end diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m b/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m index 8ce7a5ac0..b20cc5545 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m @@ -2,7 +2,7 @@ function d = setProfile(d, n, p) % SETPROFILE - % if d.stack == 0 - error('install domain in stack before calling setProfile.'); + error('Install domain in stack before calling setProfile.'); end -setProfile(d.stack,domainIndex(d),n,p); +setProfile(d.stack,domainIndex(d), n, p); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setSteadyTolerances.m b/interfaces/matlab/toolbox/1D/@Domain1D/setSteadyTolerances.m index 86eda4881..b49b6685f 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setSteadyTolerances.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setSteadyTolerances.m @@ -1,7 +1,8 @@ function d = setSteadyTolerances(d, component, rtol, atol) % SETSTEADYTOLERANCES - % -if strcmp(component,'default') + +if strcmp(component, 'default') nc = nComponents(d); for ii = 1:nc domain_methods(d.dom_id, 55, ii, rtol, atol); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setTransientTolerances.m b/interfaces/matlab/toolbox/1D/@Domain1D/setTransientTolerances.m index ee7afad76..6f23352ce 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setTransientTolerances.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setTransientTolerances.m @@ -1,7 +1,8 @@ function d = setSteadyTolerances(d, component, rtol, atol) % SETSTEADYTOLERANCES - % -if strcmp(component,'default') + +if strcmp(component, 'default') nc = nComponents(d); for ii = 1:nc domain_methods(d.dom_id, 56, ii, rtol, atol); diff --git a/interfaces/matlab/toolbox/1D/@Stack/Stack.m b/interfaces/matlab/toolbox/1D/@Stack/Stack.m index a016efb5f..ef9f0ffd4 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/Stack.m +++ b/interfaces/matlab/toolbox/1D/@Stack/Stack.m @@ -17,7 +17,7 @@ if nargin == 1 s.stack_id = stack_methods(0, 8, nd, ids); else help(Stack); - error('wrong number of parameters'); + error('Wrong number of parameters.'); end if s.stack_id < 0 error(geterr); diff --git a/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m b/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m index ff10f8b37..b5c73caaf 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m +++ b/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m @@ -1,7 +1,8 @@ -function n = domainIndex(d, name) +function n = domainIndex(s, name) % DOMAININDEX - Index of the domain with a specified name. -if isa(name,'double') + +if isa(name, 'double') n = name; else - n = stack_methods(d.stack_id, 109, name); + n = stack_methods(s.stack_id, 109, name); end diff --git a/interfaces/matlab/toolbox/1D/@Stack/grid.m b/interfaces/matlab/toolbox/1D/@Stack/grid.m index e451b8005..d498ec718 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/grid.m +++ b/interfaces/matlab/toolbox/1D/@Stack/grid.m @@ -1,6 +1,7 @@ -function z = grid(s, d) +function z = grid(s, name) % GRID - the grid in one domain. % -n = domainIndex(s,d); + +n = domainIndex(s, name); d = s.domains(n); z = gridPoints(d); diff --git a/interfaces/matlab/toolbox/1D/@Stack/plotSolution.m b/interfaces/matlab/toolbox/1D/@Stack/plotSolution.m index c925497fd..a80d671b4 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/plotSolution.m +++ b/interfaces/matlab/toolbox/1D/@Stack/plotSolution.m @@ -3,7 +3,8 @@ function plotSolution(s, domain, component) % % plotSolution(s, 'flow', 'T') plots component 'T' in domain 'flow' % -n = domainIndex(s,domain); + +n = domainIndex(s, domain); d = s.domains(n); z = gridPoints(d); x = solution(s, domain, component); diff --git a/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m b/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m index 06b7cbb7d..5ea685706 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m @@ -1,4 +1,5 @@ -function setFlatProfile(s, n, comp, v) +function setFlatProfile(s, domain, comp, v) % SETFLATPROFILE - % -stack_methods(s.stack_id, 102, n, comp, v); + +stack_methods(s.stack_id, 102, domain, comp, v); diff --git a/interfaces/matlab/toolbox/1D/@Stack/setProfile.m b/interfaces/matlab/toolbox/1D/@Stack/setProfile.m index 04e07d037..b60fab569 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setProfile.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setProfile.m @@ -19,7 +19,8 @@ function setProfile(s, name, comp, p) % v = [500 650 700 730 800 900]; % setProfile(1, 2, zr, v); % -if isa(name,'double') + +if isa(name, 'double') n = name; else n = domainIndex(s, name); @@ -27,24 +28,24 @@ end d = s.domains(n); -if isa(comp,'double') || isa(comp,'cell') +if isa(comp, 'double') || isa(comp, 'cell') c = comp; -elseif isa(comp,'char') +elseif isa(comp, 'char') c = {comp}; else - error('wrong type'); + error('Wrong type.'); end np = length(c); sz = size(p); if sz(1) == np + 1; for j = 1:np - ic = componentIndex(d,c{j}); + ic = componentIndex(d, c{j}); stack_methods(s.stack_id, 101, n, ic, p(1,:), p(j+1,:)); end elseif sz(2) == np + 1; ic = componentIndex(d,c{j}); stack_methods(s.stack_id, 101, n, ic, p(:,1), p(:,j+1)); else - error('wrong profile shape'); + error('Wrong profile shape.'); end diff --git a/interfaces/matlab/toolbox/1D/@Stack/setRefineCriteria.m b/interfaces/matlab/toolbox/1D/@Stack/setRefineCriteria.m index a064bb33e..d19affb3a 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setRefineCriteria.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setRefineCriteria.m @@ -1,4 +1,4 @@ -function d = setRefineCriteria(d, n, ratio, slope, curve, prune) +function s = setRefineCriteria(s, n, ratio, slope, curve, prune) % SETREFINECRITERIA - Set the criteria used to refine the grid. % % n -- domain number beginning with domain 1 at the left @@ -13,6 +13,7 @@ function d = setRefineCriteria(d, n, ratio, slope, curve, prune) % components, it will be deleted, unless either % neighboring point is already marked for deletion. % + if nargin < 3 ratio = 10.0; end @@ -26,4 +27,4 @@ if nargin < 6 prune = -0.1; end -stack_methods(d.stack_id, 106, n, ratio, slope, curve, prune); +stack_methods(s.stack_id, 106, n, ratio, slope, curve, prune); diff --git a/interfaces/matlab/toolbox/1D/@Stack/subsref.m b/interfaces/matlab/toolbox/1D/@Stack/subsref.m index 6bd884411..caa5345bc 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/subsref.m +++ b/interfaces/matlab/toolbox/1D/@Stack/subsref.m @@ -1,5 +1,6 @@ -function b = subsref(s,index) +function b = subsref(s, index) % SUBSREF - + switch index.type case '()' b = s.domains(index.subs{:}); diff --git a/interfaces/matlab/toolbox/1D/AxisymmetricFlow.m b/interfaces/matlab/toolbox/1D/AxisymmetricFlow.m index 945148015..d681b69e8 100644 --- a/interfaces/matlab/toolbox/1D/AxisymmetricFlow.m +++ b/interfaces/matlab/toolbox/1D/AxisymmetricFlow.m @@ -5,7 +5,7 @@ function m = AxisymmetricFlow(gas, id) % m = Domain1D(1, gas); if nargin == 1 - setID(m,'flow'); + setID(m, 'flow'); else - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/FreeFlame.m b/interfaces/matlab/toolbox/1D/FreeFlame.m index a421d5b43..44b298809 100644 --- a/interfaces/matlab/toolbox/1D/FreeFlame.m +++ b/interfaces/matlab/toolbox/1D/FreeFlame.m @@ -6,7 +6,7 @@ function m = FreeFlame(gas, id) % m = Domain1D(1, gas, 2); if nargin == 1 - setID(m,'flame'); + setID(m, 'flame'); else - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/Inlet.m b/interfaces/matlab/toolbox/1D/Inlet.m index 607668d52..f2a0a2cbe 100644 --- a/interfaces/matlab/toolbox/1D/Inlet.m +++ b/interfaces/matlab/toolbox/1D/Inlet.m @@ -5,7 +5,7 @@ function m = Inlet(id) % either the leftmost or rightmost domain in a stack. m = Domain1D(2); if nargin == 0 - setID(m,'inlet'); + setID(m, 'inlet'); else - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/Outlet.m b/interfaces/matlab/toolbox/1D/Outlet.m index 80d66b9c3..b8d4bcf50 100644 --- a/interfaces/matlab/toolbox/1D/Outlet.m +++ b/interfaces/matlab/toolbox/1D/Outlet.m @@ -3,7 +3,7 @@ function m = Outlet(id) % m = Domain1D(5); if nargin == 0 - setID(m,'outlet'); + setID(m, 'outlet'); else - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/OutletRes.m b/interfaces/matlab/toolbox/1D/OutletRes.m index 8139b72ac..c82dfbacb 100644 --- a/interfaces/matlab/toolbox/1D/OutletRes.m +++ b/interfaces/matlab/toolbox/1D/OutletRes.m @@ -3,7 +3,7 @@ function m = OutletRes(id) % m = Domain1D(-2); if nargin == 0 - setID(m,'outletres'); + setID(m, 'outletres'); else - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/Surface.m b/interfaces/matlab/toolbox/1D/Surface.m index 228458e1d..0d8753ed1 100644 --- a/interfaces/matlab/toolbox/1D/Surface.m +++ b/interfaces/matlab/toolbox/1D/Surface.m @@ -4,11 +4,11 @@ function m = Surface(id, surface_mech) if nargin < 2 m = Domain1D(3); if nargin == 0 - setID(m,'surface'); + setID(m, 'surface'); elseif nargin == 1 - setID(m,id); + setID(m, id); end else m = Domain1D(6, surface_mech); - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/SymmPlane.m b/interfaces/matlab/toolbox/1D/SymmPlane.m index c517c7d7d..c66bd4b74 100644 --- a/interfaces/matlab/toolbox/1D/SymmPlane.m +++ b/interfaces/matlab/toolbox/1D/SymmPlane.m @@ -3,7 +3,7 @@ function m = SymmPlane(id) % m = Domain1D(4); if nargin == 0 - setID(m,'symmetry_plane'); + setID(m, 'symmetry_plane'); else - setID(m,id); + setID(m, id); end diff --git a/interfaces/matlab/toolbox/1D/npflame_init.m b/interfaces/matlab/toolbox/1D/npflame_init.m index 7c4e16fb0..787d2f78d 100644 --- a/interfaces/matlab/toolbox/1D/npflame_init.m +++ b/interfaces/matlab/toolbox/1D/npflame_init.m @@ -19,7 +19,7 @@ function flame = npflame_init(gas, left, flow, right, fuel, oxidizer, nuox) % Check input parameters if nargin ~= 7 - error('wrong number of input arguments.'); + error('npflame_init expects seven input arguments.'); end if ~isIdealGas(gas) @@ -44,12 +44,12 @@ rho0 = density(gas); wt = molecularWeights(gas); % find the fuel and oxidizer -ifuel = speciesIndex(gas,fuel); -ioxidizer = speciesIndex(gas,oxidizer); +ifuel = speciesIndex(gas, fuel); +ioxidizer = speciesIndex(gas, oxidizer); s = nuox*wt(ioxidizer)/wt(ifuel); -y0f = massFraction(left,ifuel); -y0ox = massFraction(right,ioxidizer); +y0f = massFraction(left, ifuel); +y0ox = massFraction(right, ioxidizer); phi = s*y0f/y0ox; zst = 1.0/(1.0 + phi); @@ -62,13 +62,13 @@ yox = zeros(1, nsp); yf = zeros(1, nsp); ystoich = zeros(1, nsp); for n = 1:nsp - yox(n) = massFraction(right,n); - yf(n) = massFraction(left,n); + yox(n) = massFraction(right, n); + yf(n) = massFraction(left, n); ystoich(n) = zst*yf(n) + (1.0 - zst)*yox(n); end -set(gas,'T',temperature(left),'P',pressure(gas),'Y',ystoich); -equilibrate(gas,'HP'); +set(gas, 'T', temperature(left), 'P', pressure(gas), 'Y', ystoich); +equilibrate(gas, 'HP'); teq = temperature(gas); yeq = massFractions(gas); @@ -84,11 +84,11 @@ f = sqrt(a/(2.0*diff(ioxidizer))); x0 = massFlux(left)*dz/(massFlux(left) + massFlux(right)); nz = nPoints(flow); -zm = zeros(1,nz); -u = zeros(1,nz); -v = zeros(1,nz); -y = zeros(nz,nsp); -t = zeros(1,nz); +zm = zeros(1, nz); +u = zeros(1, nz); +v = zeros(1, nz); +y = zeros(nz, nsp); +t = zeros(1, nz); for j = 1:nz x = zz(j); zeta = f*(x - x0); @@ -116,7 +116,7 @@ setProfile(flame, 2, {'u', 'V'}, [zrel; u; v]); setProfile(flame, 2, 'T', [zrel; t] ); for n = 1:nsp - nm = speciesName(gas,n); + nm = speciesName(gas, n); setProfile(flame, 2, nm, [zrel; transpose(y(:,n))]) end diff --git a/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m b/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m index 2da5eb513..c8159b800 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m +++ b/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m @@ -3,11 +3,11 @@ function x = FlowDevice(typ) if nargin == 0 typ = 1; end -x.index = flowdevicemethods(0,typ); +x.index = flowdevicemethods(0, typ); if x.index < 0 error(geterr); end x.type = typ; x.upstream = -1; x.downstream = -1; -x = class(x,'FlowDevice'); +x = class(x, 'FlowDevice'); diff --git a/interfaces/matlab/toolbox/@FlowDevice/clear.m b/interfaces/matlab/toolbox/@FlowDevice/clear.m index 6b922d203..547251854 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/clear.m +++ b/interfaces/matlab/toolbox/@FlowDevice/clear.m @@ -1,4 +1,5 @@ function clear(f) % CLEAR - % -flowdevicemethods(1, f.index) + +flowdevicemethods(1, f.index); diff --git a/interfaces/matlab/toolbox/@FlowDevice/install.m b/interfaces/matlab/toolbox/@FlowDevice/install.m index 1f31db342..d20e2bb23 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/install.m +++ b/interfaces/matlab/toolbox/@FlowDevice/install.m @@ -1,7 +1,7 @@ function install(f, upstream, downstream) if nargin == 3 - if ~isa(upstream,'Reactor') || ~isa(downstream,'Reactor') + if ~isa(upstream, 'Reactor') || ~isa(downstream, 'Reactor') error(['Flow devices can only be installed between reactors or' ... ' reservoirs']) end diff --git a/interfaces/matlab/toolbox/@Func/Func.m b/interfaces/matlab/toolbox/@Func/Func.m index 38a76e0ae..abf5bbdbd 100644 --- a/interfaces/matlab/toolbox/@Func/Func.m +++ b/interfaces/matlab/toolbox/@Func/Func.m @@ -37,38 +37,38 @@ x.coeffs = 0; itype = -1; if strcmp(typ, 'polynomial') itype = 2; -elseif strcmp(typ,'fourier') +elseif strcmp(typ, 'fourier') itype = 1; -elseif strcmp(typ,'arrhenius') +elseif strcmp(typ, 'arrhenius') itype = 3; -elseif strcmp(typ,'gaussian') +elseif strcmp(typ, 'gaussian') itype = 4; end if itype > 0 x.coeffs = p; - x.index = funcmethods(0,itype,n,p); -elseif strcmp(typ,'periodic') + x.index = funcmethods(0, itype, n, p); +elseif strcmp(typ, 'periodic') itype = 50; x.f1 = n; x.coeffs = p; - x.index = funcmethods(0,itype,n.index,p); + x.index = funcmethods(0, itype, n.index, p); else - if strcmp(typ,'sum') + if strcmp(typ, 'sum') itype = 20; - elseif strcmp(typ,'diff') + elseif strcmp(typ, 'diff') itype = 25; - elseif strcmp(typ,'prod') + elseif strcmp(typ, 'prod') itype = 30; - elseif strcmp(typ,'ratio') + elseif strcmp(typ, 'ratio') itype = 40; - elseif strcmp(typ,'composite') + elseif strcmp(typ, 'composite') itype = 60; end x.f1 = n; x.f2 = p; - x.index = funcmethods(0,itype,n.index,p.index); + x.index = funcmethods(0, itype, n.index, p.index); end x.typ = typ; -x = class(x,'Func'); +x = class(x, 'Func'); diff --git a/interfaces/matlab/toolbox/@Func/char.m b/interfaces/matlab/toolbox/@Func/char.m index f49e56daa..2f80b7a82 100644 --- a/interfaces/matlab/toolbox/@Func/char.m +++ b/interfaces/matlab/toolbox/@Func/char.m @@ -44,17 +44,17 @@ else end d = d - 1; end - elseif strcmp(p.typ,'gaussian') + elseif strcmp(p.typ, 'gaussian') s = ['Gaussian(' num2str(p.coeffs(1)) ',' ... num2str(p.coeffs(2)) ',' ... num2str(p.coeffs(3)) ')']; - elseif strcmp(p.typ,'fourier') - c = reshape(p.coeffs, [],2); - Ao = c(1,1); - w = c(1,2); - A = c(2:end,1); - B = c(2:end,2); - N = size(c,1)-1; + elseif strcmp(p.typ, 'fourier') + c = reshape(p.coeffs, [], 2); + Ao = c(1, 1); + w = c(1, 2); + A = c(2:end, 1); + B = c(2:end, 2); + N = size(c, 1) - 1; if Ao ~= 0 s = num2str(Ao/2); else diff --git a/interfaces/matlab/toolbox/@Func/plus.m b/interfaces/matlab/toolbox/@Func/plus.m index fb4309620..b98b946e9 100644 --- a/interfaces/matlab/toolbox/@Func/plus.m +++ b/interfaces/matlab/toolbox/@Func/plus.m @@ -3,4 +3,4 @@ function r = plus(a, b) % PLUS - Return a functor representing the sum of two functors a % and b. % -r = Func('sum',a,b); +r = Func('sum', a, b); diff --git a/interfaces/matlab/toolbox/@Func/rdivide.m b/interfaces/matlab/toolbox/@Func/rdivide.m index 8f48f8dc1..49b12647d 100644 --- a/interfaces/matlab/toolbox/@Func/rdivide.m +++ b/interfaces/matlab/toolbox/@Func/rdivide.m @@ -1,4 +1,5 @@ -function r = rdivide(a,b) +function r = rdivide(a, b) % RDIVIDE - % -r = Func('ratio',a,b); + +r = Func('ratio', a, b); diff --git a/interfaces/matlab/toolbox/@Func/subsref.m b/interfaces/matlab/toolbox/@Func/subsref.m index ac90c99ea..453b4beaf 100644 --- a/interfaces/matlab/toolbox/@Func/subsref.m +++ b/interfaces/matlab/toolbox/@Func/subsref.m @@ -1,11 +1,11 @@ -function b = subsref(a,s) +function b = subsref(a, s) % SUBSREF switch s.type case '()' ind = s.subs{:}; b = zeros(1, length(ind)); for k = 1:length(ind) - b(k) = funcmethods(2,a.index,ind(k)); + b(k) = funcmethods(2, a.index, ind(k)); end otherwise error('Specify value for x as p(x)') diff --git a/interfaces/matlab/toolbox/@Func/times.m b/interfaces/matlab/toolbox/@Func/times.m index ca841863a..0f6056bd1 100644 --- a/interfaces/matlab/toolbox/@Func/times.m +++ b/interfaces/matlab/toolbox/@Func/times.m @@ -1,4 +1,5 @@ -function r = times(a,b) +function r = times(a, b) % TIMES - % -r = Func('prod',a,b); + +r = Func('prod', a, b); diff --git a/interfaces/matlab/toolbox/@Interface/Interface.m b/interfaces/matlab/toolbox/@Interface/Interface.m index 8b7cb429d..db33c6570 100644 --- a/interfaces/matlab/toolbox/@Interface/Interface.m +++ b/interfaces/matlab/toolbox/@Interface/Interface.m @@ -1,21 +1,21 @@ function s = Interface(src, id, p1, p2, p3, p4) % Interface - class Interface constructor. % -doc = XML_Node('doc',src); -node = findByID(doc,id); +doc = XML_Node('doc', src); +node = findByID(doc, id); t = ThermoPhase(node); if nargin == 2 - k = Kinetics(node,t); + k = Kinetics(node, t); elseif nargin == 3 - k = Kinetics(node,t,p1); + k = Kinetics(node, t, p1); elseif nargin == 4 - k = Kinetics(node,t,p1,p2); + k = Kinetics(node, t, p1, p2); elseif nargin == 5 - k = Kinetics(node,t,p1,p2,p3); + k = Kinetics(node, t, p1, p2, p3); elseif nargin == 6 - k = Kinetics(node,t,p1,p2,p3,p4); + k = Kinetics(node, t, p1, p2, p3, p4); end s.kin = k; s.th = t; -s = class(s,'Interface',t,k); +s = class(s,'Interface', t, k); diff --git a/interfaces/matlab/toolbox/@Interface/concentrations.m b/interfaces/matlab/toolbox/@Interface/concentrations.m index c03dd5042..857f008be 100644 --- a/interfaces/matlab/toolbox/@Interface/concentrations.m +++ b/interfaces/matlab/toolbox/@Interface/concentrations.m @@ -4,12 +4,12 @@ function c = concentrations(s) c = surfmethods(thermo_hndl(s), 101); if nargout == 0 figure - set(gcf,'Name','Concentrations') + set(gcf, 'Name', 'Concentrations') bar(c); colormap(summer); nm = speciesNames(s); - legend(nm); - xlabel('Species Number'); + set(gca,'XTickLabel', nm); + xlabel('Species Name'); ylabel('Concentration [kmol/m2]'); title('Surface Species Concentrations'); end diff --git a/interfaces/matlab/toolbox/@Interface/coverages.m b/interfaces/matlab/toolbox/@Interface/coverages.m index 67f2a9766..140382d34 100644 --- a/interfaces/matlab/toolbox/@Interface/coverages.m +++ b/interfaces/matlab/toolbox/@Interface/coverages.m @@ -4,12 +4,12 @@ function c = coverages(s) c = surfmethods(thermo_hndl(s), 101); if nargout == 0 figure - set(gcf,'Name','Coverages') + set(gcf, 'Name', 'Coverages') bar(c); colormap(summer); nm = speciesNames(s); - legend(nm); - xlabel('Species Number'); + set(gca,'XTickLabel', nm); + xlabel('Species Name'); ylabel('Coverage'); title('Surface Species Coverages'); end diff --git a/interfaces/matlab/toolbox/@Interface/setCoverages.m b/interfaces/matlab/toolbox/@Interface/setCoverages.m index a65064222..55127ab51 100644 --- a/interfaces/matlab/toolbox/@Interface/setCoverages.m +++ b/interfaces/matlab/toolbox/@Interface/setCoverages.m @@ -1,7 +1,7 @@ -function setCoverages(s,cov) +function setCoverages(s, cov) % SETCOVERAGES - set surface coverages % -if isa(cov,'double') +if isa(cov, 'double') sz = length(cov); if sz == nSpecies(s) surfmethods(thermo_hndl(s), 3, cov); diff --git a/interfaces/matlab/toolbox/@Kinetics/Kinetics.m b/interfaces/matlab/toolbox/@Kinetics/Kinetics.m index 14b5309e0..4816b19da 100644 --- a/interfaces/matlab/toolbox/@Kinetics/Kinetics.m +++ b/interfaces/matlab/toolbox/@Kinetics/Kinetics.m @@ -17,7 +17,7 @@ ineighbor4 = -1; % if only one argument is supplied, and it is an instance of % 'Kinetics', return a copy of this instance if nargin == 1 - if isa(r,'Kinetics') + if isa(r, 'Kinetics') k = r; return else @@ -25,9 +25,9 @@ if nargin == 1 end end -% if more than one arguement, first one must be an XML_Node +% if more than one argument, first one must be an XML_Node % instance representing the XML tree -if ~isa(r,'XML_Node') +if ~isa(r, 'XML_Node') error('first argument must be an XML_Node object') end @@ -49,11 +49,11 @@ if nargin > 2 end end end -k.id = kinetics_get(ixml,0,iphase,ineighbor1,ineighbor2,ineighbor3, ... +k.id = kinetics_get(ixml, 0, iphase, ineighbor1, ineighbor2, ineighbor3, ... ineighbor4); if k.id < 0 error(geterr); end -k = class(k,'Kinetics'); +k = class(k, 'Kinetics'); diff --git a/interfaces/matlab/toolbox/@Kinetics/clear.m b/interfaces/matlab/toolbox/@Kinetics/clear.m index d49c626ba..d3e60fe21 100644 --- a/interfaces/matlab/toolbox/@Kinetics/clear.m +++ b/interfaces/matlab/toolbox/@Kinetics/clear.m @@ -1,4 +1,5 @@ function clear(k) % CLEAR - delete the Kinetics instance. % -kinetics_set(k.id,3); + +kinetics_set(k.id, 3, 0, 0); diff --git a/interfaces/matlab/toolbox/@Kinetics/creationRates.m b/interfaces/matlab/toolbox/@Kinetics/creationRates.m index 4f39a72ba..3b4fa4901 100644 --- a/interfaces/matlab/toolbox/@Kinetics/creationRates.m +++ b/interfaces/matlab/toolbox/@Kinetics/creationRates.m @@ -9,10 +9,10 @@ function cdot = creationRates(a) % % See also: destructionRates, netProdRates. % -cdot = kinetics_get(a.id,21,0); +cdot = kinetics_get(a.id, 21, 0); if nargout == 0 figure - set(gcf,'Name','Creation Rates') + set(gcf, 'Name', 'Creation Rates') bar(cdot) xlabel('Species Number') ylabel('Creation Rate (kmol/m^3-s)') diff --git a/interfaces/matlab/toolbox/@Kinetics/destructionRates.m b/interfaces/matlab/toolbox/@Kinetics/destructionRates.m index c18319f2f..4e1c01a38 100644 --- a/interfaces/matlab/toolbox/@Kinetics/destructionRates.m +++ b/interfaces/matlab/toolbox/@Kinetics/destructionRates.m @@ -9,10 +9,10 @@ function ddot = destructionRates(a) % % See also: creationRates, netProdRates. % -ddot = kinetics_get(a.id,22,0); +ddot = kinetics_get(a.id, 22, 0); if nargout == 0 figure - set(gcf,'Name','Destruction Rates') + set(gcf, 'Name', 'Destruction Rates') bar(ddot) xlabel('Species Number') ylabel('Destruction Rate (kmol/m^3/s)') diff --git a/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m b/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m index 64c036a5b..7528d47a8 100644 --- a/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m +++ b/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m @@ -1,4 +1,4 @@ -function q = destruction_rates(a) +function ddot = destruction_rates(a) % destruction_rates Chemical destruction rates for all species. % % q = destruction_rates(a) @@ -7,11 +7,12 @@ function q = destruction_rates(a) % % See also: creation_rates, net_production_rates. % -q = production(a.id,nSpecies(a.ph),1); + +ddot = destructionRates(a); if nargout == 0 figure - set(gcf,'Name','Destruction Rates') - bar(q) + set(gcf, 'Name', 'Destruction Rates') + bar(ddot) xlabel('Species Number') ylabel('Destruction Rate (kmol/m^3/s)') title('Species Chemical Destruction Rates') diff --git a/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m b/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m index e15ae17c7..e47c8faa5 100644 --- a/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m +++ b/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m @@ -9,12 +9,13 @@ function kc = equil_Kc(a) % occur only for the reversible reactions. % % -kc = kinetics_get(a.id,14,0); + +kc = kinetics_get(a.id, 14, 0); if nargout == 0 figure - set(gcf,'Name','Equilibrium Constants') + set(gcf, 'Name', 'Equilibrium Constants') bar(log10(kc)) xlabel('Reaction Number') - ylabel('log_1_0 Kc [kmol, m, s]') + ylabel('log_{10} Kc [kmol, m, s]') title('Equilibrium Constants Kc') end diff --git a/interfaces/matlab/toolbox/@Kinetics/fwdRateConstants.m b/interfaces/matlab/toolbox/@Kinetics/fwdRateConstants.m index 5749913ab..ed692fb61 100644 --- a/interfaces/matlab/toolbox/@Kinetics/fwdRateConstants.m +++ b/interfaces/matlab/toolbox/@Kinetics/fwdRateConstants.m @@ -6,4 +6,4 @@ function kf = fwdRateConstants(a) % Returns a column vector of the forward rate constants of % all of the reactions. % -kf = kinetics_get(a.id,15,0); +kf = kinetics_get(a.id, 15, 0); diff --git a/interfaces/matlab/toolbox/@Kinetics/isReversible.m b/interfaces/matlab/toolbox/@Kinetics/isReversible.m index 41d37f285..11d5556ad 100644 --- a/interfaces/matlab/toolbox/@Kinetics/isReversible.m +++ b/interfaces/matlab/toolbox/@Kinetics/isReversible.m @@ -11,4 +11,4 @@ function yn = isReversible(a, i) % ISREVERSIBLE(K, IRXN) returns 1 if reaction number IRXN is % reversible, and 0 if it is irreversible. % -yn = kinetics_get(a.id,4,i); +yn = kinetics_get(a.id, 4, i); diff --git a/interfaces/matlab/toolbox/@Kinetics/multiplier.m b/interfaces/matlab/toolbox/@Kinetics/multiplier.m index 2c368da2d..7d82f2765 100644 --- a/interfaces/matlab/toolbox/@Kinetics/multiplier.m +++ b/interfaces/matlab/toolbox/@Kinetics/multiplier.m @@ -1,4 +1,4 @@ -function n = multiplier(a,irxn) +function n = multiplier(a, irxn) % MULTIPLIER Multiplier for reaction rate of progress. % % The multiplier multiplies the reaction rate of progress. It may @@ -10,4 +10,4 @@ function n = multiplier(a,irxn) % % MULTIPLIER(K, IRXN) Multiplier for reaction number IRXN % -n = kinetics_get(a.id,2,irxn); +n = kinetics_get(a.id, 2, irxn); diff --git a/interfaces/matlab/toolbox/@Kinetics/nReactions.m b/interfaces/matlab/toolbox/@Kinetics/nReactions.m index 5ef868a10..8d26124ed 100644 --- a/interfaces/matlab/toolbox/@Kinetics/nReactions.m +++ b/interfaces/matlab/toolbox/@Kinetics/nReactions.m @@ -1,4 +1,4 @@ function n = nReactions(a) % NREACTIONS - Number of reactions. % -n = kinetics_get(a.id,1,0); +n = kinetics_get(a.id, 1, 0); diff --git a/interfaces/matlab/toolbox/@Kinetics/netProdRates.m b/interfaces/matlab/toolbox/@Kinetics/netProdRates.m index a7b4b9c62..524958677 100644 --- a/interfaces/matlab/toolbox/@Kinetics/netProdRates.m +++ b/interfaces/matlab/toolbox/@Kinetics/netProdRates.m @@ -9,10 +9,10 @@ function wdot = netProdRates(a) % % See also: creationRates, destructionRates % -wdot = kinetics_get(a.id,23,0); +wdot = kinetics_get(a.id, 23, 0); if nargout == 0 figure - set(gcf,'Name','Production Rates') + set(gcf, 'Name', 'Production Rates') bar(wdot) xlabel('Species Number') ylabel('Net Production Rate (kmol/m^3/s)') diff --git a/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m b/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m index f78b47b4a..da74467a1 100644 --- a/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m +++ b/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m @@ -14,12 +14,12 @@ elseif nargin == 2 end if m == 1 && n == 1 - e = kinetics_get(a.id, 31, irxn); % rxnstring(a.id, irxn); + e = kinetics_get(a.id, 31, irxn); else e = cell(m,n); for i = 1:m for j = 1:n - e{i,j} = kinetics_get(a.id, 31, irxn(i,j)); % rxnstring(a.id, irxn(i,j)); + e{i, j} = kinetics_get(a.id, 31, irxn(i,j)); end end end diff --git a/interfaces/matlab/toolbox/@Kinetics/revRateConstants.m b/interfaces/matlab/toolbox/@Kinetics/revRateConstants.m index 2a066b01e..941436bf1 100644 --- a/interfaces/matlab/toolbox/@Kinetics/revRateConstants.m +++ b/interfaces/matlab/toolbox/@Kinetics/revRateConstants.m @@ -6,4 +6,4 @@ function kr = revRateConstants(a) % Returns a column vector of the reverse rate constants of % all of the reactions. % -kr = kinetics_get(a.id,16,0); +kr = kinetics_get(a.id, 16, 0); diff --git a/interfaces/matlab/toolbox/@Kinetics/rop.m b/interfaces/matlab/toolbox/@Kinetics/rop.m index ca060d4e3..8d5b8180d 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop.m @@ -1,4 +1,4 @@ -function rop = rop(k) +function rop = rop(a) % ROP - Forward and reverse rates of progress. % % ROP(K) returns an M x 2 array of reaction rates of @@ -6,12 +6,13 @@ function rop = rop(k) % and the second column the reverse rates. If this function % is called with no output argument, a bar graph is produced. % -f = rop_f(k); -r = rop_r(k); + +f = rop_f(a); +r = rop_r(a); rop = [f r]; if nargout == 0 figure - set(gcf,'Name','Rates of Progress'); + set(gcf, 'Name', 'Rates of Progress'); bar(rop); xlabel('Reaction Number'); ylabel('Rate of Progress [kmol/m^3-s]'); diff --git a/interfaces/matlab/toolbox/@Kinetics/rop_f.m b/interfaces/matlab/toolbox/@Kinetics/rop_f.m index d73a4f36f..fb9172ded 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop_f.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop_f.m @@ -8,10 +8,10 @@ function q = rop_f(a) % % See also: rop_r, rop_net. % -q = kinetics_get(a.id,11,0); +q = kinetics_get(a.id, 11, 0); if nargout == 0 figure - set(gcf,'Name','Rates of Progress') + set(gcf, 'Name', 'Rates of Progress') bar(q) xlabel('Reaction Number') ylabel('Forward Rate of Progress [kmol/m^3]') diff --git a/interfaces/matlab/toolbox/@Kinetics/rop_net.m b/interfaces/matlab/toolbox/@Kinetics/rop_net.m index 1c754f2a6..d18409f58 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop_net.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop_net.m @@ -8,10 +8,11 @@ function q = rop_net(a) % % See also: rop_r, rop_net. % -q = kinetics_get(a.id,13,0); + +q = kinetics_get(a.id, 13, 0); if nargout == 0 figure - set(gcf,'Name','Rates of Progress') + set(gcf, 'Name', 'Net Rates of Progress') bar(q) xlabel('Reaction Number') ylabel('Net Rate of Progress [kmol/m^3]') diff --git a/interfaces/matlab/toolbox/@Kinetics/rop_r.m b/interfaces/matlab/toolbox/@Kinetics/rop_r.m index abce56868..28dfd1f13 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop_r.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop_r.m @@ -9,4 +9,12 @@ function q = rop_r(a) % % See also: rop_r, rop_net. % -q = kinetics_get(a.id,12,0); +q = kinetics_get(a.id, 12, 0); +if nargout == 0 + figure + set(gcf, 'Name', 'Reverse Rates of Progress') + bar(q) + xlabel('Reaction Number') + ylabel('Reverse Rate of Progress [kmol/m^3]') + title('Reverse Rates of Progress') +end diff --git a/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m b/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m index 67b376edc..97bac15de 100644 --- a/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m +++ b/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m @@ -1,4 +1,4 @@ -function setMultiplier(a,irxn,v) +function setMultiplier(a, irxn, v) % SETMULTIPLIER Set the rate of progress multiplier. % % SETMULTIPLIER(K, IRXN, V) sets the multipler for reaction IRXN @@ -11,12 +11,14 @@ if nargin == 2 m = nReactions(a); irxn = (1:m)'; n = 1; -else +elseif nargin == 3 [m, n] = size(irxn); +else + error('setMultiplier requires 2 or 3 arguments.') end for jm = 1:m for jn = 1:n - kinetics_set(a.id,1,irxn(jm,jn),v); + kinetics_set(a.id, 1, irxn(jm,jn), v); end end diff --git a/interfaces/matlab/toolbox/@Kinetics/stoich_net.m b/interfaces/matlab/toolbox/@Kinetics/stoich_net.m index 0753ed428..ae24f2b42 100644 --- a/interfaces/matlab/toolbox/@Kinetics/stoich_net.m +++ b/interfaces/matlab/toolbox/@Kinetics/stoich_net.m @@ -1,4 +1,4 @@ -function nu = stoich_net(a,species,rxns) +function nu = stoich_net(a, species, rxns) % stoich_net Net stoichiometric coefficients. % % nu = stoich_net(a) @@ -23,8 +23,7 @@ function nu = stoich_net(a,species,rxns) if nargin == 1 nu = stoich_p(a) - stoich_r(a); elseif nargin == 3 - nu = stoich_p(a,species,rxns) - stoich_r(a,species,rxns); + nu = stoich_p(a, species, rxns) - stoich_r(a, species, rxns); else - error(['syntax error. Type ''help stoich_net'' for more' ... - ' information.']) + error(['stoich_net requires 1 or 3 arguments.']) end diff --git a/interfaces/matlab/toolbox/@Kinetics/stoich_p.m b/interfaces/matlab/toolbox/@Kinetics/stoich_p.m index 0c2b5d0f9..ed3504b66 100644 --- a/interfaces/matlab/toolbox/@Kinetics/stoich_p.m +++ b/interfaces/matlab/toolbox/@Kinetics/stoich_p.m @@ -1,4 +1,4 @@ -function nu_p = stoich_p(a,species,rxns) +function nu_p = stoich_p(a, species, rxns) % stoich_p Product stoichiometric coefficients. % % nu = stoich_p(a) @@ -19,9 +19,8 @@ function nu_p = stoich_p(a,species,rxns) % See also: stoich_r, stoich_net. % nsp = nTotalSpecies(a); -nr =nReactions(a); -b = sparse(nsp,nr); -f = @kinetics_get; +nr = nReactions(a); +b = sparse(nsp, nr); if nargin == 1 kvals = 1:nsp; ivals = 1:nr; @@ -29,14 +28,14 @@ elseif nargin == 3 kvals = species; ivals = rxns; else - error('Syntax error. type ''help stoich_r'' for more information.') + error('stoich_p requires 1 or 3 arguments.') end for k = kvals for i = ivals - nu = feval(f,a.id,6,i,k); + nu = kinetics_get(a.id, 6, i, k); if nu ~= 0.0 - b(k,i) = nu; + b(k, i) = nu; end end end diff --git a/interfaces/matlab/toolbox/@Kinetics/stoich_r.m b/interfaces/matlab/toolbox/@Kinetics/stoich_r.m index 1828495ec..a4df22fd8 100644 --- a/interfaces/matlab/toolbox/@Kinetics/stoich_r.m +++ b/interfaces/matlab/toolbox/@Kinetics/stoich_r.m @@ -1,4 +1,4 @@ -function nu_r = stoich_r(a,species,rxns) +function nu_r = stoich_r(a, species, rxns) % stoich_r Reactant stoichiometric coefficients. % % nu = stoich_r(a) @@ -19,9 +19,8 @@ function nu_r = stoich_r(a,species,rxns) % See also: stoich_p, stoich_net. % nsp = nTotalSpecies(a); -nr =nReactions(a); -b = sparse(nsp,nr); -f = @kinetics_get; +nr = nReactions(a); +b = sparse(nsp, nr); if nargin == 1 kvals = 1:nsp; ivals = 1:nr; @@ -29,14 +28,14 @@ elseif nargin == 3 kvals = species; ivals = rxns; else - error('Syntax error. type ''help stoich_r'' for more information.') + error('stoich_r requires 1 or 3 arguments.') end for k = kvals for i = ivals - nu = feval(f,a.id,5,i,k); + nu = kinetics_get(a.id, 5, i, k); if nu ~= 0.0 - b(k,i) = nu; + b(k, i) = nu; end end end diff --git a/interfaces/matlab/toolbox/@Kinetics/ydot.m b/interfaces/matlab/toolbox/@Kinetics/ydot.m index 6c2be7ded..f60cc858b 100644 --- a/interfaces/matlab/toolbox/@Kinetics/ydot.m +++ b/interfaces/matlab/toolbox/@Kinetics/ydot.m @@ -1,4 +1,4 @@ function v = ydot(a) % YDOT - Evaluates wdot_k M_k / (density) % -v = kinetics_get(a.id,24,0); +v = kinetics_get(a.id, 24, 0); diff --git a/interfaces/matlab/toolbox/@Mixture/Mixture.m b/interfaces/matlab/toolbox/@Mixture/Mixture.m index fffb76868..516931c8f 100644 --- a/interfaces/matlab/toolbox/@Mixture/Mixture.m +++ b/interfaces/matlab/toolbox/@Mixture/Mixture.m @@ -36,19 +36,19 @@ end m.mixindex = mixturemethods(0, 0, 0); m.phases = phases; -m = class(m,'Mixture'); +m = class(m, 'Mixture'); % if phases are supplied, add them if nargin == 1 - if ~isa(phases,'cell') - error('enter phases as a cell array'); + if ~isa(phases, 'cell') + error('Enter phases as a cell array.'); end % first column contains the phase objects, and the second column % the mole numbers of each phase [np nc] = size(phases); if nc ~= 2 - error('wrong size for phases cell array'); + error('Cell array of phases should have each phase on a new row'); end for n = 1:np addPhase(m, phases{n,1}, phases{n,2}); diff --git a/interfaces/matlab/toolbox/@Mixture/addPhase.m b/interfaces/matlab/toolbox/@Mixture/addPhase.m index ee91e1eab..fd0b722fd 100644 --- a/interfaces/matlab/toolbox/@Mixture/addPhase.m +++ b/interfaces/matlab/toolbox/@Mixture/addPhase.m @@ -5,17 +5,17 @@ function addPhase(self, phase, moles) % addPhase(mix, carbon, 1.0); % if ~isa(phase,'ThermoPhase') - error('phase object of wrong type.'); + error('Phase object of wrong type.'); end if ~isa(moles,'numeric') - error('number of moles must be numeric.'); + error('Number of moles must be numeric.'); end if moles < 0.0 - error('negative moles!'); + error('Negative moles!'); end iphase = thermo_hndl(phase); iok = mixturemethods(4, mix_hndl(self), iphase, moles); if iok < 0 - error('error adding phase'); + error('Error adding phase'); end diff --git a/interfaces/matlab/toolbox/@Mixture/display.m b/interfaces/matlab/toolbox/@Mixture/display.m index 6fd0ab7b6..f911950b1 100644 --- a/interfaces/matlab/toolbox/@Mixture/display.m +++ b/interfaces/matlab/toolbox/@Mixture/display.m @@ -2,7 +2,7 @@ function display(self) [np nc] = size(self.phases); for n = 1:np s = [sprintf('\n******************* Phase %d', n) ... - sprintf(' ******************************\n\n Moles: %12.6g', phaseMoles(self,n))]; + sprintf(' ******************************\n\n Moles: %12.6g', phaseMoles(self,n))]; disp(s); - display(self.phases{n,1}); + display(self.phases{n, 1}); end diff --git a/interfaces/matlab/toolbox/@Mixture/equilibrate.m b/interfaces/matlab/toolbox/@Mixture/equilibrate.m index 3246bb638..0c7912739 100644 --- a/interfaces/matlab/toolbox/@Mixture/equilibrate.m +++ b/interfaces/matlab/toolbox/@Mixture/equilibrate.m @@ -1,5 +1,4 @@ -function r = equilibrate(self, XY, err, maxsteps, maxiter, ... - loglevel) +function r = equilibrate(self, XY, err, maxsteps, maxiter, loglevel) % % EQUILIBRATE - Set the mixture to a state of chemical equilibrium. % diff --git a/interfaces/matlab/toolbox/@Mixture/phaseMoles.m b/interfaces/matlab/toolbox/@Mixture/phaseMoles.m index 9c319e973..cb122004b 100644 --- a/interfaces/matlab/toolbox/@Mixture/phaseMoles.m +++ b/interfaces/matlab/toolbox/@Mixture/phaseMoles.m @@ -5,7 +5,7 @@ if nargin == 2 moles = mixturemethods(28, mix_hndl(self), n); elseif nargin == 1 np = nPhases(self); - m = zeros(1,np); + m = zeros(1, np); for n = 1:np m(n) = mixturemethods(28, mix_hndl(self), n); end diff --git a/interfaces/matlab/toolbox/@Mixture/pressure.m b/interfaces/matlab/toolbox/@Mixture/pressure.m index d254a5504..2ce951ed3 100644 --- a/interfaces/matlab/toolbox/@Mixture/pressure.m +++ b/interfaces/matlab/toolbox/@Mixture/pressure.m @@ -1,4 +1,5 @@ -function n = pressure(self) +function p = pressure(self) % PRESSURE - pressure (Pa) % -n = mixturemethods(26, mix_hndl(self)); + +p = mixturemethods(26, mix_hndl(self)); diff --git a/interfaces/matlab/toolbox/@Mixture/temperature.m b/interfaces/matlab/toolbox/@Mixture/temperature.m index e7c953fb7..23cf32705 100644 --- a/interfaces/matlab/toolbox/@Mixture/temperature.m +++ b/interfaces/matlab/toolbox/@Mixture/temperature.m @@ -1,4 +1,5 @@ -function n = temperature(self) +function t = temperature(self) % TEMPERATURE - temperature (K) % -n = mixturemethods(25, mix_hndl(self)); + +t = mixturemethods(25, mix_hndl(self)); diff --git a/interfaces/matlab/toolbox/@Reactor/Reactor.m b/interfaces/matlab/toolbox/@Reactor/Reactor.m index c98938d01..9ec89f229 100644 --- a/interfaces/matlab/toolbox/@Reactor/Reactor.m +++ b/interfaces/matlab/toolbox/@Reactor/Reactor.m @@ -20,13 +20,13 @@ elseif nargin > 2 error('too many arguments'); end -x.index = reactormethods(0,typ); +x.index = reactormethods(0, typ); if x.index < 0 error(geterr); end x.contents = contents; -x = class(x,'Reactor'); +x = class(x, 'Reactor'); -if isa(contents,'Solution') +if isa(contents, 'Solution') insert(x, contents); end diff --git a/interfaces/matlab/toolbox/@Reactor/massFraction.m b/interfaces/matlab/toolbox/@Reactor/massFraction.m index 51e51b2dd..005627fa7 100644 --- a/interfaces/matlab/toolbox/@Reactor/massFraction.m +++ b/interfaces/matlab/toolbox/@Reactor/massFraction.m @@ -1,5 +1,11 @@ function y = massFraction(r, species) % MASSFRACTION - Mass fraction of species with name 'species'. % -k = speciesIndex(r.contents, species) - 1; + +if ischar(species) + k = speciesIndex(r.contents, species) - 1; +else + k = species - 1; +end + y = reactormethods(30, reactor_hndl(r), k); diff --git a/interfaces/matlab/toolbox/@Reactor/setEnergy.m b/interfaces/matlab/toolbox/@Reactor/setEnergy.m index 7e9c53f81..0545c2a67 100644 --- a/interfaces/matlab/toolbox/@Reactor/setEnergy.m +++ b/interfaces/matlab/toolbox/@Reactor/setEnergy.m @@ -1,4 +1,4 @@ -function setEnergy(f, flag) +function setEnergy(r, flag) % SETENERGY - enable or disable solving the energy equation. If the % energy equation is disabled, then the reactor temperature is % constant. The parameter should be the string 'on' to enable the @@ -12,13 +12,13 @@ function setEnergy(f, flag) % >>> setEnergy(r, 'off'); % iflag = -1; -if strcmp(flag,{'on'}) +if strcmp(flag, {'on'}) iflag = 1; -elseif strcmp(flag,{'off'}) +elseif strcmp(flag, {'off'}) iflag = 0; end if iflag >= 0 - reactormethods(9, f.index, iflag) + reactormethods(9, r.index, iflag) else - error('input to setEnergy not understood'); + error('Input to setEnergy not understood.'); end diff --git a/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m b/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m index f78e0682b..590b633db 100644 --- a/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m +++ b/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m @@ -1,4 +1,5 @@ -function setInitialVolume(r, t0) +function setInitialVolume(r, v0) % SETINITIALVOLUME - % -reactormethods(4, reactor_hndl(r), t0); + +reactormethods(4, reactor_hndl(r), v0); diff --git a/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m b/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m index 15c7f8d33..f3fd4b293 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m +++ b/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m @@ -4,9 +4,9 @@ function x = ReactorNet(reactors) % A ReactorNet object is a container that holds one or more % Reactor objects. % -if nargin == 1 -else - error('wrong number of arguments to ReactorNet constructor'); + +if nargin ~= 1 + error('Wrong number of arguments to ReactorNet constructor.'); end if isa(reactors, 'Reactor') @@ -14,14 +14,14 @@ if isa(reactors, 'Reactor') reactors = {reactors}; end -x.index = reactornetmethods(0,0); +x.index = reactornetmethods(0, 0); if x.index < 0 error(geterr); end -x = class(x,'ReactorNet'); +x = class(x, 'ReactorNet'); % add reactors nr = length(reactors); for i = 1:nr - addReactor(x,reactors{i}); + addReactor(x, reactors{i}); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m b/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m index 0aea31fde..d67bb265a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m @@ -2,14 +2,14 @@ function t = ThermoPhase(r) %THERMOPHASE Cantera ThermoPhase class constructor % if nargin == 1 - if isa(r,'ThermoPhase') + if isa(r, 'ThermoPhase') % create a copy t = r; return - elseif isa(r,'XML_Node') + elseif isa(r, 'XML_Node') t.owner = 1; hr = hndl(r); - t.tp_id = thermo_get(hr,0); + t.tp_id = thermo_get(hr, 0); if t.tp_id < 0 error(geterr); end @@ -17,7 +17,7 @@ if nargin == 1 t.owner = 0; t.tp_id = r; end - t = class(t,'ThermoPhase'); + t = class(t, 'ThermoPhase'); else - error('wrong number of arguments'); + error('ThermoPhase expects 1 input argument.'); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m b/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m index 279221c8a..6791818b8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m @@ -1,4 +1,5 @@ -function x = atomicMasses(a) +function x = atomicMasses(tp) % ATOMICMASSES - Array of element atomic masses [kg/kmol]. % -x = phase_get(a.tp_id,30); + +x = phase_get(tp.tp_id, 30); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m b/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m index bc9a567f8..ba4877636 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m @@ -1,9 +1,10 @@ -function mu = chemPotentials(p) +function mu = chemPotentials(tp) % CHEMPOTENTIALS - Species chemical potentials. % % This method returns an array containing the species % chemical potentials [J/kmol]. The expressions used to % compute these depend on the model implemented by the % underlying kernel thermo manager.""" -mu = thermo_get(p.tp_id,34); + +mu = thermo_get(tp.tp_id, 34); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/clear.m b/interfaces/matlab/toolbox/@ThermoPhase/clear.m index bf08abdc8..0472ca9d2 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/clear.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/clear.m @@ -1,5 +1,6 @@ -function clear(t) +function clear(tp) % CLEAR - Delete the kernel object. % -thermo_set(t.tp_id,0,10); + +thermo_set(tp.tp_id, 0, 10); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m b/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m index 660f83386..b7929dd7d 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m @@ -1,7 +1,8 @@ -function v = cp_R(p) +function v = cp_R(tp) % CP_R - Species non-dimensional heat capacities. % % This method returns an array containing the pure species % standard-state heat capacities at constant pressure. % -v = thermo_get(p.tp_id,38); + +v = thermo_get(tp.tp_id, 38); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m index 77923ac11..1eed51397 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m @@ -1,3 +1,4 @@ -function v = cp_mass(a) +function v = cp_mass(tp) % CP_MASS - Specific heat at constant pressure [J/kg-K]. -v = thermo_get(a.tp_id,13); + +v = thermo_get(tp.tp_id, 13); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m index ab6114e4a..6169ae252 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m @@ -1,3 +1,4 @@ -function v = cp_mole(a) +function v = cp_mole(tp) % CP_MOLE - Molar heat capacity at constant pressure [J/kmol-K]. -v = thermo_get(a.tp_id,6); + +v = thermo_get(tp.tp_id, 6); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m b/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m index 36fe010a1..009448a5b 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m @@ -1,4 +1,5 @@ -function v = critDensity(a) +function v = critDensity(tp) % CRITDENSITY - Critical density [kg/m3]. % -v = thermo_get(a.tp_id,21); + +v = thermo_get(tp.tp_id, 21); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m index fd08a9df9..717d3d3f4 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m @@ -1,4 +1,5 @@ -function v = critPressure(a) +function v = critPressure(tp) % CRITPRESSURE - Critical pressure [Pa]. % -v = thermo_get(a.tp_id,20); + +v = thermo_get(tp.tp_id, 20); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m b/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m index 6f7e27a0d..8bc3aa95a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m @@ -1,4 +1,5 @@ -function v = critTemperature(a) +function v = critTemperature(tp) % CRITTEMPERATURE - Critical temperature [K]. % -v = thermo_get(a.tp_id,19); + +v = thermo_get(tp.tp_id, 19); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m index a0c0130a3..116767a7e 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m @@ -1,3 +1,4 @@ -function v = cv_mass(a) +function v = cv_mass(tp) % CV_MASS - Specific heat at constant volume [J/kg-K]. -v = thermo_get(a.tp_id,14); + +v = thermo_get(tp.tp_id, 14); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m index 422ef36ec..82d59dbe2 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m @@ -1,3 +1,4 @@ -function v = cv_mole(a) +function v = cv_mole(tp) % CV_MOLE - Molar heat capacity at constant volume [J/kmol-K]. -v = thermo_get(a.tp_id,7); + +v = thermo_get(tp.tp_id, 7); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/density.m b/interfaces/matlab/toolbox/@ThermoPhase/density.m index c1948027a..6b1061f30 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/density.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/density.m @@ -1,4 +1,5 @@ -function rho = density(p) +function rho = density(tp) % DENSITY - Mass density [kg/m^3]. % -rho = phase_get(p.tp_id,2); + +rho = phase_get(tp.tp_id, 2); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/electricPotential.m b/interfaces/matlab/toolbox/@ThermoPhase/electricPotential.m index 4d9d67df9..e56aeea0f 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/electricPotential.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/electricPotential.m @@ -1,4 +1,5 @@ -function v = electricPotential(a) +function v = electricPotential(tp) % ELECTRICPOTENTIAL - the electric potential of the phase % -v = thermo_get(a.tp_id,25); + +v = thermo_get(tp.tp_id, 25); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m b/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m index fceab84e5..ff0404fb8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m @@ -1,4 +1,4 @@ -function k = elementIndex(a,name) +function k = elementIndex(tp, name) % ELEMENTINDEX - The element index of the element with name % 'name'. % @@ -21,12 +21,12 @@ function k = elementIndex(a,name) if iscell(name) [m, n] = size(name); - k = zeros(m,n); + k = zeros(m, n); for i = 1:m for j = 1:n - k(i,j) = phase_get(a.tp_id,13,name{i,j}); + k(i,j) = phase_get(tp.tp_id, 13, name{i,j}); end end else - k = phase_get(a.tp_id,13,name); + k = phase_get(tp.tp_id, 13, name); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/elementName.m b/interfaces/matlab/toolbox/@ThermoPhase/elementName.m index fe63b4980..8468c5877 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/elementName.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/elementName.m @@ -1,4 +1,4 @@ -function nm = elementName(a, m) +function nm = elementName(tp, m) % ELEMENTNAME - Name of element with index m. % % If m is a scalar integer, the return value will be a string @@ -6,10 +6,11 @@ function nm = elementName(a, m) % integers, the output will be a cell array of % the same shape containing the name strings. % + [mm, nn] = size(m); nm = cell(mm,nn); for i = 1:mm for j = 1:nn - nm{i,j} = phase_get(a.tp_id, 41, m(i,j)); + nm{i,j} = phase_get(tp.tp_id, 41, m(i,j)); end end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/enthalpies_RT.m b/interfaces/matlab/toolbox/@ThermoPhase/enthalpies_RT.m index 4d1beb104..01d96e1c1 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/enthalpies_RT.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/enthalpies_RT.m @@ -1,4 +1,4 @@ -function v = enthalpies_RT(p) +function v = enthalpies_RT(tp) % ENTHALPIES_RT - Pure species non-dimensional enthalpies. % % h_rt = enthalpies_RT(phase) @@ -9,4 +9,5 @@ function v = enthalpies_RT(p) % values are ideal gas enthalpies. % % -v = thermo_get(p.tp_id,32); + +v = thermo_get(tp.tp_id, 32); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m index 612899621..774acfdac 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m @@ -1,4 +1,5 @@ -function v = enthalpy_mass(a) +function v = enthalpy_mass(tp) % ENTHALPY_MASS - Specific enthalpy [J/kg]. % -v = thermo_get(a.tp_id,9); + +v = thermo_get(tp.tp_id, 9); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m index 6cc02921a..4db2d8013 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m @@ -1,4 +1,5 @@ function v = enthalpy_mole(a) % ENTHALPY_MOLE - Molar enthalpy [J/kmol]. % -v = thermo_get(a.tp_id,2); + +v = thermo_get(a.tp_id, 2); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/entropies_R.m b/interfaces/matlab/toolbox/@ThermoPhase/entropies_R.m index c2fa78d7a..653299c0c 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/entropies_R.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/entropies_R.m @@ -1,7 +1,8 @@ -function v = entropies_R(p) +function s = entropies_R(tp) % ENTROPIES_R - Species non-dimensional entropies. % % This method returns an array containing the pure species % standard-state entropies. % -v = thermo_get(p.tp_id,36); + +s = thermo_get(tp.tp_id, 36); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/entropy_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/entropy_mass.m index a080ca479..eb6c7a8ea 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/entropy_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/entropy_mass.m @@ -1,2 +1,3 @@ -function v = entropy_mass(a) -v = thermo_get(a.tp_id,11); +function v = entropy_mass(tp) + +v = thermo_get(tp.tp_id, 11); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/entropy_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/entropy_mole.m index 31f8e3974..e5b5de893 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/entropy_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/entropy_mole.m @@ -1,2 +1,3 @@ -function v = entropy_mole(a) -v = thermo_get(a.tp_id,4); +function v = entropy_mole(tp) + +v = thermo_get(tp.tp_id, 4); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/eosType.m b/interfaces/matlab/toolbox/@ThermoPhase/eosType.m index e19a61cb8..18d820f04 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/eosType.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/eosType.m @@ -1,7 +1,8 @@ -function e = eosType(a) +function e = eosType(tp) % EOSTYPE - Equation of state type. % % This method returns an integer flag identifying the type of % equation of state. % -e = thermo_get(a.tp_id, 18); + +e = thermo_get(tp.tp_id, 18); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m b/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m index f2bce3368..170b1ae3e 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m @@ -1,4 +1,4 @@ -function a = equilibrate(a, xy, solver, rtol, maxsteps, maxiter, loglevel) +function tp = equilibrate(tp, xy, solver, rtol, maxsteps, maxiter, loglevel) % EQUILIBRATE Set the phase to a state of chemical equilibrium. % % XY -- A two-letter string, which must be one of the set @@ -43,7 +43,7 @@ if nargin < 7 loglevel = 0; end -iok = thermo_set(a.tp_id, 50, xy, solver, rtol, maxsteps, maxiter, loglevel); +iok = thermo_set(tp.tp_id, 50, xy, solver, rtol, maxsteps, maxiter, loglevel); if iok < 0 e = geterr; if e == 0 diff --git a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m index 754b0a086..fbdc3e9d2 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m @@ -1,7 +1,8 @@ -function g_RT = gibbs_RT(p) +function g_RT = gibbs_RT(tp) % GIBBS_RT - Species non-dimensional Gibbs free energies. % % This method returns an array containing the pure species % standard-state Gibbs free energies. % -g_RT = enthalpies_RT(p) - entropies_R(p); + +g_RT = enthalpies_RT(tp) - entropies_R(tp); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m index a6c587d2c..b2868f77c 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m @@ -1,3 +1,4 @@ -function v = gibbs_mass(a) +function v = gibbs_mass(tp) % GIBBS_MASS - Specific Gibbs function [J/kg]. -v = thermo_get(a.tp_id,12); + +v = thermo_get(tp.tp_id, 12); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m index 9f35c223b..32b4823ce 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m @@ -1,3 +1,4 @@ -function v = gibbs_mole(a) +function v = gibbs_mole(tp) % GIBBS_MOLE - Molar Gibbs function [J/kmol]. -v = thermo_get(a.tp_id,5); + +v = thermo_get(tp.tp_id, 5); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m index 50aff6bf6..450a34625 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m @@ -1,3 +1,4 @@ -function v = intEnergy_mass(a) +function v = intEnergy_mass(tp) % INTENERGY_MASS - Specific internal energy [J/kg]. -v = thermo_get(a.tp_id,10); + +v = thermo_get(tp.tp_id, 10); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mole.m index fbf5bf3ae..fa0bb33b2 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mole.m @@ -1,3 +1,3 @@ -function v = intEnergy_mole(a) +function v = intEnergy_mole(tp) % INTENERGY_MOLE - Molar internal energy [J/kmol]. -v = thermo_get(a.tp_id,3); +v = thermo_get(tp.tp_id, 3); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m b/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m index b1f8234f7..e72b396c7 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m @@ -1,8 +1,9 @@ -function v = isIdealGas(a) +function v = isIdealGas(tp) % ISIDEALGAS - True if the phase is an ideal gas or ideal gas % mixture, and false otherwise. % -if eosType(a) == 1 + +if eosType(tp) == 1 v = 1; else v = 0; diff --git a/interfaces/matlab/toolbox/@ThermoPhase/isothermalCompressibility.m b/interfaces/matlab/toolbox/@ThermoPhase/isothermalCompressibility.m index 26d41e540..a0e57386c 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/isothermalCompressibility.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/isothermalCompressibility.m @@ -1,8 +1,10 @@ -function b = isothermalCompressibility(a) +function b = isothermalCompressibility(tp) % ISOTHERMALCOMPRESSIBILITY - Isothermal Compressibility [1/Pa] % % b = isothermalCompressibility(a) % Return the isothermal compressibility of ThermoPhase a % in units of 1/Pa % -b = thermo_get(a.tp_id,26); \ No newline at end of file + +b = thermo_get(tp.tp_id, 26); + diff --git a/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m b/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m index 2e193f9ad..0c2ca935a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m @@ -1,18 +1,18 @@ -function y = massFraction(s, species) +function y = massFraction(tp, species) y = 0.0; -yarray = massFractions(s); -if isa(species,'char') - k = speciesIndex(s, species); +yarray = massFractions(tp); +if isa(species, 'char') + k = speciesIndex(tp, species); if k > 0 y = yarray(k); end -elseif isa(species,'cell') +elseif isa(species, 'cell') n = length(species); y = zeros(1, n); for j = 1:n - k = speciesIndex(s, species{j}); + k = speciesIndex(tp, species{j}); if k > 0 y(j) = yarray(k); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m index 0dd5b2ad7..da191ce5c 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m @@ -1,4 +1,4 @@ -function x = massFractions(a) +function y = massFractions(tp) % MASSFRACTIONS - Mass fractions. % % massFractions(phase); @@ -6,11 +6,12 @@ function x = massFractions(a) % returns the array of species mass fractions for phase 'phase'. If % no output argument is specified, a bar plot is produced. % -x = phase_get(a.tp_id,21); + +y = phase_get(tp.tp_id, 21); if nargout == 0 figure - set(gcf,'Name','Mass Fractions') - bar(x) + set(gcf, 'Name', 'Mass Fractions') + bar(y) xlabel('Species Number') ylabel('Mass Fraction') title('Species Mass Fractions') diff --git a/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m b/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m index 7ad60e7aa..e5e97c748 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m @@ -1,4 +1,4 @@ -function v = maxTemp(p) +function v = maxTemp(tp) % MAXTEMP - Maximum temperature. % % The parameterizations used to represent the temperature-dependent @@ -9,4 +9,5 @@ function v = maxTemp(p) % % See also: minTemp % -v = thermo_get(p.tp_id,17); + +v = thermo_get(tp.tp_id, 17); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m b/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m index e35e602ae..6d2af4ffa 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m @@ -1,7 +1,8 @@ -function wtm = meanMolarMass(p) +function wtm = meanMolarMass(tp) % MEANMOLARMASS - Mean molar mass [kg/kmol]. % % The mean molar mass is the mole-fraction-weighted sum of the % molar masses of the individual species in the phase. % -wtm = phase_get(p.tp_id,4); + +wtm = phase_get(tp.tp_id, 4); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m b/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m index 19f73acd9..3ff709428 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m @@ -1,4 +1,4 @@ -function wtm = meanMolecularWeight(p) +function wtm = meanMolecularWeight(tp) % MEANMOLECULARWEIGHT - Mean molecular weight. % % This method is a synonym for method meanMolarMass and is @@ -6,4 +6,5 @@ function wtm = meanMolecularWeight(p) % % See also; meanMolarMass % -wtm = meanMolarMass(p); \ No newline at end of file + +wtm = meanMolarMass(tp); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m b/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m index 5fad28579..4dd30702e 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m @@ -1,4 +1,4 @@ -function v = minTemp(p) +function v = minTemp(tp) % MINTEMP - Minimum temperature. % % The parameterizations used to represent the temperature-dependent @@ -9,4 +9,5 @@ function v = minTemp(p) % % See also: maxTemp % -v = thermo_get(p.tp_id,16); + +v = thermo_get(tp.tp_id, 16); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m b/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m index 117e86d0c..864cd3966 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m @@ -1,4 +1,5 @@ -function n = molarDensity(p) +function n = molarDensity(tp) % MOLARDENSITY - Molar density [kmol/m^3]. % -n = phase_get(p.tp_id,3); + +n = phase_get(tp.tp_id, 3); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m b/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m index 4ad4826c4..8c91603f6 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m @@ -1,4 +1,5 @@ -function x = molarMasses(a) +function x = molarMasses(tp) % MOLARMASSES - Array of species molar masses [kg/kmol]. % -x = phase_get(a.tp_id,22); + +x = phase_get(tp.tp_id, 22); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m b/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m index e01efb07c..fea5d2228 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m @@ -1,18 +1,18 @@ -function x = moleFraction(s, species) +function x = moleFraction(tp, species) x = 0.0; -xarray = moleFractions(s); -if isa(species,'char') - k = speciesIndex(s, species); +xarray = moleFractions(tp); +if isa(species, 'char') + k = speciesIndex(tp, species); if k > 0 x = xarray(k); end -elseif isa(species,'cell') +elseif isa(species, 'cell') n = length(species); x = zeros(1, n); for j = 1:n - k = speciesIndex(s, species{j}); + k = speciesIndex(tp, species{j}); if k > 0 x(j) = xarray(k); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m index 3529ba044..c49a8a338 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m @@ -1,4 +1,4 @@ -function x = moleFractions(a) +function x = moleFractions(tp) % MOLEFRACTIONS - Mole fractions. % % moleFractions(phase) @@ -6,10 +6,11 @@ function x = moleFractions(a) % returns the array of species mole fractions for phase 'phase'. If % no output argument is specified, a bar plot is produced. % -x = phase_get(a.tp_id,20); + +x = phase_get(tp.tp_id, 20); if nargout == 0 figure - set(gcf,'Name','Mole Fractions') + set(gcf, 'Name', 'Mole Fractions') bar(x) xlabel('Species Number') ylabel('Mole Fraction') diff --git a/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m b/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m index 30e7901ad..75947cb1f 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m @@ -1,13 +1,14 @@ -function n = nAtoms(a,k,m) +function n = nAtoms(tp, k, m) % NATOMS - Number of atoms of element m in species k. + if nargin == 3 if ischar(m) - m = elementIndex(a,m); + m = elementIndex(tp, m); end if ischar(k) - k = speciesIndex(a,k); + k = speciesIndex(tp, k); end - n = phase_get(a.tp_id,14,k,m); + n = phase_get(tp.tp_id,14, k, m); else - error('usage: nAtoms(phase, k, m)') + error('nAtoms expects three input arguments.') end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/nElements.m b/interfaces/matlab/toolbox/@ThermoPhase/nElements.m index 259f87373..a93c679f8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/nElements.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/nElements.m @@ -1,4 +1,5 @@ -function n = nElements(a) +function n = nElements(tp) % NELEMENTS - Number of elements in the phase. % -n = phase_get(a.tp_id,10); + +n = phase_get(tp.tp_id, 10); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m b/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m index d5a0fbd94..c45f9c9f6 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m @@ -1,4 +1,5 @@ -function n = nSpecies(a) +function n = nSpecies(tp) % NSPECIES - Number of species in the phase. % -n = phase_get(a.tp_id,11); + +n = phase_get(tp.tp_id, 11); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/name.m b/interfaces/matlab/toolbox/@ThermoPhase/name.m index 56bd71bf3..772bac16d 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/name.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/name.m @@ -1,3 +1,4 @@ -function nm = name(self) +function nm = name(tp) % NAME - user-specified phase name. -nm = phase_get(thermo_hndl(self), 42); + +nm = phase_get(thermo_hndl(tp), 42); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/ph.m b/interfaces/matlab/toolbox/@ThermoPhase/ph.m index 4fe7bcc78..fc9c4ad31 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/ph.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/ph.m @@ -1,3 +1,4 @@ -function i = ph(t) +function i = ph(tp) disp('method ph is deprecated.'); -i = t.ph; + +i = tp.ph; diff --git a/interfaces/matlab/toolbox/@ThermoPhase/pressure.m b/interfaces/matlab/toolbox/@ThermoPhase/pressure.m index fe5d64424..85e846431 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/pressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/pressure.m @@ -1,4 +1,5 @@ -function v = pressure(a) +function v = pressure(tp) % PRESSURE - Pressure [Pa]. % -v = thermo_get(a.tp_id,8); + +v = thermo_get(tp.tp_id, 8); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_get.m b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_get.m index 8be76892b..383d4fc0b 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_get.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_get.m @@ -1,8 +1,8 @@ function i = thermo_get(n, job, a, b) if nargin == 2 - i = ctmethods(20,n, job); + i = ctmethods(20, n, job); elseif nargin == 3 - i = ctmethods(20,n, job,a); + i = ctmethods(20, n, job, a); else i = ctmethods(20, n, job, a, b); -end \ No newline at end of file +end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/refPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/refPressure.m index 4283d6fab..302c20376 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/refPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/refPressure.m @@ -1,6 +1,7 @@ -function v = refPressure(p) +function v = refPressure(tp) % REFPRESSURE - Reference pressure [Pa]. % % All standard-state thermodynamic properties are for this pressure. % -v = thermo_get(p.tp_id,15); + +v = thermo_get(tp.tp_id, 15); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m index dd194200d..d0b859bd5 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m @@ -1,3 +1,4 @@ -function v = satPressure(a, T) +function v = satPressure(tp, T) % SATPRESSURE - Saturation pressure for temperature T. -v = thermo_get(a.tp_id,24,T); + +v = thermo_get(tp.tp_id, 24, T); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m b/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m index 86b5a2e00..48f02afa8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m @@ -1,3 +1,4 @@ -function v = satTemperature(a, p) +function v = satTemperature(tp, p) % SATTEMPERATURE - Saturation temperature for pressure p. -v = thermo_get(a.tp_id,23,p); + +v = thermo_get(tp.tp_id, 23, p); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/set.m b/interfaces/matlab/toolbox/@ThermoPhase/set.m index cc1b10e77..a007f4cc3 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/set.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/set.m @@ -1,4 +1,4 @@ -function a = set(a,varargin) +function a = set(a, varargin) % SET Set phase properties and return the updated object property_argin = varargin; while length(property_argin) >= 2, @@ -7,9 +7,9 @@ while length(property_argin) >= 2, property_argin = property_argin(3:end); switch prop case 'Temperature' - phase_set(a.tp_id,1,val); + phase_set(a.tp_id, 1, val); case 'Density' - phase_set(a.tp_id,2,val); + phase_set(a.tp_id, 2, val); otherwise error('Phase properties: Temperature, Density') end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m b/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m index de4e2e0cd..18fd8978b 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m @@ -1,10 +1,11 @@ -function a = setDensity(a,rho) +function setDensity(tp, rho) % SETDENSITY - Set the density [kg/m^3]. % % setDensity(phase, 0.01); % + if rho <= 0.0 - error('the density must be positive'); + error('The density must be positive.'); end -phase_set(a.tp_id,2,rho); +phase_set(tp.tp_id, 2, rho); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m b/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m index 8960a8c57..67efd77f8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m @@ -1,4 +1,5 @@ -function a = setElectricPotential(a,phi) +function setElectricPotential(tp, phi) % SETELECTRICPOTENTIAL Set the electric potential [V]. % -thermo_set(a.tp_id,2,phi); + +thermo_set(tp.tp_id, 2, phi); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m index 5d10be648..e7ff8ea0f 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m @@ -1,4 +1,4 @@ -function a = setMassFractions(a, y, norm) +function a = setMassFractions(tp, y, norm) % SETMASSFRACTIONS Set the species mass fractions. % % setMassFractions(a,y) @@ -29,19 +29,19 @@ function a = setMassFractions(a, y, norm) % the pressure fixed, use method 'set' (defined in class Solution) % instead, or call setPressure after calling setMassFractions. % -if isa(y,'double') +if isa(y, 'double') if nargin == 3 - if strcmp(norm,'nonorm') - phase_set(a.tp_id,23,y); + if strcmp(norm, 'nonorm') + phase_set(tp.tp_id, 23, y); else - phase_set(a.tp_id,21,y); + phase_set(tp.tp_id, 21, y); end else - phase_set(a.tp_id,21,y); + phase_set(tp.tp_id, 21, y); end % % string input % -elseif isa(y,'char') - phase_set(a.tp_id,31,y); +elseif isa(y, 'char') + phase_set(tp.tp_id, 31, y); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m index 4571c30cb..3816f644a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m @@ -1,4 +1,4 @@ -function a = setMoleFractions(a,x,norm) +function a = setMoleFractions(tp, x, norm) % SETMOLEFRACTIONS Set the species mole fractions. % % setMoleFractions(a,x) @@ -29,19 +29,19 @@ function a = setMoleFractions(a,x,norm) % the pressure fixed, use method 'set' (defined in class Solution) % instead, or call setPressure after calling setMoleFractions. -if isa(x,'double') +if isa(x, 'double') if nargin == 3 - if strcmp(norm,'nonorm') - phase_set(a.tp_id,22,x); + if strcmp(norm, 'nonorm') + phase_set(tp.tp_id, 22, x); else - phase_set(a.tp_id,20,x); + phase_set(tp.tp_id, 20, x); end else - phase_set(a.tp_id,20,x); + phase_set(tp.tp_id, 20, x); end % % string input % -elseif isa(x,'char') - phase_set(a.tp_id,30,x); +elseif isa(x, 'char') + phase_set(tp.tp_id, 30, x); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setName.m b/interfaces/matlab/toolbox/@ThermoPhase/setName.m index feebd8556..bc96767e7 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setName.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setName.m @@ -1,8 +1,9 @@ -function setName(self, name) +function setName(tp, name) % SETNAME - Set the name of the phase. % + if isa(name,'char') - phase_set(thermo_hndl(self), 32, name); + phase_set(thermo_hndl(tp), 32, name); else error('name must be a string.'); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m index d2dd4220b..b5eb97fe0 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m @@ -1,11 +1,12 @@ -function a = setPressure(a,p) +function a = setPressure(tp, p) % SETPRESSURE Set the pressure [Pa]. % % The pressure is set by changing the density holding the % temperature and chemical composition fixed. % + if p <= 0.0 - error('the pressure must be positive') + error('The pressure must be positive.') end -thermo_set(a.tp_id,1,p); +thermo_set(tp.tp_id, 1, p); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState.m b/interfaces/matlab/toolbox/@ThermoPhase/setState.m index 6cba9fb42..ccf627d91 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState.m @@ -1,12 +1,12 @@ -function a = setState(a,job,values) +function a = setState(a, job, values) disp('deprecated') -if nargin ~= 3 || ~isa(job,'char') +if nargin ~= 3 || ~isa(job, 'char') error('Syntax error. Type "help setState" for more information.') end switch job case 'T' - setTemperature(a,values) + setTemperature(a, values) otherwise error(['unknown flag: ' job]) end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_HP.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_HP.m index 7042e49ab..6c3692e50 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_HP.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_HP.m @@ -1,4 +1,4 @@ -function a = setState_HP(a,hp) +function a= setState_HP(tp, hp) % SETSTATE_HP - Set the specific enthalpy [J/kg] and pressure [Pa]. % % setState_HP(a, hp) sets the specific enthalpy and pressure @@ -6,8 +6,9 @@ function a = setState_HP(a,hp) % be a vector of length 2 containing the desired values for the specific % enthalpy (J/kg) and pressure (Pa). % + if hp(2) <= 0.0 - error('the pressure must be positive'); + error('The pressure must be positive.'); end -thermo_set(a.tp_id,20,hp); +thermo_set(tp.tp_id, 20, hp); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m index d81617960..2a457dd89 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m @@ -1,5 +1,5 @@ -function a = setState_Psat(a,px) +function setState_Psat(tp, px) % SETSTATE_PSAT Set the fluid to a saturated state at % pressure P % -thermo_set(a.tp_id,24,px); +thermo_set(tp.tp_id, 24, px); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m index ed9d99f26..ff7605cbb 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m @@ -1,4 +1,4 @@ -function a = setState_SP(a,sp) +function a = setState_SP(tp, sp) % SETSTATE_SP Set the specific entropy [J/kg/K] and pressure [Pa]. % % setState_SP(a, sp) sets the specific entropy and pressure @@ -6,10 +6,11 @@ function a = setState_SP(a,sp) % be a vector of length 2 containing the desired values for the specific % entropy (J/kg/K) and pressure (Pa). % + if sp(1) <= 0.0 - error('the specific entropy must be positive'); + error('The specific entropy must be positive.'); end if sp(2) <= 0.0 - error('the pressure must be positive'); + error('The pressure must be positive.'); end -thermo_set(a.tp_id,23,sp); +thermo_set(tp.tp_id, 23, sp); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m index 9c1e25827..6c8c52b52 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m @@ -1,4 +1,4 @@ -function a = setState_SV(a,sv) +function a = setState_SV(tp, sv) % SETSTATE_SV Set the specific entropy [J/kg/K] and specific % volume [m3/kg]. % @@ -7,10 +7,11 @@ function a = setState_SV(a,sv) % be a vector of length 2 containing the desired values for the specific % entropy (J/kg/K) and specific volume (m3/kg). % + if sv(1) <= 0.0 - error('the specific entropy must be positive'); + error('The specific entropy must be positive.'); end if sv(2) <= 0.0 - error('the specific volume must be positive'); + error('The specific volume must be positive.'); end -thermo_set(a.tp_id,22,sv); +thermo_set(tp.tp_id, 22, sv); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m index 79897fed5..3326dd004 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m @@ -1,5 +1,6 @@ -function a = setState_Tsat(a,tx) +function a = setState_Tsat(tp, tx) % SETSTATE_TSAT Set the fluid to a saturated state at % temperature t % -thermo_set(a.tp_id,25,tx); + +thermo_set(tp.tp_id, 25, tx); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m index 5f6f885f2..d10edab62 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m @@ -1,4 +1,4 @@ -function a = setState_UV(a,uv) +function a = setState_UV(tp, uv) % SETSTATE_UV Set the specific internal energy [J/kg] and % specific volume [m^3/kg]. % @@ -8,7 +8,8 @@ function a = setState_UV(a,uv) % the desired values for the specific internal energy (J/kg) and % specific volume (m^3/kg). % + if uv(2) <= 0.0 - error('the specific volume must be positive'); + error('The specific volume must be positive.'); end -thermo_set(a.tp_id,21,uv); +thermo_set(tp.tp_id, 21, uv); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m index 22578f508..bf156ad32 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m @@ -1,5 +1,6 @@ -function a = setState_satLiquid(a) +function a = setState_satLiquid(tp) % SETSTATE_SATLIQUID Set the fluid to the saturated liquid state % at the current temperature. % -thermo_set(a.tp_id,2,0); + +thermo_set(tp.tp_id, 2, 0); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m index 33e1c6568..bc67cb275 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m @@ -1,5 +1,6 @@ -function a = setState_satVapor(a) +function a = setState_satVapor(tp) % SETSTATE_SATVAPOR Set the fluid to the saturated vapor state at the % current temperature. % -thermo_set(a.tp_id,3,0); + +thermo_set(tp.tp_id, 3, 0); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m b/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m index 0884f858a..0571bb8be 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m @@ -1,7 +1,8 @@ -function a = setTemperature(a,t) +function a = setTemperature(tp,t) % SETTEMPERATURE Set the temperature [K]. % + if (t <= 0) - error('the temperature must be positive'); + error('The temperature must be positive.'); end -phase_set(a.tp_id,1,t); +phase_set(tp.tp_id, 1, t); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m b/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m index 819f76dc5..650e84d22 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m @@ -1,4 +1,4 @@ -function k = speciesIndex(a,name) +function k = speciesIndex(tp, name) % SPECIESINDEX - The species index of species with name 'name'. % % The index is an integer assigned to each species in sequence as it @@ -20,13 +20,15 @@ function k = speciesIndex(a,name) % if iscell(name) - [m, n] = size(name); - k = zeros(m,n); + [m,n] = size(name); + k = zeros(m, n); for i = 1:m for j = 1:n - k(i,j) = phase_get(a.tp_id,12,name{i,j}); + k(i,j) = phase_get(tp.tp_id, 12, name{i,j}); end end +elseif ischar(name) + k = phase_get(tp.tp_id, 12, name); else - k = phase_get(a.tp_id,12,name); + error('name must be either a string or cell array of strings') end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m b/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m index 2acab7352..7cfd1a2c9 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m @@ -1,14 +1,15 @@ -function nm = speciesName(a, k) +function nm = speciesName(tp, k) % SPECIESNAME - Name of species k. % If k is a scalar integer, the return value will be a string % containing the name of the kth species. If it is an array of % integers, the output will be a cell array of % the same shape containing the name strings. % -[m, n] = size(k); -nm = cell(m,n); + +[m,n] = size(k); +nm = cell(m, n); for i = 1:m for j = 1:n - nm{i,j} = phase_get(a.tp_id, 40, k(i,j)); + nm{i,j} = phase_get(tp.tp_id, 40, k(i,j)); end end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/speciesNames.m b/interfaces/matlab/toolbox/@ThermoPhase/speciesNames.m index 4c932066d..abfdecb53 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/speciesNames.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/speciesNames.m @@ -1,2 +1,3 @@ -function n = speciesNames(a) -n = speciesName(a,1:nSpecies(a)); +function n = speciesNames(tp) + +n = speciesName(tp, 1:nSpecies(tp)); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/temperature.m b/interfaces/matlab/toolbox/@ThermoPhase/temperature.m index 74343625b..39e28f034 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/temperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/temperature.m @@ -1,3 +1,4 @@ -function t = temperature(p) +function t = temperature(tp) % TEMPERATURE - temperature [K]. -t = phase_get(p.tp_id,1); + +t = phase_get(tp.tp_id, 1); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/thermalExpansionCoeff.m b/interfaces/matlab/toolbox/@ThermoPhase/thermalExpansionCoeff.m index 2ccbac624..800759f8e 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/thermalExpansionCoeff.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/thermalExpansionCoeff.m @@ -1,8 +1,9 @@ -function a = thermalExpansionCoeff(p) +function a = thermalExpansionCoeff(tp) % THERMALEXPANSIONCOEFF - Thermal Expansion Coefficient [1/K] % % a = thermalExpansionCoeff(p) % Return the thermal expansion coefficient of ThermoPhase p % in units of 1/K % -a = thermo_get(p.tp_id,27); + +a = thermo_get(tp.tp_id, 27); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/thermo_hndl.m b/interfaces/matlab/toolbox/@ThermoPhase/thermo_hndl.m index f26dc3308..80c5c56e8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/thermo_hndl.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/thermo_hndl.m @@ -1,2 +1,3 @@ -function i = thermo_hndl(p) -i = p.tp_id; +function i = thermo_hndl(tp) + +i = tp.tp_id; diff --git a/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m b/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m index c45e38750..82706977a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m @@ -1,5 +1,6 @@ -function v = vaporFraction(a) +function v = vaporFraction(tp) % VAPORFRACTION - Vapor fraction. % If object 'a' represents a liquid/vapor mixture, this method % returns the vapor fraction. -v = thermo_get(a.tp_id,22); + +v = thermo_get(tp.tp_id, 22); diff --git a/interfaces/matlab/toolbox/@Transport/Transport.m b/interfaces/matlab/toolbox/@Transport/Transport.m index 4318efa58..9995cf5c6 100644 --- a/interfaces/matlab/toolbox/@Transport/Transport.m +++ b/interfaces/matlab/toolbox/@Transport/Transport.m @@ -12,8 +12,8 @@ if nargin == 4 tr.th = th; if strcmp(model, 'default') try - node = child(xml_phase,'transport'); - tr.model = attrib(node,'model'); + node = child(xml_phase, 'transport'); + tr.model = attrib(node, 'model'); catch tr.model = 'None'; end @@ -21,8 +21,8 @@ if nargin == 4 tr.model = model; end tr.id = trans_get(hndl(th), -1, tr.model, loglevel) ; - tr = class(tr,'Transport'); -elseif isa(model,'Transport') + tr = class(tr, 'Transport'); +elseif isa(model, 'Transport') tr = model; else error('syntax error'); diff --git a/interfaces/matlab/toolbox/@Wall/Wall.m b/interfaces/matlab/toolbox/@Wall/Wall.m index cab69982e..4fca23d5e 100644 --- a/interfaces/matlab/toolbox/@Wall/Wall.m +++ b/interfaces/matlab/toolbox/@Wall/Wall.m @@ -3,10 +3,10 @@ function x = Wall(typ) if nargin == 0 typ = 1; end -x.index = wallmethods(0,typ); +x.index = wallmethods(0, typ); if x.index < 0 error(geterr); end x.left = -1; x.right = -1; -x = class(x,'Wall'); +x = class(x, 'Wall'); diff --git a/interfaces/matlab/toolbox/@Wall/install.m b/interfaces/matlab/toolbox/@Wall/install.m index b42c6e500..9c74043ff 100644 --- a/interfaces/matlab/toolbox/@Wall/install.m +++ b/interfaces/matlab/toolbox/@Wall/install.m @@ -3,5 +3,4 @@ function install(w, left, right) % w.left = left; w.right = right; -wallmethods(4, wall_hndl(w), reactor_hndl(left), ... - reactor_hndl(right)); +wallmethods(4, wall_hndl(w), reactor_hndl(left), reactor_hndl(right)); diff --git a/interfaces/matlab/toolbox/@Wall/setKinetics.m b/interfaces/matlab/toolbox/@Wall/setKinetics.m index fcbd09ca8..04c5ed08d 100644 --- a/interfaces/matlab/toolbox/@Wall/setKinetics.m +++ b/interfaces/matlab/toolbox/@Wall/setKinetics.m @@ -3,7 +3,7 @@ function setKinetics(w, left, right) % ileft = 0; iright = 0; -if isa(left,'Kinetics') +if isa(left, 'Kinetics') ileft = kinetics_hndl(left); end diff --git a/interfaces/matlab/toolbox/@XML_Node/XML_Node.m b/interfaces/matlab/toolbox/@XML_Node/XML_Node.m index d121fa2aa..1a614d480 100644 --- a/interfaces/matlab/toolbox/@XML_Node/XML_Node.m +++ b/interfaces/matlab/toolbox/@XML_Node/XML_Node.m @@ -8,12 +8,12 @@ if nargin == 3 x.id = wrap; elseif nargin == 2 % read tree from a file - x.id = ctmethods(10,15,0,src); % newxml(name) + x.id = ctmethods(10, 15, 0, src); if x.id < 0 error(geterr); end elseif nargin == 1 - x.id = ctmethods(10,0,0,name); + x.id = ctmethods(10, 0, 0, name); end -x = class(x,'XML_Node'); +x = class(x, 'XML_Node'); diff --git a/interfaces/matlab/toolbox/@XML_Node/attrib.m b/interfaces/matlab/toolbox/@XML_Node/attrib.m index 526e408e2..728033c83 100644 --- a/interfaces/matlab/toolbox/@XML_Node/attrib.m +++ b/interfaces/matlab/toolbox/@XML_Node/attrib.m @@ -1,6 +1,6 @@ function a = attrib(x, key) -if nargin ~= 2 || ~isa(key,'char') +if nargin ~= 2 || ~isa(key, 'char') error('Syntax error. Type "help attrib" for more information.') end diff --git a/interfaces/matlab/toolbox/@XML_Node/build.m b/interfaces/matlab/toolbox/@XML_Node/build.m index 4e3d3bafa..feae88913 100644 --- a/interfaces/matlab/toolbox/@XML_Node/build.m +++ b/interfaces/matlab/toolbox/@XML_Node/build.m @@ -1,6 +1,6 @@ function x = build(x, file, pre) -if nargin < 2 || ~isa(file,'char') +if nargin < 2 || ~isa(file, 'char') error('Syntax error. Type "help build" for more information.') end diff --git a/interfaces/matlab/toolbox/@XML_Node/findByID.m b/interfaces/matlab/toolbox/@XML_Node/findByID.m index c3ebc8dc1..e18757d02 100644 --- a/interfaces/matlab/toolbox/@XML_Node/findByID.m +++ b/interfaces/matlab/toolbox/@XML_Node/findByID.m @@ -1,5 +1,6 @@ function x = findByID(root, id) % FINDBYID - Find an XML element by ID % + index = ctmethods(10, 8, root.id, id); -x = XML_Node('','', index); +x = XML_Node('', '', index); diff --git a/interfaces/matlab/toolbox/@XML_Node/findByName.m b/interfaces/matlab/toolbox/@XML_Node/findByName.m index 5e6a0aa5d..c068efa86 100644 --- a/interfaces/matlab/toolbox/@XML_Node/findByName.m +++ b/interfaces/matlab/toolbox/@XML_Node/findByName.m @@ -1,5 +1,6 @@ function x = findByName(root, name) % FINDBYNAME - Find an XML element by name % + index = ctmethods(10, 9, root.id, name); -x = XML_Node('','', index); +x = XML_Node('', '', index); diff --git a/interfaces/matlab/toolbox/@XML_Node/value.m b/interfaces/matlab/toolbox/@XML_Node/value.m index 62788f41d..7e6c3c655 100644 --- a/interfaces/matlab/toolbox/@XML_Node/value.m +++ b/interfaces/matlab/toolbox/@XML_Node/value.m @@ -1,4 +1,4 @@ -function v = value(x,loc) +function v = value(x, loc) % VALUE - value(x) returns the value of the XML element. % value(x, loc) is shorthand for value(child(x,loc)) % diff --git a/interfaces/matlab/toolbox/GRI30.m b/interfaces/matlab/toolbox/GRI30.m index 7b0c23f93..bc9a8b1b3 100755 --- a/interfaces/matlab/toolbox/GRI30.m +++ b/interfaces/matlab/toolbox/GRI30.m @@ -19,13 +19,15 @@ function s = GRI30(tr) % g3 = GRI30('Multi') % miulticomponent transport properties % if nargin == 0 - s = Solution('gri30.cti','gri30'); + s = Solution('gri30.cti', 'gri30'); elseif nargin == 1 - if strcmp(tr,'Mix') - s = Solution('gri30.cti','gri30_mix'); - elseif strcmp(tr,'Multi') - s = Solution('gri30.cti','gri30_multi'); + if strcmp(tr, 'Mix') + s = Solution('gri30.cti', 'gri30_mix'); + elseif strcmp(tr, 'Multi') + s = Solution('gri30.cti', 'gri30_multi'); + else + error('Unknown transport specified. "Mix" or "Multi" are supported.') end else - error('wrong number of arguments'); + error('Wrong number of arguments.'); end diff --git a/interfaces/matlab/toolbox/Hydrogen.m b/interfaces/matlab/toolbox/Hydrogen.m index 5b7ad4cad..daff32c65 100644 --- a/interfaces/matlab/toolbox/Hydrogen.m +++ b/interfaces/matlab/toolbox/Hydrogen.m @@ -1,4 +1,4 @@ -function n = Hydrogen() +function h = Hydrogen() % HYDROGEN - Return an object representing hydrogen. % % The object returned by this method implements an accurate equation of @@ -10,4 +10,5 @@ function n = Hydrogen() % For more details, see classes Cantera::PureFluid and tpx::hydrogen in the % Cantera C++ source code documentation. % -n = importPhase('liquidvapor.cti','hydrogen'); + +h = importPhase('liquidvapor.cti', 'hydrogen'); diff --git a/interfaces/matlab/toolbox/IdealGasMix.m b/interfaces/matlab/toolbox/IdealGasMix.m index efd7ddcaa..6786e9e72 100755 --- a/interfaces/matlab/toolbox/IdealGasMix.m +++ b/interfaces/matlab/toolbox/IdealGasMix.m @@ -1,4 +1,4 @@ -function s = IdealGasMix(a,b,c) +function s = IdealGasMix(infile, b, c) % IDEALGASMIX - Create a Solution instance representing an ideal gas mixture. % % gas1 = IdealGasMix('ctml_file'[,'transport_model']) @@ -31,14 +31,15 @@ function s = IdealGasMix(a,b,c) % % See also: ck2cti, Solution % -dotloc = findstr(a,'.'); + +dotloc = findstr(infile, '.'); if dotloc(end) > 1 - ext = a(dotloc(end):end); - if ~strcmp(ext,'.inp') + ext = infile(dotloc(end):end); + if strcmp(ext, '.cti') || strcmp(ext, '.xml') if nargin == 1 - s = Solution(a); + s = Solution(infile); elseif nargin == 2 - s = Solution(a, b); + s = Solution(infile, b); end return end @@ -50,6 +51,6 @@ if nargin == 1 elseif nargin == 2 c = '-'; end -xml = ck2cti(a,b,c); +xml = ck2cti(infile, b, c); s = Solution(xml); -set(s,'P',oneatm); +set(s, 'P', oneatm); diff --git a/interfaces/matlab/toolbox/Methane.m b/interfaces/matlab/toolbox/Methane.m index 96010083d..620ce3d18 100644 --- a/interfaces/matlab/toolbox/Methane.m +++ b/interfaces/matlab/toolbox/Methane.m @@ -1,4 +1,4 @@ -function n = Methane() +function m = Methane() % METHANE - Return an object representing methane. % % The object returned by this method implements an accurate equation of @@ -7,4 +7,5 @@ function n = Methane() % equation of state is taken from W. C. Reynolds, "Thermodynamic % Properties in SI." % -n = importPhase('liquidvapor.cti','methane'); + +m = Solution('liquidvapor.cti', 'methane'); diff --git a/interfaces/matlab/toolbox/Nitrogen.m b/interfaces/matlab/toolbox/Nitrogen.m index b73d2bf87..bb49e75d5 100644 --- a/interfaces/matlab/toolbox/Nitrogen.m +++ b/interfaces/matlab/toolbox/Nitrogen.m @@ -7,4 +7,5 @@ function n = Nitrogen() % equation of state is taken from W. C. Reynolds, "Thermodynamic % Properties in SI." % -n = importPhase('liquidvapor.cti','nitrogen'); + +n = Solution('liquidvapor.cti', 'nitrogen'); diff --git a/interfaces/matlab/toolbox/Oxygen.m b/interfaces/matlab/toolbox/Oxygen.m index b8dda0eba..26921241c 100644 --- a/interfaces/matlab/toolbox/Oxygen.m +++ b/interfaces/matlab/toolbox/Oxygen.m @@ -1,4 +1,4 @@ -function n = Oxygen() +function o = Oxygen() % OXYGEN - Return an object representing oxygen. % % The object returned by this method implements an accurate equation of @@ -7,4 +7,5 @@ function n = Oxygen() % equation of state is taken from W. C. Reynolds, "Thermodynamic % Properties in SI." % -n = importPhase('liquidvapor.cti','oxygen'); + +o = Solution('liquidvapor.cti', 'oxygen'); diff --git a/interfaces/matlab/toolbox/Valve.m b/interfaces/matlab/toolbox/Valve.m index 901f16d11..4b98e4d47 100644 --- a/interfaces/matlab/toolbox/Valve.m +++ b/interfaces/matlab/toolbox/Valve.m @@ -1,4 +1,4 @@ -function m = Valve(upstream, downstream) +function v = Valve(upstream, downstream) % % VALVE - Create a valve connecting two reactors / reservoirs. % @@ -26,7 +26,8 @@ function m = Valve(upstream, downstream) % % see also: FlowDevice, MassFlowController % -m = FlowDevice(3); + +v = FlowDevice(3); if nargin == 2 - install(m, upstream, downstream) + install(v, upstream, downstream) end diff --git a/interfaces/matlab/toolbox/Water.m b/interfaces/matlab/toolbox/Water.m index 26af2b1c4..211a5fc04 100644 --- a/interfaces/matlab/toolbox/Water.m +++ b/interfaces/matlab/toolbox/Water.m @@ -10,4 +10,5 @@ function w = Water() % For more details, see classes Cantera::PureFluid and tpx::water in the % Cantera C++ source code documentation. % -w = importPhase('liquidvapor.cti','water'); + +w = Solution('liquidvapor.cti', 'water'); diff --git a/interfaces/matlab/toolbox/adddir.m b/interfaces/matlab/toolbox/adddir.m index 729d7d71a..9b064b818 100755 --- a/interfaces/matlab/toolbox/adddir.m +++ b/interfaces/matlab/toolbox/adddir.m @@ -6,4 +6,5 @@ function adddir(d) % adds 'directory' to the set of directories where Cantera looks for % input and data files. % -ctmethods(0,3,d); + +ctmethods(0, 3, d); diff --git a/interfaces/matlab/toolbox/air.m b/interfaces/matlab/toolbox/air.m index 539912d42..a20e82512 100755 --- a/interfaces/matlab/toolbox/air.m +++ b/interfaces/matlab/toolbox/air.m @@ -4,4 +4,5 @@ function gas = air % Air is modeled as an ideal gas mixture, and several reactions % are defined. The specification is taked from file air.xml. % -gas = importPhase('air.cti','air'); + +gas = Solution('air.cti', 'air'); diff --git a/interfaces/matlab/toolbox/ck2cti.m b/interfaces/matlab/toolbox/ck2cti.m index 926f09968..41b33b740 100644 --- a/interfaces/matlab/toolbox/ck2cti.m +++ b/interfaces/matlab/toolbox/ck2cti.m @@ -23,7 +23,7 @@ elseif nargin == 2 transport = '-'; end -dotloc = findstr(infile,'.'); +dotloc = findstr(infile, '.'); if dotloc(end) > 1 idtag = infile(1:dotloc(end)-1); outfile = [idtag '.cti']; @@ -32,6 +32,6 @@ else outfile = [infile '.cti']; end -iok = ctmethods(0,1, infile, thermo, transport, idtag, 0, 0); +iok = ctmethods(0, 1, infile, thermo, transport, idtag, 0, 0); f = outfile; diff --git a/interfaces/matlab/toolbox/cleanup.m b/interfaces/matlab/toolbox/cleanup.m index 4a7b0d9be..306b00b9a 100644 --- a/interfaces/matlab/toolbox/cleanup.m +++ b/interfaces/matlab/toolbox/cleanup.m @@ -1,4 +1,5 @@ function cleanup() % CLEANUP - Delete all stored Cantera objects and reclaim memory % + ctmethods(0, 4); diff --git a/interfaces/matlab/toolbox/constants.m b/interfaces/matlab/toolbox/constants.m index 719c5e6e1..f572e20e5 100755 --- a/interfaces/matlab/toolbox/constants.m +++ b/interfaces/matlab/toolbox/constants.m @@ -1,4 +1,4 @@ -function [atm,r] = constants +function [atm, r] = constants + atm = 101325.0; r = 8314.4621; - diff --git a/interfaces/matlab/toolbox/importEdge.m b/interfaces/matlab/toolbox/importEdge.m index d0e27cd84..2133bccc2 100644 --- a/interfaces/matlab/toolbox/importEdge.m +++ b/interfaces/matlab/toolbox/importEdge.m @@ -10,5 +10,5 @@ elseif nargin == 5 elseif nargin == 6 s = Interface(file, name, phase1, phase2, phase3, phase4); else - error('importEdge only supports 4 neighbor phases'); + error('importEdge only supports 4 neighbor phases.'); end