diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m b/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m index 7fd2e2680..be9631872 100755 --- a/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/Domain1D.m @@ -1,42 +1,42 @@ function d = Domain1D(a, b, c, d, e) -% DOMAIN1D - Create a new one-dimensional domain. +% DOMAIN1D - Create a new one-dimensional domain. % d.dom_id = -1; if nargin == 1 - d.dom_id = domain_methods(0, a); + d.dom_id = domain_methods(0, a); elseif nargin == 2 - % a stagnation flow - if a == 1 - if isa(b,'Solution') - d.dom_id = domain_methods(0, 1, thermo_hndl(b), kinetics_hndl(b), ... - trans_hndl(b), 1); + % a stagnation flow + if a == 1 + 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') + d.dom_id = domain_methods(0, 6, kinetics_hndl(b)); + else + error('Wrong argument type. Expecting instance of class Interface.'); + end else - error('Wrong argument type. Expecting instance of class Solution.'); + error('wrong object type'); end - elseif a == 6 - 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'); - end elseif nargin == 3 - if a == 1 - if isa(b,'Solution') - d.dom_id = domain_methods(0, 1, thermo_hndl(b), kinetics_hndl(b), ... - trans_hndl(b), c); + if a == 1 + 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('Wrong argument type. Expecting instance of class Solution.'); + error('unknown domain type'); end - else - error('unknown domain type'); - end end if d.dom_id < 0 - error(geterr); + error(geterr); end d.domain_type = a; d = class(d, 'Domain1D'); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m b/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m index cfc223ed6..c3a357ae8 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/componentIndex.m @@ -1,9 +1,8 @@ function n = componentIndex(d, name) -% COMPONENTINDEX - -% +% COMPONENTINDEX - +% if isa(name,'double') - n = name; + n = name; else - n = domain_methods(d.dom_id, 18, name); + n = domain_methods(d.dom_id, 18, name); end - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/componentName.m b/interfaces/matlab/toolbox/1D/@Domain1D/componentName.m index 91eb86d6d..de03989e9 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/componentName.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/componentName.m @@ -1,7 +1,7 @@ function s = componentName(d, n) % COMPONENTNAME - Name of component n. -% +% m = length(n); for i = 1:m - s{i} = domain_methods(d.dom_id, 40, n(i)); + s{i} = domain_methods(d.dom_id, 40, n(i)); end diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/disableEnergy.m b/interfaces/matlab/toolbox/1D/@Domain1D/disableEnergy.m index f60bede4d..708e258b8 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/disableEnergy.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/disableEnergy.m @@ -1,4 +1,4 @@ function d = disableEnergy(d) % ENABLEENERGY - enable the energy equation -% +% domain_methods(d.dom_id, 66, 0); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/domainIndex.m b/interfaces/matlab/toolbox/1D/@Domain1D/domainIndex.m index 687c29008..0b5892064 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/domainIndex.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/domainIndex.m @@ -1,6 +1,6 @@ function i = domainIndex(d) % DOMAININDEX - domain index. -% +% % This function returns an integer flag denoting the location % of the domain, beginning with 1 at the left. % diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/domainType.m b/interfaces/matlab/toolbox/1D/@Domain1D/domainType.m index 6902ec7af..48e35ddc9 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/domainType.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/domainType.m @@ -1,6 +1,6 @@ function i = domainType(d) % DOMAINTYPE - Type of domain. -% +% % This function returns an integer flag denoting the domain % type. i = domain_methods(d.dom_id, 12); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/domain_hndl.m b/interfaces/matlab/toolbox/1D/@Domain1D/domain_hndl.m index 17ca3d452..4632d3545 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/domain_hndl.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/domain_hndl.m @@ -1,5 +1,5 @@ function n = domain_hndl(d) % DOMAIN_HNDL - Integer used to access kernel object. -% +% n = d.dom_id; diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/gridPoints.m b/interfaces/matlab/toolbox/1D/@Domain1D/gridPoints.m index 83385236d..38d5d854a 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/gridPoints.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/gridPoints.m @@ -1,15 +1,13 @@ function zz = gridPoints(d, n) -% GRID - -% +% GRID - +% if nargin == 1 - for i = 1:nPoints(d) - zz(i) = domain_methods(d.dom_id, 19, i); - end + for i = 1:nPoints(d) + zz(i) = domain_methods(d.dom_id, 19, i); + end else - m = length(n); - for i = 1:m - zz(i) = domain_methods(d.dom_id, 19, n(i)); - end + m = length(n); + for i = 1:m + zz(i) = domain_methods(d.dom_id, 19, n(i)); + end end - - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/isFlow.m b/interfaces/matlab/toolbox/1D/@Domain1D/isFlow.m index fc4c6fd29..2aa39a211 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/isFlow.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/isFlow.m @@ -1,10 +1,9 @@ function a = isFlow(d) % ISFLOW - Returns 1 if the domain is a flow domain, and 0 otherwise. -% +% t = domainType(d); if t == 50 - a = 1; + a = 1; else - a = 0; + a = 0; end - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/isInlet.m b/interfaces/matlab/toolbox/1D/@Domain1D/isInlet.m index 9daac3580..664e88730 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/isInlet.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/isInlet.m @@ -7,4 +7,3 @@ if t == 104 else a = 0; end - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/isSurface.m b/interfaces/matlab/toolbox/1D/@Domain1D/isSurface.m index 4c82a94d6..df3fc8c53 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/isSurface.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/isSurface.m @@ -1,10 +1,9 @@ function a = isSurface(d) % ISSURFACE - Returns 1 if the domain is a surface, and 0 otherwise. -% +% t = domainType(d); if t == 102 - a = 1; + a = 1; else - a = 0; + a = 0; end - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/massFlux.m b/interfaces/matlab/toolbox/1D/@Domain1D/massFlux.m index c6e391cf4..58f06674d 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/massFlux.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/massFlux.m @@ -1,5 +1,4 @@ function mdot = massFlux(d) -% MASSFLUX - -% +% MASSFLUX - +% mdot = domain_methods(d.dom_id, 17); - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m b/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m index f5864dd78..c76c6373c 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/massFraction.m @@ -1,17 +1,16 @@ function y = massFraction(d, k) % MASSFRACTION - Mass fraction of species k. -% +% % This method returns the mass fraction of species k, where % 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('not yet...'); end - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/nComponents.m b/interfaces/matlab/toolbox/1D/@Domain1D/nComponents.m index b1ec5d366..bc46e423a 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/nComponents.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/nComponents.m @@ -1,4 +1,4 @@ function n = nComponents(d) % NCOMPONENTS - number of components -% +% n = domain_methods(d.dom_id, 11); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/nPoints.m b/interfaces/matlab/toolbox/1D/@Domain1D/nPoints.m index d2c7da4e6..489c4f940 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/nPoints.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/nPoints.m @@ -2,4 +2,3 @@ function npts = nPoints(d) % NPOINTS - Number of grid points. % npts = domain_methods(d.dom_id, 14); - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/private/domain_methods.m b/interfaces/matlab/toolbox/1D/@Domain1D/private/domain_methods.m index bc5e68afa..31e33ab5a 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/private/domain_methods.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/private/domain_methods.m @@ -1,15 +1,15 @@ function v = domain_methods(n, job, a, b, c, d) % if nargin == 2 - v = ctmethods(90, n, job); + v = ctmethods(90, n, job); elseif nargin == 3 - v = ctmethods(90, n, job, a); + v = ctmethods(90, n, job, a); elseif nargin == 4 - v = ctmethods(90, n, job, a, b); + v = ctmethods(90, n, job, a, b); elseif nargin == 5 - v = ctmethods(90, n, job, a, b, c); + v = ctmethods(90, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(90, n, job, a, b, c, d); + v = ctmethods(90, n, job, a, b, c, d); elseif nargin == 7 - v = ctmethods(90, n, job, a, b, c, d, e); + v = ctmethods(90, n, job, a, b, c, d, e); end diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/set.m b/interfaces/matlab/toolbox/1D/@Domain1D/set.m index 8d7019b23..86f9cbd95 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/set.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/set.m @@ -1,8 +1,8 @@ function a = set(a,varargin) % SET - Set properties. % -% The properties that may be set are -% +% The properties that may be set are +% % Either the full property name or the symbol may be % specified. For the extensive properties (V,H,U,S), the values % must be given per unit mass. H, U, and S must be set in @@ -25,62 +25,62 @@ function a = set(a,varargin) % property_argin = varargin; - + while length(property_argin) >= 2, - prop = property_argin{1}; - val = property_argin{2}; - property_argin = property_argin(3:end); - switch prop - case 'Temperature' - setTemperature(a,val); - case 'T' - setTemperature(a,val); - case 'MassFractions' - setMassFractions(a,val); - case 'Y' - setMassFractions(a,val); - case 'mdot' - setMdot(a,val); - case 'MassFlux' - setMdot(a,val); - case 'P' - setPressure(a,val); - case 'Pressure' - setPressure(a,val); - case 'tol' - sz = size(val); - if sz == nComponents(a) - setTolerances(a, val(1,:), val(2,:)); - elseif length(val) == 2 - setTolerances(a, 'default', val(1), val(2)); - else - error('wrong array size for error tolerances'); - end - case 'tol-time' - sz = size(val); - if sz == nComponents(a) - setTolerances(a, val(1,:), val(2,:)); - elseif length(val) == 2 - rt = val(1); - at = val(2); - setTolerances(a, 'default', rt, at, 'ts'); - else - error('wrong array size for error tolerances'); - end - case 'grid' - setupGrid(a, val); - case 'bounds' - setBounds(a, val(1,:), val(2,:)); - case 'X' - setMoleFractions(a, val); - case 'MoleFractions' - setMoleFractions(a, val); - case 'T_fixed' - setFixedTempProfile(a, val); - case 'ID' - setID(a, val); - otherwise - error(['unknown property ' char(prop)]); - end + prop = property_argin{1}; + val = property_argin{2}; + property_argin = property_argin(3:end); + switch prop + case 'Temperature' + setTemperature(a,val); + case 'T' + setTemperature(a,val); + case 'MassFractions' + setMassFractions(a,val); + case 'Y' + setMassFractions(a,val); + case 'mdot' + setMdot(a,val); + case 'MassFlux' + setMdot(a,val); + case 'P' + setPressure(a,val); + case 'Pressure' + setPressure(a,val); + case 'tol' + sz = size(val); + if sz == nComponents(a) + setTolerances(a, val(1,:), val(2,:)); + elseif length(val) == 2 + setTolerances(a, 'default', val(1), val(2)); + else + error('wrong array size for error tolerances'); + end + case 'tol-time' + sz = size(val); + if sz == nComponents(a) + setTolerances(a, val(1,:), val(2,:)); + elseif length(val) == 2 + rt = val(1); + at = val(2); + setTolerances(a, 'default', rt, at, 'ts'); + else + error('wrong array size for error tolerances'); + end + case 'grid' + setupGrid(a, val); + case 'bounds' + setBounds(a, val(1,:), val(2,:)); + case 'X' + setMoleFractions(a, val); + case 'MoleFractions' + setMoleFractions(a, val); + case 'T_fixed' + setFixedTempProfile(a, val); + case 'ID' + setID(a, val); + otherwise + error(['unknown property ' char(prop)]); + end end diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setBounds.m b/interfaces/matlab/toolbox/1D/@Domain1D/setBounds.m index 078e91576..08762d61e 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 - -% +% SETBOUNDS - +% 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 6ea7c4d9d..b1bb2699f 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setCoverageEqs.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setCoverageEqs.m @@ -1,20 +1,20 @@ function d = setCoverageEqs(d,onoff) % SETCOVERAGEEQS - Enable or disable solving the coverage equations. -% +% if d.domain_type ~= 6 - error('Wrong domain type. Expected a reacting surface domain.') + error('Wrong domain type. Expected a reacting surface domain.') end ion = -1; if isa(onoff,'char') - if strcmp(onoff,'on') | strcmp(onoff,'yes') - ion = 1; - elseif strcmp(onoff,'off') | strcmp(onoff,'no') - ion = 0; - else - error(strcat('unknown option: ',onoff)) - end + if strcmp(onoff,'on') | strcmp(onoff,'yes') + ion = 1; + elseif strcmp(onoff,'off') | strcmp(onoff,'no') + ion = 0; + else + error(strcat('unknown option: ',onoff)) + end elseif isa(onoff,'numeric') - ion = onoff; + ion = onoff; end -domain_methods(d.dom_id, 120, ion); \ No newline at end of file +domain_methods(d.dom_id, 120, ion); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setID.m b/interfaces/matlab/toolbox/1D/@Domain1D/setID.m index 4a325d0f0..d83241be6 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setID.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setID.m @@ -1,4 +1,4 @@ function d = setID(d, id) % SETID - Set the ID tag for the domain. -% +% domain_methods(d.dom_id, 54, id); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setMdot.m b/interfaces/matlab/toolbox/1D/@Domain1D/setMdot.m index 98647488a..49a575b11 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setMdot.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setMdot.m @@ -1,4 +1,4 @@ function d = setMdot(d, mdot) -% SETMDOT - -% +% SETMDOT - +% domain_methods(d.dom_id, 60, mdot); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setMoleFractions.m b/interfaces/matlab/toolbox/1D/@Domain1D/setMoleFractions.m index ac9d7b5b7..03e5f22a5 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setMoleFractions.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setMoleFractions.m @@ -1,4 +1,4 @@ function d = setMoleFractions(d, x) -% SETMOLEFRACTIONS - -% +% SETMOLEFRACTIONS - +% domain_methods(d.dom_id, 62, x); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setPressure.m b/interfaces/matlab/toolbox/1D/@Domain1D/setPressure.m index 02df91ed4..7e5a09f2e 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setPressure.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setPressure.m @@ -1,5 +1,4 @@ function d = setPressure(d, p) -% SETPRESSURE - -% +% SETPRESSURE - +% domain_methods(d.dom_id, 63, p); - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m b/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m index 9abdfbec3..8ce7a5ac0 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setProfile.m @@ -1,9 +1,8 @@ function d = setProfile(d, n, p) -% SETPROFILE - -% +% 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); - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setTemperature.m b/interfaces/matlab/toolbox/1D/@Domain1D/setTemperature.m index 1a23e7058..d2412586f 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setTemperature.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setTemperature.m @@ -1,4 +1,4 @@ function d = setTemperature(d, t) % SETTEMPERATURE - Set the temperature [K]. -% +% domain_methods(d.dom_id, 61, t); diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setTolerances.m b/interfaces/matlab/toolbox/1D/@Domain1D/setTolerances.m index 28cd490ed..2592c5edb 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setTolerances.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setTolerances.m @@ -1,35 +1,35 @@ function d = setTolerances(d, component, rtol, atol, typ) -% SETTOLERANCES - -% +% SETTOLERANCES - +% ityp = 0; if nargin == 5 - switch typ - case 'ts' - ityp = -1; - case 'time' - ityp = -1; - case 'ss' - ityp = 1; - case 'steady' - ityp = 1; - end + switch typ + case 'ts' + ityp = -1; + case 'time' + ityp = -1; + case 'ss' + ityp = 1; + case 'steady' + ityp = 1; + end end if strcmp(component,'default') - nc = nComponents(d); - for ii = 1:nc - domain_methods(d.dom_id, 52, ii, rtol, atol, ityp); - end - return + nc = nComponents(d); + for ii = 1:nc + domain_methods(d.dom_id, 52, ii, rtol, atol, ityp); + end + return end - + if iscell(component) - nc = length(component); - for ii = 1:nc - n = componentIndex(d, component{ii}); - domain_methods(d.dom_id, 52, n, rtol, atol, ityp); - end + nc = length(component); + for ii = 1:nc + n = componentIndex(d, component{ii}); + domain_methods(d.dom_id, 52, n, rtol, atol, ityp); + end else - n = componentIndex(d, component); - domain_methods(d.dom_id, 52, n, rtol, atol, ityp); + n = componentIndex(d, component); + domain_methods(d.dom_id, 52, n, rtol, atol, ityp); end diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/setupGrid.m b/interfaces/matlab/toolbox/1D/@Domain1D/setupGrid.m index 0922f24dc..bf50c5706 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/setupGrid.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/setupGrid.m @@ -1,5 +1,4 @@ function d = setupGrid(d, grid) -% SETUPGRID - -% +% SETUPGRID - +% domain_methods(d.dom_id, 53, grid); - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/temperature.m b/interfaces/matlab/toolbox/1D/@Domain1D/temperature.m index d91e5e332..284e78d4e 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/temperature.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/temperature.m @@ -1,5 +1,4 @@ function t = temperature(d) % TEMPERATURE - Temperature [K]. -% +% t = domain_methods(d.dom_id, 15); - diff --git a/interfaces/matlab/toolbox/1D/@Domain1D/z.m b/interfaces/matlab/toolbox/1D/@Domain1D/z.m index 3da29ffe2..22ff3a699 100644 --- a/interfaces/matlab/toolbox/1D/@Domain1D/z.m +++ b/interfaces/matlab/toolbox/1D/@Domain1D/z.m @@ -1,15 +1,13 @@ function zz = z(d, n) -% GRID - -% +% GRID - +% if nargin == 1 - for i = 1:nPoints(d) - zz(i) = domain_methods(d.dom_id, 19, i); - end + for i = 1:nPoints(d) + zz(i) = domain_methods(d.dom_id, 19, i); + end else - m = length(n); - for i = 1:m - zz(i) = domain_methods(d.dom_id, 19, n(i)); - end + m = length(n); + for i = 1:m + zz(i) = domain_methods(d.dom_id, 19, n(i)); + end end - - diff --git a/interfaces/matlab/toolbox/1D/@Stack/Stack.m b/interfaces/matlab/toolbox/1D/@Stack/Stack.m index e19c49134..9da6845f9 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/Stack.m +++ b/interfaces/matlab/toolbox/1D/@Stack/Stack.m @@ -1,25 +1,24 @@ function s = Stack(domains) % -% STACK - A one-dimensional 'stack' of domains. -% +% STACK - A one-dimensional 'stack' of domains. +% % A stack object is a container for one-dimensional domains, % which are instances of class Domain1D. The domains are of two -% types - extended domains, and connector domains. +% types - extended domains, and connector domains. % s.stack_id = -1; s.domains = domains; if nargin == 1 - nd = length(domains); - for n=1:nd - ids(n) = domain_hndl(domains(n)); - end - s.stack_id = stack_methods(0, 8, nd, ids); + nd = length(domains); + for n=1:nd + ids(n) = domain_hndl(domains(n)); + end + s.stack_id = stack_methods(0, 8, nd, ids); else - help(Stack); - error('wrong number of parameters'); + help(Stack); + error('wrong number of parameters'); end if s.stack_id < 0 - error(geterr); + error(geterr); end s = class(s, 'Stack'); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/display.m b/interfaces/matlab/toolbox/1D/@Stack/display.m index 368ba7333..6fea51b15 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/display.m +++ b/interfaces/matlab/toolbox/1D/@Stack/display.m @@ -1,10 +1,9 @@ function display(s, fname) -% DISPLAY - show all domains. +% DISPLAY - show all domains. % % fname - file to write summary to. If omitted, output is to the screen. % if nargin == 1 - fname = '-'; + fname = '-'; end stack_methods(s.stack_id, 103, fname); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m b/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m index 7beff60e0..1cbd9a147 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m +++ b/interfaces/matlab/toolbox/1D/@Stack/domainIndex.m @@ -1,7 +1,7 @@ function n = domainIndex(d, name) % DOMAININDEX - Index of the domain with a specified name. if isa(name,'double') - n = name + n = name else - n = stack_methods(d.stack_id, 109, name); + n = stack_methods(d.stack_id, 109, name); end diff --git a/interfaces/matlab/toolbox/1D/@Stack/grid.m b/interfaces/matlab/toolbox/1D/@Stack/grid.m index 0ffde0e29..e451b8005 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/grid.m +++ b/interfaces/matlab/toolbox/1D/@Stack/grid.m @@ -1,6 +1,6 @@ function z = grid(s, d) % GRID - the grid in one domain. -% +% n = domainIndex(s,d); 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 856278c3f..c925497fd 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/plotSolution.m +++ b/interfaces/matlab/toolbox/1D/@Stack/plotSolution.m @@ -10,4 +10,3 @@ x = solution(s, domain, component); plot(z, x); xlabel('z (m)'); ylabel(component); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/private/stack_methods.m b/interfaces/matlab/toolbox/1D/@Stack/private/stack_methods.m index b4df11529..624b6d63d 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/private/stack_methods.m +++ b/interfaces/matlab/toolbox/1D/@Stack/private/stack_methods.m @@ -6,20 +6,19 @@ function v = stack_methods(n, job, a, b, c, d, e, f) % and simply calls ctmethods with a flag associated with this class % as the first parameter, followed by the input arguments. if nargin == 2 - v = ctmethods(90, n, job); + v = ctmethods(90, n, job); elseif nargin == 3 - v = ctmethods(90, n, job, a); + v = ctmethods(90, n, job, a); elseif nargin == 4 - v = ctmethods(90, n, job, a, b); + v = ctmethods(90, n, job, a, b); elseif nargin == 5 - v = ctmethods(90, n, job, a, b, c); + v = ctmethods(90, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(90, n, job, a, b, c, d); + v = ctmethods(90, n, job, a, b, c, d); elseif nargin == 7 - v = ctmethods(90, n, job, a, b, c, d, e); + v = ctmethods(90, n, job, a, b, c, d, e); elseif nargin == 8 - v = ctmethods(90, n, job, a, b, c, d, e, f); + v = ctmethods(90, n, job, a, b, c, d, e, f); else - error('too many arguments'); + error('too many arguments'); end - \ No newline at end of file diff --git a/interfaces/matlab/toolbox/1D/@Stack/resid.m b/interfaces/matlab/toolbox/1D/@Stack/resid.m index b6764e42d..1707dc2b7 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/resid.m +++ b/interfaces/matlab/toolbox/1D/@Stack/resid.m @@ -1,7 +1,7 @@ function r = resid(s, domain, rdt, count) if nargin == 2 - rdt = 0.0; - count = 0; + rdt = 0.0; + count = 0; end idom = domainIndex(s, domain); @@ -10,7 +10,7 @@ d = s.domains(idom); r = zeros(nComponents(d), nPoints(d)); stack_methods(s.stack_id, 113, rdt, count); for m = 1:nComponents(d) - for n = 1:nPoints(d) - r(m,n) = stack_methods(s.stack_id, 31, idom, m, n); - end + for n = 1:nPoints(d) + r(m,n) = stack_methods(s.stack_id, 31, idom, m, n); + end end diff --git a/interfaces/matlab/toolbox/1D/@Stack/restore.m b/interfaces/matlab/toolbox/1D/@Stack/restore.m index 90e6718fa..e9349259e 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/restore.m +++ b/interfaces/matlab/toolbox/1D/@Stack/restore.m @@ -1,6 +1,6 @@ function restore(s, fname, id) % RESTORE - Restore a previously-saved solution. -% +% % This method can be used to provide an initial guess for the -% solution. +% solution. stack_methods(s.stack_id, 111, fname, id); diff --git a/interfaces/matlab/toolbox/1D/@Stack/save.m b/interfaces/matlab/toolbox/1D/@Stack/save.m index 7dfd2d5f4..2ce2bfd50 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/save.m +++ b/interfaces/matlab/toolbox/1D/@Stack/save.m @@ -1,10 +1,10 @@ function saveSoln(s, fname, id, desc) -% SAVE - -% +% SAVE - +% if nargin == 2 - id = 'solution'; - desc = '-'; + id = 'solution'; + desc = '-'; elseif nargin == 3 - desc = '-'; + desc = '-'; end stack_methods(s.stack_id, 107, fname, id, desc); diff --git a/interfaces/matlab/toolbox/1D/@Stack/saveSoln.m b/interfaces/matlab/toolbox/1D/@Stack/saveSoln.m index edad98dec..c9c3d417e 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/saveSoln.m +++ b/interfaces/matlab/toolbox/1D/@Stack/saveSoln.m @@ -1,14 +1,14 @@ function saveSoln(s, fname, id, desc) % SAVE - Save solution. -% +% if nargin == 1 - fname = 'soln.xml'; - id = 'solution'; - desc = '--'; + fname = 'soln.xml'; + id = 'solution'; + desc = '--'; elseif nargin == 2 - id = 'solution'; - desc = '--'; + id = 'solution'; + desc = '--'; elseif nargin == 3 - desc = '--'; + desc = '--'; end stack_methods(s.stack_id, 107, fname, id, desc); diff --git a/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m b/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m index 8c58e46ad..06b7cbb7d 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setFlatProfile.m @@ -1,5 +1,4 @@ function setFlatProfile(s, n, comp, v) -% SETFLATPROFILE - -% +% SETFLATPROFILE - +% stack_methods(s.stack_id, 102, n, comp, v); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/setMaxJacAge.m b/interfaces/matlab/toolbox/1D/@Stack/setMaxJacAge.m index 1bba4127b..5e3148a8b 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setMaxJacAge.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setMaxJacAge.m @@ -1,8 +1,8 @@ function setMaxJacAge(s, ss_age, ts_age) -% SETMAXJACAGE - Set the number of times the Jacobian will be used +% SETMAXJACAGE - Set the number of times the Jacobian will be used % before it is recomputed. -% +% if nargin == 2 - ts_age = ss_age; + ts_age = ss_age; end stack_methods(s.stack_id, 114, ss_age, ts_age); diff --git a/interfaces/matlab/toolbox/1D/@Stack/setProfile.m b/interfaces/matlab/toolbox/1D/@Stack/setProfile.m index 5459ca12c..2822c3ef8 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setProfile.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setProfile.m @@ -7,46 +7,44 @@ function setProfile(s, name, comp, p) % v -- array of values % % The solution vector values for this component will be linearly -% interpolated from the discrete function defined by v vs. zr. +% interpolated from the discrete function defined by v vs. zr. % Note that zr = 0.0 corresponds to the leftmost grid point in % the specified domain, and zr = 1.0 corresponds to the rightmost % grid point. This method can be called at any time, but is % usually used to set the initial guess for the solution. % % Example: -% +% % zr = [0 0.1 0.2 0.4 0.8 1]; % v = [500 650 700 730 800 900]; % setProfile(1, 2, zr, v); % if isa(name,'double') - n = name; + n = name; else - n = domainIndex(s, name); + n = domainIndex(s, name); end d = s.domains(n); if isa(comp,'double') | isa(comp,'cell') - c = comp; + c = comp; elseif isa(comp,'char') - c = {comp}; + 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}); - stack_methods(s.stack_id, 101, n, ic, p(1,:), p(j+1,:)); - end + for j = 1:np + 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)); + 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 41cb4b173..a064bb33e 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setRefineCriteria.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setRefineCriteria.m @@ -11,20 +11,19 @@ function d = setRefineCriteria(d, n, ratio, slope, curve, prune) % will be retained in the grid. If the computed % slope or curve value is below prune for all % components, it will be deleted, unless either -% neighboring point is already marked for deletion. -% +% neighboring point is already marked for deletion. +% if nargin < 3 - ratio = 10.0; + ratio = 10.0; end if nargin < 4 - slope = 0.8; + slope = 0.8; end if nargin < 5 - curve = 0.8; + curve = 0.8; end if nargin < 6 - prune = -0.1; + prune = -0.1; end stack_methods(d.stack_id, 106, n, ratio, slope, curve, prune); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/setValue.m b/interfaces/matlab/toolbox/1D/@Stack/setValue.m index 4c95d238a..200e6f2fa 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/setValue.m +++ b/interfaces/matlab/toolbox/1D/@Stack/setValue.m @@ -1,6 +1,6 @@ function setValue(s, n, comp, localPoint, v) % SETVALUE - Set the value of a single entry in the solution vector. -% +% % n -- domain number % comp -- component number % localPoint -- local index of the grid point in the domain @@ -17,4 +17,3 @@ function setValue(s, n, comp, localPoint, v) % stack. % stack_methods(s.stack_id, 100, n, comp, localPoint, v); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/solution.m b/interfaces/matlab/toolbox/1D/@Stack/solution.m index a7f3a4129..e4381eff5 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/solution.m +++ b/interfaces/matlab/toolbox/1D/@Stack/solution.m @@ -3,21 +3,21 @@ function x = solution(s, domain, component) % % x = solution(s, 'flow', 'T') returns in vector x the values of % solution component 'T' in domain 'flow'. -% +% idom = domainIndex(s, domain); d = s.domains(idom); if nargin == 3 - icomp = componentIndex(d, component); - for n = 1:nPoints(d) - x(n) = stack_methods(s.stack_id, 30, idom, icomp, n); - end + icomp = componentIndex(d, component); + for n = 1:nPoints(d) + x(n) = stack_methods(s.stack_id, 30, idom, icomp, n); + end else - nc = nComponents(d); - np = nPoints(d); - for m = 1:nc - for n = 1:np - x(m,n) = stack_methods(s.stack_id, 30, idom, m, n); - end - end + nc = nComponents(d); + np = nPoints(d); + for m = 1:nc + for n = 1:np + x(m,n) = stack_methods(s.stack_id, 30, idom, m, n); + end + end end diff --git a/interfaces/matlab/toolbox/1D/@Stack/solve.m b/interfaces/matlab/toolbox/1D/@Stack/solve.m index 0481024e3..e8088dad3 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/solve.m +++ b/interfaces/matlab/toolbox/1D/@Stack/solve.m @@ -1,5 +1,4 @@ function solve(s, loglevel, refine_grid) -% SOLVE - -% +% SOLVE - +% stack_methods(s.stack_id, 104, loglevel, refine_grid); - diff --git a/interfaces/matlab/toolbox/1D/@Stack/subsref.m b/interfaces/matlab/toolbox/1D/@Stack/subsref.m index edb54ce5a..6bd884411 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/subsref.m +++ b/interfaces/matlab/toolbox/1D/@Stack/subsref.m @@ -1,11 +1,11 @@ function b = subsref(s,index) -% SUBSREF - +% SUBSREF - switch index.type - case '()' - b = s.domains(index.subs{:}); - case '.' - n = domainIndex(s, index.subs); - b = s.domains(n); - otherwise - error('syntax error'); + case '()' + b = s.domains(index.subs{:}); + case '.' + n = domainIndex(s, index.subs); + b = s.domains(n); + otherwise + error('syntax error'); end diff --git a/interfaces/matlab/toolbox/1D/@Stack/writeStats.m b/interfaces/matlab/toolbox/1D/@Stack/writeStats.m index 683ddcef1..e69787a1a 100644 --- a/interfaces/matlab/toolbox/1D/@Stack/writeStats.m +++ b/interfaces/matlab/toolbox/1D/@Stack/writeStats.m @@ -1,10 +1,8 @@ function writeStats(s) % WRITESTATS - Print statistics for the current solution. -% +% % writeStats(s) prints a summary of the number of function and % Jacobian evaluations for each grid, and the CPU time spent on % each one. % stack_methods(s.stack_id, 108); - - diff --git a/interfaces/matlab/toolbox/1D/AxiStagnFlow.m b/interfaces/matlab/toolbox/1D/AxiStagnFlow.m index 1f675538b..dd14b711b 100644 --- a/interfaces/matlab/toolbox/1D/AxiStagnFlow.m +++ b/interfaces/matlab/toolbox/1D/AxiStagnFlow.m @@ -2,5 +2,5 @@ function m = AxiStagnFlow(gas) % AXISTAGNFLOW - Axisymmetric stagnation flow. % % Return a Domain1D instance representing an axisymmetric -% stagnation flow. +% stagnation flow. m = Domain1D(1, gas); diff --git a/interfaces/matlab/toolbox/1D/AxisymmetricFlow.m b/interfaces/matlab/toolbox/1D/AxisymmetricFlow.m index 8c423e9d6..945148015 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); -end \ No newline at end of file + setID(m,id); +end diff --git a/interfaces/matlab/toolbox/1D/FreeFlame.m b/interfaces/matlab/toolbox/1D/FreeFlame.m index 643c9a24f..a421d5b43 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); -end \ No newline at end of file + setID(m,id); +end diff --git a/interfaces/matlab/toolbox/1D/Inlet.m b/interfaces/matlab/toolbox/1D/Inlet.m index 07ae84fc7..607668d52 100644 --- a/interfaces/matlab/toolbox/1D/Inlet.m +++ b/interfaces/matlab/toolbox/1D/Inlet.m @@ -5,9 +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 4fbe4a967..80d66b9c3 100644 --- a/interfaces/matlab/toolbox/1D/Outlet.m +++ b/interfaces/matlab/toolbox/1D/Outlet.m @@ -3,9 +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 908501fe9..8139b72ac 100644 --- a/interfaces/matlab/toolbox/1D/OutletRes.m +++ b/interfaces/matlab/toolbox/1D/OutletRes.m @@ -3,9 +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 dfcf3cf5f..3eb1f7c8c 100644 --- a/interfaces/matlab/toolbox/1D/Surface.m +++ b/interfaces/matlab/toolbox/1D/Surface.m @@ -2,14 +2,13 @@ function m = Surface(id, surface_mech) % SURFACE - Return a Domain1D instance representing a non-reacting % or reacting surface. if nargin < 2 - m = Domain1D(3); - if nargin == 0 - setID(m,'surface'); - elseif nargin == 1 - setID(m,id); - end + m = Domain1D(3); + if nargin == 0 + setID(m,'surface'); + elseif nargin == 1 + setID(m,id); + end else - m = Domain1D(6, surface_mech) - setID(m,id); + m = Domain1D(6, surface_mech) + setID(m,id); end - diff --git a/interfaces/matlab/toolbox/1D/SymmPlane.m b/interfaces/matlab/toolbox/1D/SymmPlane.m index 8e164e5d5..c517c7d7d 100644 --- a/interfaces/matlab/toolbox/1D/SymmPlane.m +++ b/interfaces/matlab/toolbox/1D/SymmPlane.m @@ -3,9 +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 ce6467348..64ba1a200 100644 --- a/interfaces/matlab/toolbox/1D/npflame_init.m +++ b/interfaces/matlab/toolbox/1D/npflame_init.m @@ -19,20 +19,20 @@ function flame = npflame_init(gas, left, flow, right, fuel, oxidizer, nuox) % Check input parameters if nargin ~= 7 - error('wrong number of input arguments.'); + error('wrong number of input arguments.'); end if ~isIdealGas(gas) - error('gas object must represent an ideal gas mixture.'); + error('gas object must represent an ideal gas mixture.'); end if ~isInlet(left) - error('left inlet object of wrong type.'); + error('left inlet object of wrong type.'); end if ~isFlow(flow) - error('flow object of wrong type.'); + error('flow object of wrong type.'); end if ~isInlet(right) - error('right inlet object of wrong type.'); + error('right inlet object of wrong type.'); end % create the container object @@ -60,9 +60,9 @@ tf = temperature(left); tox = temperature(right); for n = 1:nsp - yox(n) = massFraction(right,n); - yf(n) = massFraction(left,n); - ystoich(n) = zst*yf(n) + (1.0 - zst)*yox(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); @@ -83,23 +83,23 @@ x0 = massFlux(left)*dz/(massFlux(left) + massFlux(right)); nz = nPoints(flow); for j = 1:nz - x = zz(j); - zeta = f*(x - x0); - zmix = 0.5*(1.0 - erf(zeta)); - zm(j) = zmix; - u(j) = a*(x0 - zz(j)); - v(j) = a; - if zmix > zst - for n = 1:nsp - y(j,n) = yeq(n) + (zmix - zst)*(yf(n) - yeq(n))/(1.0 - zst); + x = zz(j); + zeta = f*(x - x0); + zmix = 0.5*(1.0 - erf(zeta)); + zm(j) = zmix; + u(j) = a*(x0 - zz(j)); + v(j) = a; + if zmix > zst + for n = 1:nsp + y(j,n) = yeq(n) + (zmix - zst)*(yf(n) - yeq(n))/(1.0 - zst); + end + t(j) = teq + (tf - teq)*(zmix - zst)/(1.0 - zst); + else + for n = 1:nsp + y(j,n) = yox(n) + zmix*(yeq(n) - yox(n))/zst; + end + t(j) = tox + zmix*(teq - tox)/zst; end - t(j) = teq + (tf - teq)*(zmix - zst)/(1.0 - zst); - else - for n = 1:nsp - y(j,n) = yox(n) + zmix*(yeq(n) - yox(n))/zst; - end - t(j) = tox + zmix*(teq - tox)/zst; - end end zrel = zz/dz; @@ -109,9 +109,9 @@ setProfile(flame, 2, {'u', 'V'}, [zrel; u; v]); setProfile(flame, 2, 'T', [zrel; t] ); for n = 1:nsp - nm = speciesName(gas,n); - setProfile(flame, 2, nm, [zrel; transpose(y(:,n))]) + nm = speciesName(gas,n); + setProfile(flame, 2, nm, [zrel; transpose(y(:,n))]) end -% set minimal grid refinement criteria -setRefineCriteria(flame, 2, 10.0, 0.99, 0.99); \ No newline at end of file +% set minimal grid refinement criteria +setRefineCriteria(flame, 2, 10.0, 0.99, 0.99); diff --git a/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m b/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m index fdb8d8618..2da5eb513 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m +++ b/interfaces/matlab/toolbox/@FlowDevice/FlowDevice.m @@ -1,15 +1,13 @@ function x = FlowDevice(typ) % if nargin == 0 - typ = 1; + typ = 1; end x.index = flowdevicemethods(0,typ); if x.index < 0 - error(geterr); + error(geterr); end x.type = typ; x.upstream = -1; x.downstream = -1; x = class(x,'FlowDevice'); - - diff --git a/interfaces/matlab/toolbox/@FlowDevice/clear.m b/interfaces/matlab/toolbox/@FlowDevice/clear.m index 7a2fc11e2..6b922d203 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/clear.m +++ b/interfaces/matlab/toolbox/@FlowDevice/clear.m @@ -1,4 +1,4 @@ function clear(f) -% CLEAR - -% +% CLEAR - +% flowdevicemethods(1, f.index) diff --git a/interfaces/matlab/toolbox/@FlowDevice/install.m b/interfaces/matlab/toolbox/@FlowDevice/install.m index f7349f0a2..273aa337f 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/install.m +++ b/interfaces/matlab/toolbox/@FlowDevice/install.m @@ -1,16 +1,16 @@ function install(f, upstream, downstream) if nargin == 3 - if ~isa(upstream,'Reactor') | ~isa(downstream,'Reactor') - error(['Flow devices can only be installed between reactors or' ... - ' reservoirs']) - end - i = hndl(upstream); - j = hndl(downstream); - ok = flowdevicemethods(2, f.index, i, j); - if ok < 0 - error(geterr) - end + if ~isa(upstream,'Reactor') | ~isa(downstream,'Reactor') + error(['Flow devices can only be installed between reactors or' ... + ' reservoirs']) + end + i = hndl(upstream); + j = hndl(downstream); + ok = flowdevicemethods(2, f.index, i, j); + if ok < 0 + error(geterr) + end else - error('install requires 3 arguments') -end \ No newline at end of file + error('install requires 3 arguments') +end diff --git a/interfaces/matlab/toolbox/@FlowDevice/massFlowRate.m b/interfaces/matlab/toolbox/@FlowDevice/massFlowRate.m index 967bf21e0..5094a2e66 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/massFlowRate.m +++ b/interfaces/matlab/toolbox/@FlowDevice/massFlowRate.m @@ -1,5 +1,4 @@ function mdot = massFlowRate(f, time) % MASSFLOWRATE - mass flow rate in kg/s -% +% mdot = flowdevicemethods(21, f.index, time); - diff --git a/interfaces/matlab/toolbox/@FlowDevice/private/flowdevicemethods.m b/interfaces/matlab/toolbox/@FlowDevice/private/flowdevicemethods.m index b537c9290..ab0e7101b 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/private/flowdevicemethods.m +++ b/interfaces/matlab/toolbox/@FlowDevice/private/flowdevicemethods.m @@ -1,13 +1,13 @@ function v = flowdevicemethods(n, job, a, b, c, d) -% +% if nargin == 2 - v = ctmethods(80, n, job); + v = ctmethods(80, n, job); elseif nargin == 3 - v = ctmethods(80, n, job, a); + v = ctmethods(80, n, job, a); elseif nargin == 4 - v = ctmethods(80, n, job, a, b); + v = ctmethods(80, n, job, a, b); elseif nargin == 5 - v = ctmethods(80, n, job, a, b, c); + v = ctmethods(80, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(80, n, job, a, b, c, d); -end \ No newline at end of file + v = ctmethods(80, n, job, a, b, c, d); +end diff --git a/interfaces/matlab/toolbox/@FlowDevice/setFunction.m b/interfaces/matlab/toolbox/@FlowDevice/setFunction.m index 764077053..96fdc0ecc 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/setFunction.m +++ b/interfaces/matlab/toolbox/@FlowDevice/setFunction.m @@ -2,11 +2,10 @@ function setFunction(f, mf) % SETMASSFLOWRATE - % if f.type == 1 - k = flowdevicemethods(5, f.index, func_hndl(mf)); - if k < 0 - error(geterr); - end + k = flowdevicemethods(5, f.index, func_hndl(mf)); + if k < 0 + error(geterr); + end else - error('Mass flow rate can only be set for mass flow controllers') + error('Mass flow rate can only be set for mass flow controllers') end - diff --git a/interfaces/matlab/toolbox/@FlowDevice/setMassFlowRate.m b/interfaces/matlab/toolbox/@FlowDevice/setMassFlowRate.m index f4e69ce7b..315b20c50 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/setMassFlowRate.m +++ b/interfaces/matlab/toolbox/@FlowDevice/setMassFlowRate.m @@ -1,12 +1,11 @@ function setMassFlowRate(f, mdot) -% SETMASSFLOWRATE - -% +% SETMASSFLOWRATE - +% if f.type == 1 - k = flowdevicemethods(3, f.index, mdot); - if k < 0 - error(geterr); - end + k = flowdevicemethods(3, f.index, mdot); + if k < 0 + error(geterr); + end else - error('Mass flow rate can only be set for mass flow controllers') + error('Mass flow rate can only be set for mass flow controllers') end - diff --git a/interfaces/matlab/toolbox/@FlowDevice/setValveCoeff.m b/interfaces/matlab/toolbox/@FlowDevice/setValveCoeff.m index 18381cc42..de55990b2 100644 --- a/interfaces/matlab/toolbox/@FlowDevice/setValveCoeff.m +++ b/interfaces/matlab/toolbox/@FlowDevice/setValveCoeff.m @@ -1,10 +1,10 @@ function setValveCoeff(f, k) % SETVALVECOEFF - set valve coefficient -% +% if f.type ~= 3 - error('Valve coefficient can only be set for valves') + error('Valve coefficient can only be set for valves') end ok = flowdevicemethods(4, f.index, k); if ok < 0 - error(geterr); -end \ No newline at end of file + error(geterr); +end diff --git a/interfaces/matlab/toolbox/@Func/Func.m b/interfaces/matlab/toolbox/@Func/Func.m index b892f9ff7..38a76e0ae 100644 --- a/interfaces/matlab/toolbox/@Func/Func.m +++ b/interfaces/matlab/toolbox/@Func/Func.m @@ -1,12 +1,12 @@ function x = Func(typ, n, p) % % Func - a class for functors. -% +% % A functor is an object that behaves like a function. Cantera % defines a set of functors to use to create arbitrary functions to % specify things like heat fluxes, piston speeds, etc., in reactor % network simulations. Of course, they can be used for other things -% too. +% too. % % The main feature of a functor class is that it overloads the '()' % operator to evaluate the function. For example, suppose object @@ -27,7 +27,7 @@ function x = Func(typ, n, p) % "Func1". See the Cantera C++ documentation for more details. % if ~isa(typ, 'char') - error('Function type must be a string') + error('Function type must be a string') end x.f1 = 0; @@ -36,41 +36,39 @@ x.coeffs = 0; itype = -1; if strcmp(typ, 'polynomial') - itype = 2; + itype = 2; elseif strcmp(typ,'fourier') - itype = 1; + itype = 1; elseif strcmp(typ,'arrhenius') - itype = 3; + itype = 3; elseif strcmp(typ,'gaussian') - itype = 4; + itype = 4; end if itype > 0 - x.coeffs = p; - x.index = funcmethods(0,itype,n,p); + x.coeffs = p; + 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); + itype = 50; + x.f1 = n; + x.coeffs = p; + x.index = funcmethods(0,itype,n.index,p); else - if strcmp(typ,'sum') - itype = 20; - elseif strcmp(typ,'diff') - itype = 25; - elseif strcmp(typ,'prod') - itype = 30; - elseif strcmp(typ,'ratio') - itype = 40; - elseif strcmp(typ,'composite') - itype = 60; - end - x.f1 = n; - x.f2 = p; - x.index = funcmethods(0,itype,n.index,p.index); + if strcmp(typ,'sum') + itype = 20; + elseif strcmp(typ,'diff') + itype = 25; + elseif strcmp(typ,'prod') + itype = 30; + elseif strcmp(typ,'ratio') + itype = 40; + elseif strcmp(typ,'composite') + itype = 60; + end + x.f1 = n; + x.f2 = p; + x.index = funcmethods(0,itype,n.index,p.index); end x.typ = typ; x = class(x,'Func'); - - diff --git a/interfaces/matlab/toolbox/@Func/char.m b/interfaces/matlab/toolbox/@Func/char.m index b4ff878c3..59c70bafe 100644 --- a/interfaces/matlab/toolbox/@Func/char.m +++ b/interfaces/matlab/toolbox/@Func/char.m @@ -1,92 +1,92 @@ function s = char(p) -% CHAR - -% +% CHAR - +% if strcmp(p.typ,'sum') - s = ['(' char(p.f1) ') + (' char(p.f2) ')']; + s = ['(' char(p.f1) ') + (' char(p.f2) ')']; elseif strcmp(p.typ,'diff') - s = ['(' char(p.f1) ') - (' char(p.f2) ')']; + s = ['(' char(p.f1) ') - (' char(p.f2) ')']; elseif strcmp(p.typ,'prod') - s = ['(' char(p.f1) ') * (' char(p.f2) ')']; + s = ['(' char(p.f1) ') * (' char(p.f2) ')']; elseif strcmp(p.typ,'ratio') - s = ['(' char(p.f1) ') / (' char(p.f2) ')']; + s = ['(' char(p.f1) ') / (' char(p.f2) ')']; elseif all(p.coeffs == 0) - s = '0'; + s = '0'; else - if strcmp(p.typ,'polynomial') - d = length(p.coeffs) - 1; - s = []; - nn = 0; - for b = p.coeffs; - cc(d+1-nn) = b; - nn = nn + 1; + if strcmp(p.typ,'polynomial') + d = length(p.coeffs) - 1; + s = []; + nn = 0; + for b = p.coeffs; + cc(d+1-nn) = b; + nn = nn + 1; + end + for a = cc; + if a ~= 0; + if ~isempty(s) + if a > 0 + s = [s ' + ']; + else + s = [s ' - ']; + a = -a; + end + end + if a ~= 1 | d == 0 + s = [s num2str(a)]; + if d > 0 + s = [s '*']; + end + end + if d >= 2 + s = [s 'x^' int2str(d)]; + elseif d == 1 + s = [s 'x']; + end + end + d = d - 1; + end + elseif strcmp(p.typ,'gaussian') + s = num2str(p.coeffs(1)); + 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; + if Ao ~= 0 + s = [num2str(Ao/2)]; + else + s = ''; + end + for n=1:N + if A(n) ~= 0 + if A(n) < 0 + prefix = ' - '; + elseif s + prefix = ' + '; + else + prefix = ''; + end + + s = [s prefix num2str(abs(A(n))) '*cos(' num2str(n*w) '*x)']; + end + + if B(n) ~= 0 + if B(n) < 0 + prefix = ' - '; + elseif s + prefix = ' + '; + else + prefix = ''; + end + + s = [s prefix num2str(abs(B(n))) '*sin(' num2str(n*w) '*x)']; + end + end + else + s = ['*** char not yet implemented for' p.typ ' ***']; end - for a = cc; - if a ~= 0; - if ~isempty(s) - if a > 0 - s = [s ' + ']; - else - s = [s ' - ']; - a = -a; - end - end - if a ~= 1 | d == 0 - s = [s num2str(a)]; - if d > 0 - s = [s '*']; - end - end - if d >= 2 - s = [s 'x^' int2str(d)]; - elseif d == 1 - s = [s 'x']; - end - end - d = d - 1; - end - elseif strcmp(p.typ,'gaussian') - s = num2str(p.coeffs(1)); - 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; - if Ao ~= 0 - s = [num2str(Ao/2)]; - else - s = ''; - end - for n=1:N - if A(n) ~= 0 - if A(n) < 0 - prefix = ' - '; - elseif s - prefix = ' + '; - else - prefix = ''; - end - - s = [s prefix num2str(abs(A(n))) '*cos(' num2str(n*w) '*x)']; - end - - if B(n) ~= 0 - if B(n) < 0 - prefix = ' - '; - elseif s - prefix = ' + '; - else - prefix = ''; - end - - s = [s prefix num2str(abs(B(n))) '*sin(' num2str(n*w) '*x)']; - end - end - else - s = ['*** char not yet implemented for' p.typ ' ***']; - end end diff --git a/interfaces/matlab/toolbox/@Func/display.m b/interfaces/matlab/toolbox/@Func/display.m index d778a9a0b..f755a1f64 100644 --- a/interfaces/matlab/toolbox/@Func/display.m +++ b/interfaces/matlab/toolbox/@Func/display.m @@ -1,9 +1,8 @@ function d = display(a) -% DISPLAY - +% DISPLAY - % disp(' '); disp([inputname(1),' = ']) disp(' '); disp([' ' char(a)]) disp(' '); - diff --git a/interfaces/matlab/toolbox/@Func/plus.m b/interfaces/matlab/toolbox/@Func/plus.m index 6433b817c..fb4309620 100644 --- a/interfaces/matlab/toolbox/@Func/plus.m +++ b/interfaces/matlab/toolbox/@Func/plus.m @@ -2,7 +2,5 @@ function r = plus(a, b) % % PLUS - Return a functor representing the sum of two functors a % and b. -% +% r = Func('sum',a,b); - - diff --git a/interfaces/matlab/toolbox/@Func/private/funcmethods.m b/interfaces/matlab/toolbox/@Func/private/funcmethods.m index 335489500..89640c0a9 100644 --- a/interfaces/matlab/toolbox/@Func/private/funcmethods.m +++ b/interfaces/matlab/toolbox/@Func/private/funcmethods.m @@ -1,13 +1,13 @@ function v = funcmethods(n, job, a, b, c, d) -% +% if nargin == 2 - v = ctmethods(110, n, job); + v = ctmethods(110, n, job); elseif nargin == 3 - v = ctmethods(110, n, job, a); + v = ctmethods(110, n, job, a); elseif nargin == 4 - v = ctmethods(110, n, job, a, b); + v = ctmethods(110, n, job, a, b); elseif nargin == 5 - v = ctmethods(110, n, job, a, b, c); + v = ctmethods(110, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(110, n, job, a, b, c, d); -end \ No newline at end of file + v = ctmethods(110, n, job, a, b, c, d); +end diff --git a/interfaces/matlab/toolbox/@Func/rdivide.m b/interfaces/matlab/toolbox/@Func/rdivide.m index 517baffe5..8f48f8dc1 100644 --- a/interfaces/matlab/toolbox/@Func/rdivide.m +++ b/interfaces/matlab/toolbox/@Func/rdivide.m @@ -1,5 +1,4 @@ function r = rdivide(a,b) -% RDIVIDE - -% +% RDIVIDE - +% r = Func('ratio',a,b); - diff --git a/interfaces/matlab/toolbox/@Func/subsref.m b/interfaces/matlab/toolbox/@Func/subsref.m index c7ba4c736..8c65e9009 100644 --- a/interfaces/matlab/toolbox/@Func/subsref.m +++ b/interfaces/matlab/toolbox/@Func/subsref.m @@ -1,11 +1,11 @@ function b = subsref(a,s) -% SUBSREF +% SUBSREF switch s.type -case '()' - ind = s.subs{:}; - for k = 1:length(ind) - b(k) = funcmethods(2,a.index,ind(k)); - end -otherwise - error('Specify value for x as p(x)') + case '()' + ind = s.subs{:}; + for k = 1:length(ind) + b(k) = funcmethods(2,a.index,ind(k)); + end + otherwise + error('Specify value for x as p(x)') end diff --git a/interfaces/matlab/toolbox/@Func/times.m b/interfaces/matlab/toolbox/@Func/times.m index 348f9c1ac..ca841863a 100644 --- a/interfaces/matlab/toolbox/@Func/times.m +++ b/interfaces/matlab/toolbox/@Func/times.m @@ -1,5 +1,4 @@ function r = times(a,b) -% TIMES - -% +% TIMES - +% r = Func('prod',a,b); - diff --git a/interfaces/matlab/toolbox/@Interface/Interface.m b/interfaces/matlab/toolbox/@Interface/Interface.m index b8f63259b..8b7cb429d 100644 --- a/interfaces/matlab/toolbox/@Interface/Interface.m +++ b/interfaces/matlab/toolbox/@Interface/Interface.m @@ -5,19 +5,17 @@ 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); - - diff --git a/interfaces/matlab/toolbox/@Interface/concentrations.m b/interfaces/matlab/toolbox/@Interface/concentrations.m index 63f3e297a..c03dd5042 100644 --- a/interfaces/matlab/toolbox/@Interface/concentrations.m +++ b/interfaces/matlab/toolbox/@Interface/concentrations.m @@ -1,17 +1,15 @@ function c = concentrations(s) % CONCENTRATIONS - Surface concentrations -% +% c = surfmethods(thermo_hndl(s), 101); if nargout == 0 - figure - set(gcf,'Name','Concentrations') - bar(c); - colormap(summer); - nm = speciesNames(s); - legend(nm); - xlabel('Species Number'); - ylabel('Concentration [kmol/m2]'); - title('Surface Species Concentrations'); + figure + set(gcf,'Name','Concentrations') + bar(c); + colormap(summer); + nm = speciesNames(s); + legend(nm); + xlabel('Species Number'); + 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 ea5b9dec1..67f2a9766 100644 --- a/interfaces/matlab/toolbox/@Interface/coverages.m +++ b/interfaces/matlab/toolbox/@Interface/coverages.m @@ -1,17 +1,15 @@ function c = coverages(s) % COVERAGES - Surface coverages -% +% c = surfmethods(thermo_hndl(s), 101); if nargout == 0 - figure - set(gcf,'Name','Coverages') - bar(c); - colormap(summer); - nm = speciesNames(s); - legend(nm); - xlabel('Species Number'); - ylabel('Coverage'); - title('Surface Species Coverages'); + figure + set(gcf,'Name','Coverages') + bar(c); + colormap(summer); + nm = speciesNames(s); + legend(nm); + xlabel('Species Number'); + ylabel('Coverage'); + title('Surface Species Coverages'); end - - diff --git a/interfaces/matlab/toolbox/@Interface/private/surfmethods.m b/interfaces/matlab/toolbox/@Interface/private/surfmethods.m index e62c740f4..3c9fa8ff0 100644 --- a/interfaces/matlab/toolbox/@Interface/private/surfmethods.m +++ b/interfaces/matlab/toolbox/@Interface/private/surfmethods.m @@ -6,20 +6,19 @@ function v = surfmethods(n, job, a, b, c, d, e, f) % and simply calls ctmethods with a flag associated with this class % as the first parameter, followed by the input arguments. if nargin == 2 - v = ctmethods(100, n, job); + v = ctmethods(100, n, job); elseif nargin == 3 - v = ctmethods(100, n, job, a); + v = ctmethods(100, n, job, a); elseif nargin == 4 - v = ctmethods(100, n, job, a, b); + v = ctmethods(100, n, job, a, b); elseif nargin == 5 - v = ctmethods(100, n, job, a, b, c); + v = ctmethods(100, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(100, n, job, a, b, c, d); + v = ctmethods(100, n, job, a, b, c, d); elseif nargin == 7 - v = ctmethods(100, n, job, a, b, c, d, e); + v = ctmethods(100, n, job, a, b, c, d, e); elseif nargin == 8 - v = ctmethods(100, n, job, a, b, c, d, e, f); + v = ctmethods(100, n, job, a, b, c, d, e, f); else - error('too many arguments'); + error('too many arguments'); end - \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@Interface/setCoverages.m b/interfaces/matlab/toolbox/@Interface/setCoverages.m index 637c5847b..a65064222 100644 --- a/interfaces/matlab/toolbox/@Interface/setCoverages.m +++ b/interfaces/matlab/toolbox/@Interface/setCoverages.m @@ -1,17 +1,13 @@ function setCoverages(s,cov) % SETCOVERAGES - set surface coverages -% +% if isa(cov,'double') - sz = length(cov); - if sz == nSpecies(s) - surfmethods(thermo_hndl(s), 3, cov); - else - error('wrong size for coverage array'); - end + sz = length(cov); + if sz == nSpecies(s) + surfmethods(thermo_hndl(s), 3, cov); + else + error('wrong size for coverage array'); + end elseif isa(cov,'char') - surfmethods(thermo_hndl(s), 5, cov); + surfmethods(thermo_hndl(s), 5, cov); end - - - - diff --git a/interfaces/matlab/toolbox/@Kinetics/Kinetics.m b/interfaces/matlab/toolbox/@Kinetics/Kinetics.m index e4572a710..14b5309e0 100644 --- a/interfaces/matlab/toolbox/@Kinetics/Kinetics.m +++ b/interfaces/matlab/toolbox/@Kinetics/Kinetics.m @@ -1,10 +1,10 @@ function k = Kinetics(r, ph, neighbor1, neighbor2, neighbor3, neighbor4) % -% KINETICS - Kinetics class constructor. +% KINETICS - Kinetics class constructor. % % Class Kinetics represents kinetics managers, which are classes % that manage reaction mechanisms. The reaction mechanism -% attributes are specified in a CTML file. +% attributes are specified in a CTML file. % % indices for bulk phases in a heterogeneous mechanism. @@ -17,42 +17,42 @@ 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') - k = r; - return - else - error('wrong number of arguments') - end + if isa(r,'Kinetics') + k = r; + return + else + error('wrong number of arguments') + end end % if more than one arguement, first one must be an XML_Node % instance representing the XML tree if ~isa(r,'XML_Node') - error('first argument must be an XML_Node object') + error('first argument must be an XML_Node object') end k.owner = 1; ixml = hndl(r); % get the integer indices used to find the stored objects -% representing the phases participating in the mechanism. +% representing the phases participating in the mechanism. iphase = thermo_hndl(ph); if nargin > 2 - ineighbor1 = thermo_hndl(neighbor1); - if nargin > 3 - ineighbor2 = thermo_hndl(neighbor2); - if nargin > 4 - ineighbor3 = thermo_hndl(neighbor3); - if nargin > 5 - ineighbor4 = thermo_hndl(neighbor4); - end + ineighbor1 = thermo_hndl(neighbor1); + if nargin > 3 + ineighbor2 = thermo_hndl(neighbor2); + if nargin > 4 + ineighbor3 = thermo_hndl(neighbor3); + if nargin > 5 + ineighbor4 = thermo_hndl(neighbor4); + end + end end - end end k.id = kinetics_get(ixml,0,iphase,ineighbor1,ineighbor2,ineighbor3, ... - ineighbor4); + ineighbor4); if k.id < 0 - error(geterr); + error(geterr); end k = class(k,'Kinetics'); diff --git a/interfaces/matlab/toolbox/@Kinetics/advanceCoverages.m b/interfaces/matlab/toolbox/@Kinetics/advanceCoverages.m index e8a818de0..8e334cf45 100644 --- a/interfaces/matlab/toolbox/@Kinetics/advanceCoverages.m +++ b/interfaces/matlab/toolbox/@Kinetics/advanceCoverages.m @@ -1,5 +1,4 @@ function advanceCoverages(k, dt) % ADVANCECOVERAGES - advance the surface coverages forward in time holding the bulk phase concentrations fixed. -% +% kinetics_set(k.id, 5, 0, dt); - diff --git a/interfaces/matlab/toolbox/@Kinetics/clear.m b/interfaces/matlab/toolbox/@Kinetics/clear.m index 539837d29..d49c626ba 100644 --- a/interfaces/matlab/toolbox/@Kinetics/clear.m +++ b/interfaces/matlab/toolbox/@Kinetics/clear.m @@ -1,5 +1,4 @@ function clear(k) % CLEAR - delete the Kinetics instance. -% +% kinetics_set(k.id,3); - diff --git a/interfaces/matlab/toolbox/@Kinetics/creationRates.m b/interfaces/matlab/toolbox/@Kinetics/creationRates.m index 1336f86f2..4f39a72ba 100644 --- a/interfaces/matlab/toolbox/@Kinetics/creationRates.m +++ b/interfaces/matlab/toolbox/@Kinetics/creationRates.m @@ -5,19 +5,16 @@ function cdot = creationRates(a) % % Returns a column vector of the creation rates of all % species. If the output is not assigned to a variable, a -% bar graph is produced. +% bar graph is produced. % % See also: destructionRates, netProdRates. % cdot = kinetics_get(a.id,21,0); if nargout == 0 - figure - set(gcf,'Name','Creation Rates') - bar(cdot) - xlabel('Species Number') - ylabel('Creation Rate (kmol/m^3-s)') - title('Species Chemical Creation Rates') + figure + set(gcf,'Name','Creation Rates') + bar(cdot) + xlabel('Species Number') + ylabel('Creation Rate (kmol/m^3-s)') + title('Species Chemical Creation Rates') end - - - diff --git a/interfaces/matlab/toolbox/@Kinetics/destructionRates.m b/interfaces/matlab/toolbox/@Kinetics/destructionRates.m index 45d35331a..c18319f2f 100644 --- a/interfaces/matlab/toolbox/@Kinetics/destructionRates.m +++ b/interfaces/matlab/toolbox/@Kinetics/destructionRates.m @@ -5,19 +5,16 @@ function ddot = destructionRates(a) % % Returns a column vector of the destruction rates of all % species. If the output is not assigned to a variable, a -% bar graph is produced. +% bar graph is produced. % % See also: creationRates, netProdRates. % ddot = kinetics_get(a.id,22,0); if nargout == 0 - figure - set(gcf,'Name','Destruction Rates') - bar(ddot) - xlabel('Species Number') - ylabel('Destruction Rate (kmol/m^3/s)') - title('Species Chemical Destruction Rates') + figure + set(gcf,'Name','Destruction Rates') + bar(ddot) + xlabel('Species Number') + ylabel('Destruction Rate (kmol/m^3/s)') + title('Species Chemical Destruction Rates') end - - - diff --git a/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m b/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m index f6913e0d4..64c036a5b 100644 --- a/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m +++ b/interfaces/matlab/toolbox/@Kinetics/destruction_rates.m @@ -3,18 +3,16 @@ function q = destruction_rates(a) % % q = destruction_rates(a) % -% Returns a column vector of the destruction rates of all species. +% Returns a column vector of the destruction rates of all species. % % See also: creation_rates, net_production_rates. % q = production(a.id,nSpecies(a.ph),1); if nargout == 0 - figure - set(gcf,'Name','Destruction Rates') - bar(q) - xlabel('Species Number') - ylabel('Destruction Rate (kmol/m^3/s)') - title('Species Chemical Destruction Rates') + figure + set(gcf,'Name','Destruction Rates') + bar(q) + xlabel('Species Number') + ylabel('Destruction Rate (kmol/m^3/s)') + title('Species Chemical Destruction Rates') end - - diff --git a/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m b/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m index e6df2a544..e15ae17c7 100644 --- a/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m +++ b/interfaces/matlab/toolbox/@Kinetics/equil_Kc.m @@ -11,12 +11,10 @@ function kc = equil_Kc(a) % kc = kinetics_get(a.id,14,0); if nargout == 0 - figure - set(gcf,'Name','Equilibrium Constants') - bar(log10(kc)) - xlabel('Reaction Number') - ylabel('log_1_0 Kc [kmol, m, s]') - title('Equilibrium Constants Kc') + figure + set(gcf,'Name','Equilibrium Constants') + bar(log10(kc)) + xlabel('Reaction Number') + ylabel('log_1_0 Kc [kmol, m, s]') + title('Equilibrium Constants Kc') end - - diff --git a/interfaces/matlab/toolbox/@Kinetics/kinetics_hndl.m b/interfaces/matlab/toolbox/@Kinetics/kinetics_hndl.m index 84735db8e..1271e64fe 100644 --- a/interfaces/matlab/toolbox/@Kinetics/kinetics_hndl.m +++ b/interfaces/matlab/toolbox/@Kinetics/kinetics_hndl.m @@ -1,6 +1,4 @@ function i = kinetics_hndl(k) % KINETICS_HNDL - integer used to access kernel object -% +% i = k.id; - - diff --git a/interfaces/matlab/toolbox/@Kinetics/multiplier.m b/interfaces/matlab/toolbox/@Kinetics/multiplier.m index 966f23421..2c368da2d 100644 --- a/interfaces/matlab/toolbox/@Kinetics/multiplier.m +++ b/interfaces/matlab/toolbox/@Kinetics/multiplier.m @@ -6,9 +6,8 @@ function n = multiplier(a,irxn) % disable reactions. For reversible reactions, it multiplies both % the forward and reverse rates. By default, the multiplier value % is 1.0, but it may be set to any other value by calling method -% setMultiplier. +% setMultiplier. % % MULTIPLIER(K, IRXN) Multiplier for reaction number 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 63529214a..5ef868a10 100644 --- a/interfaces/matlab/toolbox/@Kinetics/nReactions.m +++ b/interfaces/matlab/toolbox/@Kinetics/nReactions.m @@ -2,4 +2,3 @@ function n = nReactions(a) % NREACTIONS - Number of reactions. % n = kinetics_get(a.id,1,0); - diff --git a/interfaces/matlab/toolbox/@Kinetics/nTotalSpecies.m b/interfaces/matlab/toolbox/@Kinetics/nTotalSpecies.m index 29cde000b..262efaaf7 100644 --- a/interfaces/matlab/toolbox/@Kinetics/nTotalSpecies.m +++ b/interfaces/matlab/toolbox/@Kinetics/nTotalSpecies.m @@ -1,5 +1,5 @@ function nsp = nTotalSpecies(a) % NTOTALSPECIES - The total number of species, summed over all -% participating phases. -% +% participating phases. +% nsp = kinetics_get(a.id, 3, 0); diff --git a/interfaces/matlab/toolbox/@Kinetics/netProdRates.m b/interfaces/matlab/toolbox/@Kinetics/netProdRates.m index 8d6b4e032..a7b4b9c62 100644 --- a/interfaces/matlab/toolbox/@Kinetics/netProdRates.m +++ b/interfaces/matlab/toolbox/@Kinetics/netProdRates.m @@ -11,12 +11,10 @@ function wdot = netProdRates(a) % wdot = kinetics_get(a.id,23,0); if nargout == 0 - figure - set(gcf,'Name','Production Rates') - bar(wdot) - xlabel('Species Number') - ylabel('Net Production Rate (kmol/m^3/s)') - title('Species Net Chemical Production Rates') + figure + set(gcf,'Name','Production Rates') + bar(wdot) + xlabel('Species Number') + ylabel('Net Production Rate (kmol/m^3/s)') + title('Species Net Chemical Production Rates') end - - diff --git a/interfaces/matlab/toolbox/@Kinetics/private/kinetics_get.m b/interfaces/matlab/toolbox/@Kinetics/private/kinetics_get.m index 72c8d54d6..0131ac66e 100644 --- a/interfaces/matlab/toolbox/@Kinetics/private/kinetics_get.m +++ b/interfaces/matlab/toolbox/@Kinetics/private/kinetics_get.m @@ -1,18 +1,18 @@ function v = kinetics_get(n, job, a, b, c, d, e, f) -% KINETICS_GET - get kinetics attributes -% +% KINETICS_GET - get kinetics attributes +% if nargin == 2 - v = ctmethods(40, n, job); + v = ctmethods(40, n, job); elseif nargin == 3 - v = ctmethods(40, n, job, a); + v = ctmethods(40, n, job, a); elseif nargin == 4 - v = ctmethods(40, n, job, a, b); + v = ctmethods(40, n, job, a, b); elseif nargin == 5 - v = ctmethods(40, n, job, a, b, c); + v = ctmethods(40, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(40, n, job, a, b, c, d); + v = ctmethods(40, n, job, a, b, c, d); elseif nargin == 7 - v = ctmethods(40, n, job, a, b, c, d, e); + v = ctmethods(40, n, job, a, b, c, d, e); elseif nargin == 8 - v = ctmethods(40, n, job, a, b, c, d, e, f); -end \ No newline at end of file + v = ctmethods(40, n, job, a, b, c, d, e, f); +end diff --git a/interfaces/matlab/toolbox/@Kinetics/private/kinetics_set.m b/interfaces/matlab/toolbox/@Kinetics/private/kinetics_set.m index 1ac0019f1..2634394dc 100644 --- a/interfaces/matlab/toolbox/@Kinetics/private/kinetics_set.m +++ b/interfaces/matlab/toolbox/@Kinetics/private/kinetics_set.m @@ -1,6 +1,4 @@ function kinetics_set(n, job, a, b) -% KINETICS_SET - get kinetics attributes -% +% KINETICS_SET - get kinetics attributes +% ctmethods(40, n, -job, a, b) - - diff --git a/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m b/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m index 331631be1..2b3a6aafd 100644 --- a/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m +++ b/interfaces/matlab/toolbox/@Kinetics/reactionEqn.m @@ -2,28 +2,24 @@ function e = reactionEqn(a, irxn) % reactionEqn Reaction equation of reaction irxn. % if nargin == 1 - m = nReactions(a); - n = 1; - irxn = [1:m]'; + m = nReactions(a); + n = 1; + irxn = [1:m]'; elseif nargin == 2 - if isa(irxn,'double') - [m, n] = size(irxn); - else - error('reaction number(s) must be numeric'); - end + if isa(irxn,'double') + [m, n] = size(irxn); + else + error('reaction number(s) must be numeric'); + end end if m == 1 & n == 1 - e = kinetics_get(a.id, 31, irxn); % rxnstring(a.id, irxn); + e = kinetics_get(a.id, 31, irxn); % rxnstring(a.id, irxn); else - e = {}; - 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)); - end - end + e = {}; + 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)); + end + end end - - - - diff --git a/interfaces/matlab/toolbox/@Kinetics/rop.m b/interfaces/matlab/toolbox/@Kinetics/rop.m index fa1c33bbf..3399814b8 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop.m @@ -5,16 +5,16 @@ function rop = rop(k) % progress. The first column contains the forward rates of progress, % 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) +% +f = rop_f(k) r = rop_r(k) rop = [f r] if nargout == 0 - figure - set(gcf,'Name','Rates of Progress'); - bar(rop); - xlabel('Reaction Number'); - ylabel('Rate of Progress [kmol/m^3-s]'); - title('Rates of Progress'); - legend('Forward', 'Reverse'); + figure + set(gcf,'Name','Rates of Progress'); + bar(rop); + xlabel('Reaction Number'); + ylabel('Rate of Progress [kmol/m^3-s]'); + title('Rates of Progress'); + legend('Forward', 'Reverse'); end diff --git a/interfaces/matlab/toolbox/@Kinetics/rop_f.m b/interfaces/matlab/toolbox/@Kinetics/rop_f.m index 1a578f1a8..d73a4f36f 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop_f.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop_f.m @@ -10,11 +10,10 @@ function q = rop_f(a) % q = kinetics_get(a.id,11,0); if nargout == 0 - figure - set(gcf,'Name','Rates of Progress') - bar(q) - xlabel('Reaction Number') - ylabel('Forward Rate of Progress [kmol/m^3]') - title('Forward Rates of Progress') + figure + set(gcf,'Name','Rates of Progress') + bar(q) + xlabel('Reaction Number') + ylabel('Forward Rate of Progress [kmol/m^3]') + title('Forward Rates of Progress') end - diff --git a/interfaces/matlab/toolbox/@Kinetics/rop_net.m b/interfaces/matlab/toolbox/@Kinetics/rop_net.m index ac9a42029..1c754f2a6 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop_net.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop_net.m @@ -10,11 +10,10 @@ function q = rop_net(a) % q = kinetics_get(a.id,13,0); if nargout == 0 - figure - set(gcf,'Name','Rates of Progress') - bar(q) - xlabel('Reaction Number') - ylabel('Net Rate of Progress [kmol/m^3]') - title('Net Rates of Progress') + figure + set(gcf,'Name','Rates of Progress') + bar(q) + xlabel('Reaction Number') + ylabel('Net Rate of Progress [kmol/m^3]') + title('Net Rates of Progress') end - diff --git a/interfaces/matlab/toolbox/@Kinetics/rop_r.m b/interfaces/matlab/toolbox/@Kinetics/rop_r.m index 7cc3fb907..abce56868 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rop_r.m +++ b/interfaces/matlab/toolbox/@Kinetics/rop_r.m @@ -5,9 +5,8 @@ function q = rop_r(a) % % Returns a column vector of the reverse rates of progress % for all reactions. The value is zero for irreversible -% reactions. +% reactions. % % See also: rop_r, rop_net. % q = kinetics_get(a.id,12,0); - diff --git a/interfaces/matlab/toolbox/@Kinetics/rxnEqs.m b/interfaces/matlab/toolbox/@Kinetics/rxnEqs.m index 76697557b..77c0fcf38 100644 --- a/interfaces/matlab/toolbox/@Kinetics/rxnEqs.m +++ b/interfaces/matlab/toolbox/@Kinetics/rxnEqs.m @@ -1,29 +1,25 @@ function e = rxnEqs(a, irxn) -% rxnEqs +% rxnEqs % if nargin == 1 - m = nReactions(a); - n = 1; - irxn = [1:m]' + m = nReactions(a); + n = 1; + irxn = [1:m]' elseif nargin == 2 - if isa(irxn,'double') - [m, n] = size(irxn); - else - error('reaction number(s) must be numeric'); - end + if isa(irxn,'double') + [m, n] = size(irxn); + else + error('reaction number(s) must be numeric'); + end end if m == 1 & n == 1 - e = rxnstring(a.id, irxn); + e = rxnstring(a.id, irxn); else - e = {}; - for i = 1:m - for j = 1:n - e{i,j} = rxnstring(a.id, irxn(i,j)); - end - end + e = {}; + for i = 1:m + for j = 1:n + e{i,j} = rxnstring(a.id, irxn(i,j)); + end + end end - - - - diff --git a/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m b/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m index f3d9890e1..dd2893db4 100644 --- a/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m +++ b/interfaces/matlab/toolbox/@Kinetics/setMultiplier.m @@ -7,18 +7,16 @@ function setMultiplier(a,irxn,v) % see also: MULTIPLIER % if nargin == 2 - v = irxn; - m = nReactions(a); - irxn = [1:m]'; - n = 1; + v = irxn; + m = nReactions(a); + irxn = [1:m]'; + n = 1; else - [m, n] = size(irxn); + [m, n] = size(irxn); end for jm = 1:m - for jn = 1:n - kinetics_set(a.id,1,irxn(jm,jn),v); - end + for jn = 1:n + 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 39631d4e3..84f4c536a 100644 --- a/interfaces/matlab/toolbox/@Kinetics/stoich_net.m +++ b/interfaces/matlab/toolbox/@Kinetics/stoich_net.m @@ -21,10 +21,10 @@ function nu = stoich_net(a,species,rxns) % See also: stoich_r, stoich_p. % if nargin == 1 - nu = stoich_p(a) - stoich_r(a) + 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(['syntax error. Type ''help stoich_net'' for more' ... + ' information.']) end diff --git a/interfaces/matlab/toolbox/@Kinetics/stoich_p.m b/interfaces/matlab/toolbox/@Kinetics/stoich_p.m index 3909df001..0c2b5d0f9 100644 --- a/interfaces/matlab/toolbox/@Kinetics/stoich_p.m +++ b/interfaces/matlab/toolbox/@Kinetics/stoich_p.m @@ -23,21 +23,21 @@ nr =nReactions(a); b = sparse(nsp,nr); f = @kinetics_get; if nargin == 1 - kvals = 1:nsp; - ivals = 1:nr; + kvals = 1:nsp; + ivals = 1:nr; elseif nargin == 3 - kvals = species; - ivals = rxns; + kvals = species; + ivals = rxns; else - error('Syntax error. type ''help stoich_r'' for more information.') + error('Syntax error. type ''help stoich_r'' for more information.') end for k = kvals - for i = ivals - nu = feval(f,a.id,6,i,k); - if nu ~= 0.0 - b(k,i) = nu; + for i = ivals + nu = feval(f,a.id,6,i,k); + if nu ~= 0.0 + b(k,i) = nu; + end end - end end -nu_p = b; \ No newline at end of file +nu_p = b; diff --git a/interfaces/matlab/toolbox/@Kinetics/stoich_r.m b/interfaces/matlab/toolbox/@Kinetics/stoich_r.m index ee5ebd39f..1828495ec 100644 --- a/interfaces/matlab/toolbox/@Kinetics/stoich_r.m +++ b/interfaces/matlab/toolbox/@Kinetics/stoich_r.m @@ -23,21 +23,21 @@ nr =nReactions(a); b = sparse(nsp,nr); f = @kinetics_get; if nargin == 1 - kvals = 1:nsp; - ivals = 1:nr; + kvals = 1:nsp; + ivals = 1:nr; elseif nargin == 3 - kvals = species; - ivals = rxns; + kvals = species; + ivals = rxns; else - error('Syntax error. type ''help stoich_r'' for more information.') + error('Syntax error. type ''help stoich_r'' for more information.') end for k = kvals - for i = ivals - nu = feval(f,a.id,5,i,k); - if nu ~= 0.0 - b(k,i) = nu; + for i = ivals + nu = feval(f,a.id,5,i,k); + if nu ~= 0.0 + b(k,i) = nu; + end end - end end -nu_r = b; \ No newline at end of file +nu_r = b; diff --git a/interfaces/matlab/toolbox/@Kinetics/ydot.m b/interfaces/matlab/toolbox/@Kinetics/ydot.m index d90c5571b..6c2be7ded 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); \ No newline at end of file +v = kinetics_get(a.id,24,0); diff --git a/interfaces/matlab/toolbox/@Mixture/Mixture.m b/interfaces/matlab/toolbox/@Mixture/Mixture.m index 2a27d34aa..fffb76868 100644 --- a/interfaces/matlab/toolbox/@Mixture/Mixture.m +++ b/interfaces/matlab/toolbox/@Mixture/Mixture.m @@ -5,7 +5,7 @@ function m = Mixture(phases) % Class Mixture represents % mixtures of one or more phases of matter. To construct a mixture, % supply a cell array of phases and mole numbers: -% +% % >> gas = importPhase('gas.cti'); % >> graphite = importPhase('graphite.cti'); % >> mix = Mixture({gas, 1.0; graphite, 0.1}); @@ -29,7 +29,7 @@ function m = Mixture(phases) % objects whenever it requires phase properties. % if nargin > 1 - error('Mixture: wrong number of arguments'); + error('Mixture: wrong number of arguments'); end % create an empty mixture @@ -40,22 +40,19 @@ m = class(m,'Mixture'); % if phases are supplied, add them if nargin == 1 - 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'); - end - for n = 1:np - addPhase(m, phases{n,1}, phases{n,2}); - end - setTemperature(m, temperature(phases{n,1})); - setPressure(m, pressure(phases{n,1})); + 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'); + end + for n = 1:np + addPhase(m, phases{n,1}, phases{n,2}); + end + setTemperature(m, temperature(phases{n,1})); + setPressure(m, pressure(phases{n,1})); end - - - diff --git a/interfaces/matlab/toolbox/@Mixture/addPhase.m b/interfaces/matlab/toolbox/@Mixture/addPhase.m index 6eff96515..ee91e1eab 100644 --- a/interfaces/matlab/toolbox/@Mixture/addPhase.m +++ b/interfaces/matlab/toolbox/@Mixture/addPhase.m @@ -1,21 +1,21 @@ function addPhase(self, phase, moles) % ADDPHASE - Add a phase to the mixture. % -% carbon = importPhase('graphite.cti'); +% carbon = importPhase('graphite.cti'); % 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 1fa900830..6fd0ab7b6 100644 --- a/interfaces/matlab/toolbox/@Mixture/display.m +++ b/interfaces/matlab/toolbox/@Mixture/display.m @@ -1,8 +1,8 @@ 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))]; - disp(s); - display(self.phases{n,1}); + s = [sprintf('\n******************* Phase %d', n) ... + sprintf(' ******************************\n\n Moles: %12.6g', phaseMoles(self,n))]; + disp(s); + display(self.phases{n,1}); end diff --git a/interfaces/matlab/toolbox/@Mixture/elementIndex.m b/interfaces/matlab/toolbox/@Mixture/elementIndex.m index 40a80f929..550b1eeea 100644 --- a/interfaces/matlab/toolbox/@Mixture/elementIndex.m +++ b/interfaces/matlab/toolbox/@Mixture/elementIndex.m @@ -1,5 +1,4 @@ function n = elementIndex(self, name) % ELEMENTINDEX - index of element with name 'name' -% +% n = mixturemethods(22, mix_hndl(self), name); - diff --git a/interfaces/matlab/toolbox/@Mixture/equilibrate.m b/interfaces/matlab/toolbox/@Mixture/equilibrate.m index 04fde1593..0d06a31f8 100644 --- a/interfaces/matlab/toolbox/@Mixture/equilibrate.m +++ b/interfaces/matlab/toolbox/@Mixture/equilibrate.m @@ -1,5 +1,5 @@ function r = equilibrate(self, XY, err, maxsteps, maxiter, ... - loglevel) + loglevel) % % EQUILIBRATE - Set the mixture to a state of chemical equilibrium. % @@ -15,29 +15,29 @@ function r = equilibrate(self, XY, err, maxsteps, maxiter, ... % other than "TP" is specified, then an outer iteration loop is % used to adjust T and/or P so that the specified property % values are obtained. -% +% % XY - Two-letter string specifying the two properties to hold % fixed. Currently, 'TP', 'HP', and 'SP' are % implemented. Default: 'TP'. -% +% % err - Error tolerance. Iteration will continue until (Delta % mu)/RT is less than this value for each reaction. Default: % 1.0e-9. Note that this default is very conservative, and good % equilibrium solutions may be obtained with larger error % tolerances. -% +% % maxsteps - Maximum number of steps to take while solving the % equilibrium problem for specified T and P. Default: 1000. -% +% % maxiter - Maximum number of temperature and/or pressure % iterations. This is only relevant if a property pair other % than (T,P) is specified. Default: 200. -% +% % loglevel - Controls the amount of diagnostic output. If % loglevel = 0, no diagnostic output is written. For values > 0, % more detailed information is written to the log file as % loglevel increases. The default is loglevel = 0. -% +% % The logfile is written in HTML format, and may be viewed with % any web browser. The default log file name is % "equilibrium_log.html", but if this file exists, the log @@ -47,24 +47,24 @@ function r = equilibrate(self, XY, err, maxsteps, maxiter, ... % times, multiple log files will be written, with names % "equilibrate_log.html", "equilibrate_log1.html", % "equilibrate_log2.html", and so on. Existing log files will -% not be overwritten. -% +% not be overwritten. +% % >> equilibrate(mix, 'TP') % >> equilibrate('TP', 1.0e-6, 500) -% +% if nargin < 6 - loglevel = 0; + loglevel = 0; end -if nargin < 5 - maxiter = 200; +if nargin < 5 + maxiter = 200; end if nargin < 4 - maxsteps = 1000; + maxsteps = 1000; end if nargin < 3 - err = 1.0e-9; + err = 1.0e-9; end if nargin < 2 - XY = 'TP'; + XY = 'TP'; end r = mixturemethods(31, mix_hndl(self), XY, err, maxsteps, maxiter, loglevel); diff --git a/interfaces/matlab/toolbox/@Mixture/mix_hndl.m b/interfaces/matlab/toolbox/@Mixture/mix_hndl.m index 0e32fedb3..5a1436ca7 100644 --- a/interfaces/matlab/toolbox/@Mixture/mix_hndl.m +++ b/interfaces/matlab/toolbox/@Mixture/mix_hndl.m @@ -1,6 +1,4 @@ function i = mix_hndl(self) % MIX_HNDL - integer used to access kernel object -% +% i = self.mixindex; - - diff --git a/interfaces/matlab/toolbox/@Mixture/nElements.m b/interfaces/matlab/toolbox/@Mixture/nElements.m index 0c2ba5de1..2a967de9b 100644 --- a/interfaces/matlab/toolbox/@Mixture/nElements.m +++ b/interfaces/matlab/toolbox/@Mixture/nElements.m @@ -1,5 +1,4 @@ function n = nElements(self) % NELEMENTS - number of elements -% +% n = mixturemethods(21, mix_hndl(self)); - diff --git a/interfaces/matlab/toolbox/@Mixture/nPhases.m b/interfaces/matlab/toolbox/@Mixture/nPhases.m index 49d8b89fb..04803a7fb 100644 --- a/interfaces/matlab/toolbox/@Mixture/nPhases.m +++ b/interfaces/matlab/toolbox/@Mixture/nPhases.m @@ -1,5 +1,4 @@ function n = nPhases(self) % NPHASES - number of phases -% +% n = mixturemethods(19, mix_hndl(self)); - diff --git a/interfaces/matlab/toolbox/@Mixture/nSpecies.m b/interfaces/matlab/toolbox/@Mixture/nSpecies.m index e747a5aa9..989d44077 100644 --- a/interfaces/matlab/toolbox/@Mixture/nSpecies.m +++ b/interfaces/matlab/toolbox/@Mixture/nSpecies.m @@ -1,5 +1,4 @@ function n = nSpecies(self) % NSPECIES - number of species -% +% n = mixturemethods(24, mix_hndl(self)); - diff --git a/interfaces/matlab/toolbox/@Mixture/phaseMoles.m b/interfaces/matlab/toolbox/@Mixture/phaseMoles.m index 487178a2b..5e06e656c 100644 --- a/interfaces/matlab/toolbox/@Mixture/phaseMoles.m +++ b/interfaces/matlab/toolbox/@Mixture/phaseMoles.m @@ -1,15 +1,14 @@ function moles = phaseMoles(self, n) % PHASEMOLES - moles of phase number 'n' (kmol). -% +% if nargin == 2 - moles = mixturemethods(28, mix_hndl(self), n); + moles = mixturemethods(28, mix_hndl(self), n); elseif nargin == 1 np = nPhases(self); for n = 1:np - m(n) = mixturemethods(28, mix_hndl(self), n); + m(n) = mixturemethods(28, mix_hndl(self), n); end moles = m; else - error('wrong number of arguments'); + error('wrong number of arguments'); end - diff --git a/interfaces/matlab/toolbox/@Mixture/pressure.m b/interfaces/matlab/toolbox/@Mixture/pressure.m index 84dda17ee..d254a5504 100644 --- a/interfaces/matlab/toolbox/@Mixture/pressure.m +++ b/interfaces/matlab/toolbox/@Mixture/pressure.m @@ -1,5 +1,4 @@ function n = pressure(self) % PRESSURE - pressure (Pa) -% +% n = mixturemethods(26, mix_hndl(self)); - diff --git a/interfaces/matlab/toolbox/@Mixture/private/mixturemethods.m b/interfaces/matlab/toolbox/@Mixture/private/mixturemethods.m index 8978e7337..5d47e20ea 100644 --- a/interfaces/matlab/toolbox/@Mixture/private/mixturemethods.m +++ b/interfaces/matlab/toolbox/@Mixture/private/mixturemethods.m @@ -1,17 +1,17 @@ function v = mixturemethods(n, job, a, b, c, d, e, f) -% +% if nargin == 2 - v = ctmethods(120, n, job); + v = ctmethods(120, n, job); elseif nargin == 3 - v = ctmethods(120, n, job, a); + v = ctmethods(120, n, job, a); elseif nargin == 4 - v = ctmethods(120, n, job, a, b); + v = ctmethods(120, n, job, a, b); elseif nargin == 5 - v = ctmethods(120, n, job, a, b, c); + v = ctmethods(120, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(120, n, job, a, b, c, d); + v = ctmethods(120, n, job, a, b, c, d); elseif nargin == 7 - v = ctmethods(120, n, job, a, b, c, d, e); + v = ctmethods(120, n, job, a, b, c, d, e); elseif nargin == 8 - v = ctmethods(120, n, job, a, b, c, d, e, f); -end \ No newline at end of file + v = ctmethods(120, n, job, a, b, c, d, e, f); +end diff --git a/interfaces/matlab/toolbox/@Mixture/setPhaseMoles.m b/interfaces/matlab/toolbox/@Mixture/setPhaseMoles.m index a91c801ad..70b494d79 100644 --- a/interfaces/matlab/toolbox/@Mixture/setPhaseMoles.m +++ b/interfaces/matlab/toolbox/@Mixture/setPhaseMoles.m @@ -1,7 +1,5 @@ function setPhaseMoles(self, n, moles) % SETPHASEMOLES - set the number of moles of phase number 'n' to % 'moles' (kmol). -% +% mixturemethods(7, mix_hndl(self), n, moles); - - diff --git a/interfaces/matlab/toolbox/@Mixture/setPressure.m b/interfaces/matlab/toolbox/@Mixture/setPressure.m index 066fb30af..d3a586e7d 100644 --- a/interfaces/matlab/toolbox/@Mixture/setPressure.m +++ b/interfaces/matlab/toolbox/@Mixture/setPressure.m @@ -1,6 +1,4 @@ function setPressure(self, P) % SETPRESSURE - set the mixture pressure (Pa) -% +% mixturemethods(6, mix_hndl(self), P); - - diff --git a/interfaces/matlab/toolbox/@Mixture/setSpeciesMoles.m b/interfaces/matlab/toolbox/@Mixture/setSpeciesMoles.m index f519863bb..15383475e 100644 --- a/interfaces/matlab/toolbox/@Mixture/setSpeciesMoles.m +++ b/interfaces/matlab/toolbox/@Mixture/setSpeciesMoles.m @@ -6,7 +6,5 @@ function setSpeciesMoles(self, moles) % phase, and unspecified species are set to zero. % % >> setSpeciesMoles(mix, 'C(s):1.0, CH4:2.0, O2:0.2'); -% +% mixturemethods(8, mix_hndl(self), moles); - - diff --git a/interfaces/matlab/toolbox/@Mixture/setTemperature.m b/interfaces/matlab/toolbox/@Mixture/setTemperature.m index a4aef15e9..c0e0e726e 100644 --- a/interfaces/matlab/toolbox/@Mixture/setTemperature.m +++ b/interfaces/matlab/toolbox/@Mixture/setTemperature.m @@ -1,6 +1,4 @@ function setTemperature(self, T) % SETTEMPERATURE - set the mixture temperature -% +% mixturemethods(5, mix_hndl(self), T); - - diff --git a/interfaces/matlab/toolbox/@Mixture/speciesIndex.m b/interfaces/matlab/toolbox/@Mixture/speciesIndex.m index e005f9ecc..e8ea3837d 100644 --- a/interfaces/matlab/toolbox/@Mixture/speciesIndex.m +++ b/interfaces/matlab/toolbox/@Mixture/speciesIndex.m @@ -1,5 +1,4 @@ function n = speciesIndex(self, k, p) % SPECIESINDEX - index of species with name 'name' -% +% n = mixturemethods(23, mix_hndl(self), k, p); - diff --git a/interfaces/matlab/toolbox/@Mixture/temperature.m b/interfaces/matlab/toolbox/@Mixture/temperature.m index 9d1f25388..e7c953fb7 100644 --- a/interfaces/matlab/toolbox/@Mixture/temperature.m +++ b/interfaces/matlab/toolbox/@Mixture/temperature.m @@ -1,5 +1,4 @@ function n = temperature(self) % TEMPERATURE - temperature (K) -% +% n = mixturemethods(25, mix_hndl(self)); - diff --git a/interfaces/matlab/toolbox/@Reactor/Reactor.m b/interfaces/matlab/toolbox/@Reactor/Reactor.m index c672e8aad..c98938d01 100644 --- a/interfaces/matlab/toolbox/@Reactor/Reactor.m +++ b/interfaces/matlab/toolbox/@Reactor/Reactor.m @@ -4,7 +4,7 @@ function x = Reactor(contents, typ) % A Reactor object simulates a perfectly-stirred reactor. It has % a time-dependent state, and may be coupled to other reactors % through flow lines or through walls that may expand or -% contract and/or conduct heat. +% contract and/or conduct heat. % % r1 = Reactor % an empty reactor % r2 = Reactor(gas) % a reactor containing a gas @@ -12,24 +12,21 @@ function x = Reactor(contents, typ) % See also: Reservoir % if nargin == 0 - contents = 0; - typ = 2; + contents = 0; + typ = 2; elseif nargin == 1 - typ = 2; + typ = 2; elseif nargin > 2 - error('too many arguments'); + error('too many arguments'); end x.index = reactormethods(0,typ); if x.index < 0 - error(geterr); + error(geterr); end x.contents = contents; x = class(x,'Reactor'); if isa(contents,'Solution') - insert(x, contents); + insert(x, contents); end - - - diff --git a/interfaces/matlab/toolbox/@Reactor/advance.m b/interfaces/matlab/toolbox/@Reactor/advance.m index 2a4310949..93f925ab3 100644 --- a/interfaces/matlab/toolbox/@Reactor/advance.m +++ b/interfaces/matlab/toolbox/@Reactor/advance.m @@ -1,5 +1,5 @@ function advance(r, tout) -% ADVANCE - Advance the state of the reactor in time. +% ADVANCE - Advance the state of the reactor in time. % % Method advance integrates the system of ordinary differential % equations that determine the rate of change of the reactor @@ -7,7 +7,7 @@ function advance(r, tout) % integration is carried out from the current reactor time to time % 'tout.' (Note 'tout' is an absolute time, not a time interval.) The % integrator may take many internal time steps before reaching -% tout. +% tout. % % for i in 1:10 % tout = 0.1*i diff --git a/interfaces/matlab/toolbox/@Reactor/clear.m b/interfaces/matlab/toolbox/@Reactor/clear.m index 921177729..89f15641a 100644 --- a/interfaces/matlab/toolbox/@Reactor/clear.m +++ b/interfaces/matlab/toolbox/@Reactor/clear.m @@ -1,5 +1,4 @@ function clear(r) -% CLEAR - -% +% CLEAR - +% reactormethods(2, reactor_hndl(r)); - diff --git a/interfaces/matlab/toolbox/@Reactor/density.m b/interfaces/matlab/toolbox/@Reactor/density.m index 9ae85dee2..5f7de3cf4 100644 --- a/interfaces/matlab/toolbox/@Reactor/density.m +++ b/interfaces/matlab/toolbox/@Reactor/density.m @@ -1,4 +1,4 @@ function rho = density(r) % DENSITY - density -% +% rho = reactormethods(25, reactor_hndl(r)); diff --git a/interfaces/matlab/toolbox/@Reactor/enthalpy_mass.m b/interfaces/matlab/toolbox/@Reactor/enthalpy_mass.m index 945cc72d4..ef1ac7b69 100644 --- a/interfaces/matlab/toolbox/@Reactor/enthalpy_mass.m +++ b/interfaces/matlab/toolbox/@Reactor/enthalpy_mass.m @@ -1,12 +1,12 @@ function h = enthalpy_mass(r) % ENTHALPY_MASS - the specific enthalpy [J/kg]. -% +% % h = enthalpy_mass(r) % % returns the specific enthalpy of the reactor contents at the % end of the last call to 'advance' or 'step.' % % See also: Reactor/intEnergy_mass, Reactor/entropy_mass, -% Reactor/enthalpy_mole +% Reactor/enthalpy_mole % h = reactormethods(27, reactor_hndl(r)); diff --git a/interfaces/matlab/toolbox/@Reactor/insert.m b/interfaces/matlab/toolbox/@Reactor/insert.m index f4e7277b5..1c4d978d8 100644 --- a/interfaces/matlab/toolbox/@Reactor/insert.m +++ b/interfaces/matlab/toolbox/@Reactor/insert.m @@ -1,8 +1,6 @@ function insert(r, gas) % INSERT - insert a mixture into the reactor -% +% r.contents = gas; setThermoMgr(r, gas); setKineticsMgr(r, gas); - - diff --git a/interfaces/matlab/toolbox/@Reactor/intEnergy_mass.m b/interfaces/matlab/toolbox/@Reactor/intEnergy_mass.m index 1ec99b75e..f5f01270b 100644 --- a/interfaces/matlab/toolbox/@Reactor/intEnergy_mass.m +++ b/interfaces/matlab/toolbox/@Reactor/intEnergy_mass.m @@ -1,12 +1,12 @@ function u = intEnergy_mass(r) % INTENERGY_MASS - the specific internal energy [J/kg]. -% +% % u = intEnergy_mass(r) % % returns the specific internal energy of the reactor contents at % the end of the last call to 'advance' or 'step.' % % See also: Reactor/enthalpy_mass, Reactor/entropy_mass, -% Reactor/enthalpy_mole -% +% Reactor/enthalpy_mole +% u = reactormethods(28, reactor_hndl(r)); diff --git a/interfaces/matlab/toolbox/@Reactor/mass.m b/interfaces/matlab/toolbox/@Reactor/mass.m index 1ec85c620..52f274b46 100644 --- a/interfaces/matlab/toolbox/@Reactor/mass.m +++ b/interfaces/matlab/toolbox/@Reactor/mass.m @@ -1,5 +1,4 @@ function m = mass(r) -% MASS - -% +% MASS - +% m = reactormethods(23, reactor_hndl(r)); - diff --git a/interfaces/matlab/toolbox/@Reactor/massFraction.m b/interfaces/matlab/toolbox/@Reactor/massFraction.m index ad6ecc93c..51e51b2dd 100644 --- a/interfaces/matlab/toolbox/@Reactor/massFraction.m +++ b/interfaces/matlab/toolbox/@Reactor/massFraction.m @@ -1,5 +1,5 @@ function y = massFraction(r, species) -% MASSFRACTION - Mass fraction of species with name 'species'. -% +% MASSFRACTION - Mass fraction of species with name 'species'. +% k = speciesIndex(r.contents, species) - 1; y = reactormethods(30, reactor_hndl(r), k); diff --git a/interfaces/matlab/toolbox/@Reactor/massFractions.m b/interfaces/matlab/toolbox/@Reactor/massFractions.m index 8381ccece..96fa12184 100644 --- a/interfaces/matlab/toolbox/@Reactor/massFractions.m +++ b/interfaces/matlab/toolbox/@Reactor/massFractions.m @@ -1,11 +1,10 @@ function y = massFractions(r) % MASSFRACTION - Mass fractions of reactor contents after last call -% to 'advance' or 'step'. -% +% to 'advance' or 'step'. +% nsp = nSpecies(r.contents); ir = reactor_hndl(r); for k = 1:nsp - yy(k) = reactormethods(30, ir, k-1); + yy(k) = reactormethods(30, ir, k-1); end y = yy; - diff --git a/interfaces/matlab/toolbox/@Reactor/pressure.m b/interfaces/matlab/toolbox/@Reactor/pressure.m index a97dc663f..1e262ec0b 100644 --- a/interfaces/matlab/toolbox/@Reactor/pressure.m +++ b/interfaces/matlab/toolbox/@Reactor/pressure.m @@ -1,4 +1,4 @@ function p = pressure(r) % PRESSURE - pressure -% +% p = reactormethods(29, reactor_hndl(r)); diff --git a/interfaces/matlab/toolbox/@Reactor/private/reactormethods.m b/interfaces/matlab/toolbox/@Reactor/private/reactormethods.m index 5c4b9b7f6..4fa794e6d 100644 --- a/interfaces/matlab/toolbox/@Reactor/private/reactormethods.m +++ b/interfaces/matlab/toolbox/@Reactor/private/reactormethods.m @@ -1,13 +1,13 @@ function v = reactormethods(n, job, a, b, c, d) -% +% if nargin == 2 - v = ctmethods(60, n, job); + v = ctmethods(60, n, job); elseif nargin == 3 - v = ctmethods(60, n, job, a); + v = ctmethods(60, n, job, a); elseif nargin == 4 - v = ctmethods(60, n, job, a, b); + v = ctmethods(60, n, job, a, b); elseif nargin == 5 - v = ctmethods(60, n, job, a, b, c); + v = ctmethods(60, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(60, n, job, a, b, c, d); -end \ No newline at end of file + v = ctmethods(60, n, job, a, b, c, d); +end diff --git a/interfaces/matlab/toolbox/@Reactor/setEnergy.m b/interfaces/matlab/toolbox/@Reactor/setEnergy.m index d8714e479..88d620e4f 100644 --- a/interfaces/matlab/toolbox/@Reactor/setEnergy.m +++ b/interfaces/matlab/toolbox/@Reactor/setEnergy.m @@ -3,22 +3,22 @@ function setEnergy(f, flag) % energy equation is disabled, then the reactor temperature is % constant. The parameter should be the string 'on' to enable the % energy equation, or 'off' to disable it. -% +% % By default, Reactor objects are created with the energy equation % enabled, so usually this method is only needed to disable the % energy equation for isothermal simulations. % % >>> setEnergy(r, 'on'); % >>> setEnergy(r, 'off'); -% +% iflag = -1 if strcmp(flag,{'on'}) - iflag = 1; + iflag = 1; elseif strcmp(flag,{'off'}) - iflag = 0; + iflag = 0; end if iflag >= 0 - reactormethods(9, f.index, iflag) + reactormethods(9, f.index, iflag) else - error('input to setEnergy not understood'); + error('input to setEnergy not understood'); end diff --git a/interfaces/matlab/toolbox/@Reactor/setInitialTime.m b/interfaces/matlab/toolbox/@Reactor/setInitialTime.m index 7ff0c934e..1a83b7906 100644 --- a/interfaces/matlab/toolbox/@Reactor/setInitialTime.m +++ b/interfaces/matlab/toolbox/@Reactor/setInitialTime.m @@ -1,5 +1,4 @@ function setInitialTime(r, t0) % SETINITIALTIME - set the initial time. Deprecated. -% +% reactormethods(5, reactor_hndl(r), t0); - diff --git a/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m b/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m index ee0b3fe3c..f78e0682b 100644 --- a/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m +++ b/interfaces/matlab/toolbox/@Reactor/setInitialVolume.m @@ -1,5 +1,4 @@ function setInitialVolume(r, t0) -% SETINITIALVOLUME - -% +% SETINITIALVOLUME - +% reactormethods(4, reactor_hndl(r), t0); - diff --git a/interfaces/matlab/toolbox/@Reactor/setKineticsMgr.m b/interfaces/matlab/toolbox/@Reactor/setKineticsMgr.m index 15c85ff63..873e6f661 100644 --- a/interfaces/matlab/toolbox/@Reactor/setKineticsMgr.m +++ b/interfaces/matlab/toolbox/@Reactor/setKineticsMgr.m @@ -4,8 +4,7 @@ function setKineticsMgr(r, k) % called by users. % if ~isa(k,'Kinetics') - error('wrong object type'); + error('wrong object type'); end reactormethods(7, reactor_hndl(r), kinetics_hndl(k)); - diff --git a/interfaces/matlab/toolbox/@Reactor/setThermoMgr.m b/interfaces/matlab/toolbox/@Reactor/setThermoMgr.m index f2d8ecfad..ab07272ca 100644 --- a/interfaces/matlab/toolbox/@Reactor/setThermoMgr.m +++ b/interfaces/matlab/toolbox/@Reactor/setThermoMgr.m @@ -2,8 +2,7 @@ function setThermoMgr(r, t) % SETTHERMOMGR - set the thermo manager % if ~isa(t,'ThermoPhase') - error('wrong object type'); + error('wrong object type'); end reactormethods(6, reactor_hndl(r), thermo_hndl(t)); - diff --git a/interfaces/matlab/toolbox/@Reactor/step.m b/interfaces/matlab/toolbox/@Reactor/step.m index 4e299682c..d4e4a410d 100644 --- a/interfaces/matlab/toolbox/@Reactor/step.m +++ b/interfaces/matlab/toolbox/@Reactor/step.m @@ -1,11 +1,11 @@ function t = step(r, tout) % STEP - Take one internal time step toward tout. -% +% % The integrator used to integrate the ODEs (CVODE) takes % variable-size steps, chosen so that a specified error % tolerance is maintained. At times when the solution is rapidly % changing, the time step becomes smaller to resolve the -% solution. +% solution. % % Method 'step' takes one internal time step and returns. This % can be useful when it is desired to resolve a rapidly-changing @@ -25,4 +25,3 @@ function t = step(r, tout) % See also: Reactor/advance % t = reactormethods(21, reactor_hndl(r), tout); - diff --git a/interfaces/matlab/toolbox/@Reactor/temperature.m b/interfaces/matlab/toolbox/@Reactor/temperature.m index 07e1b0053..e99ccaebc 100644 --- a/interfaces/matlab/toolbox/@Reactor/temperature.m +++ b/interfaces/matlab/toolbox/@Reactor/temperature.m @@ -1,5 +1,4 @@ function t = temperature(r) % TEMPERATURE - temperature -% +% t = reactormethods(26, reactor_hndl(r)); - diff --git a/interfaces/matlab/toolbox/@Reactor/time.m b/interfaces/matlab/toolbox/@Reactor/time.m index d6943d4f6..7db5f4595 100644 --- a/interfaces/matlab/toolbox/@Reactor/time.m +++ b/interfaces/matlab/toolbox/@Reactor/time.m @@ -1,4 +1,4 @@ function t = time(r) % TIME - time -% +% t = reactormethods(22, reactor_hndl(r)); diff --git a/interfaces/matlab/toolbox/@Reactor/volume.m b/interfaces/matlab/toolbox/@Reactor/volume.m index 2febc87ae..aa2b15906 100644 --- a/interfaces/matlab/toolbox/@Reactor/volume.m +++ b/interfaces/matlab/toolbox/@Reactor/volume.m @@ -1,4 +1,4 @@ function v = volume(r) % VOLUME - volume -% +% v = reactormethods(24, reactor_hndl(r)); diff --git a/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m b/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m index fd94174aa..90cbccf14 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m +++ b/interfaces/matlab/toolbox/@ReactorNet/ReactorNet.m @@ -2,23 +2,23 @@ function x = ReactorNet(reactors) % REACTOR - Create a ReactorNet object. % % A ReactorNet object is a container that holds one or more -% Reactor objects. +% Reactor objects. % if nargin == 1 else - error('wrong number of arguments to ReactorNet constructor'); + error('wrong number of arguments to ReactorNet constructor'); end x.index = reactornetmethods(0,0); if x.index < 0 - error(geterr); + error(geterr); end 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/@ReactorNet/advance.m b/interfaces/matlab/toolbox/@ReactorNet/advance.m index 6bd7be98e..1b59b6c99 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/advance.m +++ b/interfaces/matlab/toolbox/@ReactorNet/advance.m @@ -1,5 +1,5 @@ function advance(n, tout) -% ADVANCE - Advance the state of the reactor network in time. +% ADVANCE - Advance the state of the reactor network in time. % % Method advance integrates the system of ordinary differential % equations that determine the rate of change of the volume, the diff --git a/interfaces/matlab/toolbox/@ReactorNet/atol.m b/interfaces/matlab/toolbox/@ReactorNet/atol.m index 388cd3145..f93415961 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/atol.m +++ b/interfaces/matlab/toolbox/@ReactorNet/atol.m @@ -1,5 +1,5 @@ function t = atol(r) % ATOL - absolute error tolerance -% +% t = reactornetmethods(24, reactornet_hndl(r)); diff --git a/interfaces/matlab/toolbox/@ReactorNet/private/reactornetmethods.m b/interfaces/matlab/toolbox/@ReactorNet/private/reactornetmethods.m index 6adfd86f7..241fb726d 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/private/reactornetmethods.m +++ b/interfaces/matlab/toolbox/@ReactorNet/private/reactornetmethods.m @@ -1,13 +1,13 @@ function v = reactornetmethods(n, job, a, b, c, d) -% +% if nargin == 2 - v = ctmethods(65, n, job); + v = ctmethods(65, n, job); elseif nargin == 3 - v = ctmethods(65, n, job, a); + v = ctmethods(65, n, job, a); elseif nargin == 4 - v = ctmethods(65, n, job, a, b); + v = ctmethods(65, n, job, a, b); elseif nargin == 5 - v = ctmethods(65, n, job, a, b, c); + v = ctmethods(65, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(65, n, job, a, b, c, d); -end \ No newline at end of file + v = ctmethods(65, n, job, a, b, c, d); +end diff --git a/interfaces/matlab/toolbox/@ReactorNet/rtol.m b/interfaces/matlab/toolbox/@ReactorNet/rtol.m index 6cf9e7690..22423698c 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/rtol.m +++ b/interfaces/matlab/toolbox/@ReactorNet/rtol.m @@ -1,5 +1,4 @@ function t = rtol(r) % RTOL - relative error tolerance -% +% t = reactornetmethods(23, reactornet_hndl(r)); - diff --git a/interfaces/matlab/toolbox/@ReactorNet/setInitialTime.m b/interfaces/matlab/toolbox/@ReactorNet/setInitialTime.m index 12cd32669..052fe71e2 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/setInitialTime.m +++ b/interfaces/matlab/toolbox/@ReactorNet/setInitialTime.m @@ -1,7 +1,7 @@ function setInitialTime(r, t) % SETINITIALTIME - Set the initial time at which to begin the time -% integration. -% +% integration. +% % If the time integration has already begun, this restarts the % integrator using the current solution as the initial condition, % setting the time to 't'. diff --git a/interfaces/matlab/toolbox/@ReactorNet/setMaxTimeStep.m b/interfaces/matlab/toolbox/@ReactorNet/setMaxTimeStep.m index 3ea28a02d..8ae99c71c 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/setMaxTimeStep.m +++ b/interfaces/matlab/toolbox/@ReactorNet/setMaxTimeStep.m @@ -1,6 +1,6 @@ function setMaxTimeStep(r, maxstep) % SETMAXTIMESTEP - Set the maximum time step. -% +% % The integrator chooses a step size based on the desired error % tolerances and the rate at which the solution is changing. In % some cases, the solution changes very slowly at first, then very diff --git a/interfaces/matlab/toolbox/@ReactorNet/step.m b/interfaces/matlab/toolbox/@ReactorNet/step.m index 13ebe1380..c5c86c670 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/step.m +++ b/interfaces/matlab/toolbox/@ReactorNet/step.m @@ -1,11 +1,11 @@ function t = step(r, tout) % STEP - Take one internal time step toward tout. -% +% % The integrator used to integrate the ODEs (CVODE) takes % variable-size steps, chosen so that a specified error % tolerance is maintained. At times when the solution is rapidly % changing, the time step becomes smaller to resolve the -% solution. +% solution. % % Method 'step' takes one internal time step and returns. This % can be useful when it is desired to resolve a rapidly-changing @@ -25,4 +25,3 @@ function t = step(r, tout) % See also: Reactor/advance % t = reactornetmethods(21, reactornet_hndl(r), tout); - diff --git a/interfaces/matlab/toolbox/@ReactorNet/time.m b/interfaces/matlab/toolbox/@ReactorNet/time.m index b93b94564..e51f7253f 100644 --- a/interfaces/matlab/toolbox/@ReactorNet/time.m +++ b/interfaces/matlab/toolbox/@ReactorNet/time.m @@ -1,5 +1,4 @@ function t = time(r) % TIME - current value of the time. -% +% t = reactornetmethods(22, reactornet_hndl(r)); - diff --git a/interfaces/matlab/toolbox/@Solution/Solution.m b/interfaces/matlab/toolbox/@Solution/Solution.m index 3cc477ae7..7e446f1c4 100644 --- a/interfaces/matlab/toolbox/@Solution/Solution.m +++ b/interfaces/matlab/toolbox/@Solution/Solution.m @@ -29,9 +29,9 @@ function s = Solution(src, id) % doc = XML_Node('doc',src); if nargin == 1 - node = findByName(doc,'phase'); + node = findByName(doc,'phase'); else - node = findByID(doc,id); + node = findByID(doc,id); end t = ThermoPhase(node); k = Kinetics(node,t); diff --git a/interfaces/matlab/toolbox/@Solution/clear.m b/interfaces/matlab/toolbox/@Solution/clear.m index 27723ae8c..777502203 100644 --- a/interfaces/matlab/toolbox/@Solution/clear.m +++ b/interfaces/matlab/toolbox/@Solution/clear.m @@ -1,9 +1,7 @@ function clear(s) -% CLEAR - Delete the kernel object. +% CLEAR - Delete the kernel object. % clear(s.th); clear(s.kin); disp('Solution.clear: skipping clearing the transport object... check this!') -%clear(s.tr); - - +%clear(s.tr); diff --git a/interfaces/matlab/toolbox/@Solution/set.m b/interfaces/matlab/toolbox/@Solution/set.m index c7226c4c1..c312b9025 100644 --- a/interfaces/matlab/toolbox/@Solution/set.m +++ b/interfaces/matlab/toolbox/@Solution/set.m @@ -1,8 +1,8 @@ function a = set(a,varargin) % SET - Set properties. % -% The properties that may be set are -% +% The properties that may be set are +% % Temperature (T) % Density (Rho) % Volume (V) @@ -13,7 +13,7 @@ function a = set(a,varargin) % MassFractions (Y) % Vapor Fraction (Vapor) % Liquid Fractio (Liquid) -% +% % Either the full property name or the symbol may be % specified. For the extensive properties (V,H,U,S), the values % must be given per unit mass. H, U, and S must be set in @@ -39,7 +39,7 @@ function a = set(a,varargin) property_argin = varargin; tval = -999; pval = -999; -hval = -999; +hval = -999; uval = -999; sval = -999; vval = -999; @@ -56,119 +56,119 @@ nu = 0; nq = 0; while length(property_argin) >= 2, - prop = property_argin{1}; - val = property_argin{2}; - property_argin = property_argin(3:end); - switch prop - case 'Temperature' - nt = nt + 1; - tval = val; - case 'T' - nt = nt + 1; - tval = val; - case 'Density' - nv = nv + 1; - vval = 1.0/val; - case 'Rho' - nv = nv + 1; - vval = 1.0/val; - case 'V' - nv = nv + 1; - vval = val; - case 'MoleFractions' - nx = nx + 1; - setMoleFractions(a,val); - case 'X' - nx = nx + 1; - setMoleFractions(a,val); - case 'MassFractions' - ny = ny + 1; - setMassFractions(a,val); - case 'Y' - ny = ny + 1; - setMassFractions(a,val); - case 'Pressure' - pval = val; - np = np + 1; - case 'P' - pval = val; - np = np + 1; - case 'Enthalpy' - hval = val; - nh = nh + 1; - case 'H' - hval = val; - nh = nh + 1; - case 'IntEnergy' - uval = val; - nu = nu + 1; - case 'U' - uval = val; - nu = nu + 1; - case 'Entropy' - sval = val; - ns = ns + 1; - case 'S' - sval = val; - ns = ns + 1; - case 'Sat' - qval = val; - nq = nq + 1; - case 'Vapor' - qval = val; - nq = nq + 1; - case 'Liquid' - qval = 1.0 - val; - nq = nq + 1; - otherwise - error(['unknown property ' char(prop)]) - end + prop = property_argin{1}; + val = property_argin{2}; + property_argin = property_argin(3:end); + switch prop + case 'Temperature' + nt = nt + 1; + tval = val; + case 'T' + nt = nt + 1; + tval = val; + case 'Density' + nv = nv + 1; + vval = 1.0/val; + case 'Rho' + nv = nv + 1; + vval = 1.0/val; + case 'V' + nv = nv + 1; + vval = val; + case 'MoleFractions' + nx = nx + 1; + setMoleFractions(a,val); + case 'X' + nx = nx + 1; + setMoleFractions(a,val); + case 'MassFractions' + ny = ny + 1; + setMassFractions(a,val); + case 'Y' + ny = ny + 1; + setMassFractions(a,val); + case 'Pressure' + pval = val; + np = np + 1; + case 'P' + pval = val; + np = np + 1; + case 'Enthalpy' + hval = val; + nh = nh + 1; + case 'H' + hval = val; + nh = nh + 1; + case 'IntEnergy' + uval = val; + nu = nu + 1; + case 'U' + uval = val; + nu = nu + 1; + case 'Entropy' + sval = val; + ns = ns + 1; + case 'S' + sval = val; + ns = ns + 1; + case 'Sat' + qval = val; + nq = nq + 1; + case 'Vapor' + qval = val; + nq = nq + 1; + case 'Liquid' + qval = 1.0 - val; + nq = nq + 1; + otherwise + error(['unknown property ' char(prop)]) + end end if nx + ny > 1 - error('composition specified multiple times'); + error('composition specified multiple times'); end ntot = nt + np + nv + ns + nh + nu + nq; if ntot == 1 - % - % set T, v, or P individually - % - if nt == 1 - setTemperature(a,tval); % density held fixed - elseif nv == 1 - setDensity(a,1.0/vval); % temperature held fixed - elseif np == 1 - setPressure(a, pval); % temperature held fixed - else - error('pressure, volume, or density must also be specified'); - end -elseif ntot == 2 - % - % set property pairs - % - if nt == 1 & nv == 1 - setTemperature(a,tval); - setDensity(a,1.0/vval); - elseif nt == 1 & np == 1 - setTemperature(a,tval); - setPressure(a, pval); - elseif nt == 1 & nq == 1 - setState_Tsat(a, [tval,qval]); - elseif np == 1 & nq == 1 - setState_Psat(a, [pval,qval]); - elseif np == 1 & nh == 1 - setState_HP(a,[hval,pval]); - elseif nu == 1 & nv == 1 - setState_UV(a,[uval,vval]); - elseif ns == 1 & np == 1 - setState_SP(a,[sval,pval]); - elseif ns == 1 & nv == 1 - setState_SV(a,[sval,vval]); - else - error('unimplemented property pair'); - end + % + % set T, v, or P individually + % + if nt == 1 + setTemperature(a,tval); % density held fixed + elseif nv == 1 + setDensity(a,1.0/vval); % temperature held fixed + elseif np == 1 + setPressure(a, pval); % temperature held fixed + else + error('pressure, volume, or density must also be specified'); + end +elseif ntot == 2 + % + % set property pairs + % + if nt == 1 & nv == 1 + setTemperature(a,tval); + setDensity(a,1.0/vval); + elseif nt == 1 & np == 1 + setTemperature(a,tval); + setPressure(a, pval); + elseif nt == 1 & nq == 1 + setState_Tsat(a, [tval,qval]); + elseif np == 1 & nq == 1 + setState_Psat(a, [pval,qval]); + elseif np == 1 & nh == 1 + setState_HP(a,[hval,pval]); + elseif nu == 1 & nv == 1 + setState_UV(a,[uval,vval]); + elseif ns == 1 & np == 1 + setState_SP(a,[sval,pval]); + elseif ns == 1 & nv == 1 + setState_SV(a,[sval,vval]); + else + error('unimplemented property pair'); + end elseif ntot > 2 - error('too many properties specified'); + error('too many properties specified'); end diff --git a/interfaces/matlab/toolbox/@Solution/soundspeed.m b/interfaces/matlab/toolbox/@Solution/soundspeed.m index 2648c3481..cfd564935 100644 --- a/interfaces/matlab/toolbox/@Solution/soundspeed.m +++ b/interfaces/matlab/toolbox/@Solution/soundspeed.m @@ -2,17 +2,17 @@ function b = soundspeed(a) % SOUNDSPEED - Speed of sound (m/s). if isIdealGas(a) - gamma = cp_mass(a)/cv_mass(a); - wtm = meanMolecularWeight(a); - r = gasconstant/wtm; - b = sqrt(gamma * r * temperature(a)); + gamma = cp_mass(a)/cv_mass(a); + wtm = meanMolecularWeight(a); + r = gasconstant/wtm; + b = sqrt(gamma * r * temperature(a)); else - rho0 = density(a); - p0 = pressure(a); - s0 = entropy_mass(a); - rho1 = 1.001*rho0; - set(gas,'Density',rho1,'Entropy',s0); - p1 = pressure(a); - dpdrho_s = (p1 - p0)/(rho1 - rho0); - b = sqrt(dpdrho_s); + rho0 = density(a); + p0 = pressure(a); + s0 = entropy_mass(a); + rho1 = 1.001*rho0; + set(gas,'Density',rho1,'Entropy',s0); + p1 = pressure(a); + dpdrho_s = (p1 - p0)/(rho1 - rho0); + b = sqrt(dpdrho_s); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m b/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m index 7bb775a9d..0aea31fde 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/ThermoPhase.m @@ -2,22 +2,22 @@ function t = ThermoPhase(r) %THERMOPHASE Cantera ThermoPhase class constructor % if nargin == 1 - if isa(r,'ThermoPhase') - % create a copy - t = r; - return - elseif isa(r,'XML_Node') - t.owner = 1; - hr = hndl(r); - t.tp_id = thermo_get(hr,0); - if t.tp_id < 0 - error(geterr); - end - else - t.owner = 0; - t.tp_id = r; - end - t = class(t,'ThermoPhase'); + if isa(r,'ThermoPhase') + % create a copy + t = r; + return + elseif isa(r,'XML_Node') + t.owner = 1; + hr = hndl(r); + t.tp_id = thermo_get(hr,0); + if t.tp_id < 0 + error(geterr); + end + else + t.owner = 0; + t.tp_id = r; + end + t = class(t,'ThermoPhase'); else - error('wrong number of arguments'); + error('wrong number of arguments'); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m b/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m index ebbbcec96..279221c8a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/atomicMasses.m @@ -1,4 +1,4 @@ function x = atomicMasses(a) % ATOMICMASSES - Array of element atomic masses [kg/kmol]. -% - x = phase_get(a.tp_id,30); +% +x = phase_get(a.tp_id,30); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m b/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m index d7b4a14d9..bc9a567f8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/chemPotentials.m @@ -1,9 +1,9 @@ function mu = chemPotentials(p) % 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(p.tp_id,34); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/clear.m b/interfaces/matlab/toolbox/@ThermoPhase/clear.m index e69ad8729..bf08abdc8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/clear.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/clear.m @@ -1,5 +1,5 @@ function clear(t) % CLEAR - Delete the kernel object. -% +% thermo_set(t.tp_id,0,10); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m b/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m index 5dca044c8..660f83386 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cp_R.m @@ -1,8 +1,7 @@ function v = cp_R(p) % 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); - +% This method returns an array containing the pure species +% standard-state heat capacities at constant pressure. +% +v = thermo_get(p.tp_id,38); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m index e03ed2957..77923ac11 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cp_mass.m @@ -1,3 +1,3 @@ function v = cp_mass(a) % CP_MASS - Specific heat at constant pressure [J/kg-K]. - v = thermo_get(a.tp_id,13); +v = thermo_get(a.tp_id,13); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m index 4acbd378e..ab6114e4a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cp_mole.m @@ -1,3 +1,3 @@ function v = cp_mole(a) % CP_MOLE - Molar heat capacity at constant pressure [J/kmol-K]. - v = thermo_get(a.tp_id,6); +v = thermo_get(a.tp_id,6); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m b/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m index ebb1d8edf..36fe010a1 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/critDensity.m @@ -1,4 +1,4 @@ function v = critDensity(a) % CRITDENSITY - Critical density [kg/m3]. % - v = thermo_get(a.tp_id,21); +v = thermo_get(a.tp_id,21); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m index e0e3945b7..fd08a9df9 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/critPressure.m @@ -1,4 +1,4 @@ function v = critPressure(a) % CRITPRESSURE - Critical pressure [Pa]. % - v = thermo_get(a.tp_id,20); +v = thermo_get(a.tp_id,20); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m b/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m index e0c9f153f..6f7e27a0d 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/critTemperature.m @@ -1,4 +1,4 @@ function v = critTemperature(a) % CRITTEMPERATURE - Critical temperature [K]. % - v = thermo_get(a.tp_id,19); +v = thermo_get(a.tp_id,19); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m index f9e12826a..a0c0130a3 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cv_mass.m @@ -1,3 +1,3 @@ function v = cv_mass(a) % CV_MASS - Specific heat at constant volume [J/kg-K]. - v = thermo_get(a.tp_id,14); +v = thermo_get(a.tp_id,14); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m index 092594b83..422ef36ec 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/cv_mole.m @@ -1,3 +1,3 @@ function v = cv_mole(a) % CV_MOLE - Molar heat capacity at constant volume [J/kmol-K]. - v = thermo_get(a.tp_id,7); +v = thermo_get(a.tp_id,7); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/density.m b/interfaces/matlab/toolbox/@ThermoPhase/density.m index efab882bc..c1948027a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/density.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/density.m @@ -1,4 +1,4 @@ function rho = density(p) % DENSITY - Mass density [kg/m^3]. -% - rho = phase_get(p.tp_id,2); +% +rho = phase_get(p.tp_id,2); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/display.m b/interfaces/matlab/toolbox/@ThermoPhase/display.m index 43e3c357c..c54572ff3 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/display.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/display.m @@ -1,3 +1,2 @@ function display(self) phase_get(thermo_hndl(self), 15, 1); - diff --git a/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m b/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m index 0d8ff1d24..fceab84e5 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/elementIndex.m @@ -1,7 +1,7 @@ function k = elementIndex(a,name) % ELEMENTINDEX - The element index of the element with name -% 'name'. -% +% 'name'. +% % The index is an integer assigned to each element in sequence as it % is read in from the input file. % @@ -20,13 +20,13 @@ function k = elementIndex(a,name) % if iscell(name) - [m, n] = size(name); - k = zeros(m,n); - for i = 1:m - for j = 1:n - k(i,j) = phase_get(a.tp_id,13,name{i,j}); + [m, n] = size(name); + k = zeros(m,n); + for i = 1:m + for j = 1:n + k(i,j) = phase_get(a.tp_id,13,name{i,j}); + end end - end else - k = phase_get(a.tp_id,13,name); + k = phase_get(a.tp_id,13,name); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/elementName.m b/interfaces/matlab/toolbox/@ThermoPhase/elementName.m index 6148e3f44..28efa0292 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/elementName.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/elementName.m @@ -9,9 +9,7 @@ function nm = elementName(a, m) [mm, nn] = size(m); nm = {}; for i = 1:mm - for j = 1:nn - nm{i,j} = phase_get(a.tp_id, 41, m(i,j)); - end + for j = 1:nn + nm{i,j} = phase_get(a.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 72c7234f3..4d1beb104 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/enthalpies_RT.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/enthalpies_RT.m @@ -1,12 +1,12 @@ function v = enthalpies_RT(p) % ENTHALPIES_RT - Pure species non-dimensional enthalpies. % -% h_rt = enthalpies_RT(phase) -% +% h_rt = enthalpies_RT(phase) +% % sets array h_rt to the array of standard-state species enthalpies % for phase 'phase' divided by RT, where R is the universal gas % constant and T is the temperature. For gaseous species, these % values are ideal gas enthalpies. % -% - v = thermo_get(p.tp_id,32); +% +v = thermo_get(p.tp_id,32); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m index 5c7849471..612899621 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mass.m @@ -1,4 +1,4 @@ function v = enthalpy_mass(a) % ENTHALPY_MASS - Specific enthalpy [J/kg]. % - v = thermo_get(a.tp_id,9); +v = thermo_get(a.tp_id,9); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m index 22cca043d..6cc02921a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/enthalpy_mole.m @@ -1,4 +1,4 @@ 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 b041fe480..c2fa78d7a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/entropies_R.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/entropies_R.m @@ -1,7 +1,7 @@ function v = entropies_R(p) % 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); +% This method returns an array containing the pure species +% standard-state entropies. +% +v = thermo_get(p.tp_id,36); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/eosType.m b/interfaces/matlab/toolbox/@ThermoPhase/eosType.m index 8747a9c60..e19a61cb8 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/eosType.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/eosType.m @@ -3,5 +3,5 @@ function e = eosType(a) % % This method returns an integer flag identifying the type of % equation of state. -% +% e = thermo_get(a.tp_id, 18); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m b/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m index 38edd338b..6987b8c50 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/equilibrate.m @@ -12,40 +12,40 @@ function a = equilibrate(a, xy, solver, rtol, maxsteps, maxiter, loglevel) % minimization solver will be used. If solver < 0 or is % unspecified, the fast solver will be tried first, then if it % fails the other will be tried. -% +% % rtol -- the relative error tolerance. -% +% % maxsteps -- maximum number of steps in composition to take to % find a converged solution. -% +% % maxiter -- for the Gibbs minimization solver only, this % specifies the number of 'outer' iterations on T or P when % some property pair other than TP is specified. -% +% % loglevel -- set to a value > 0 to write diagnostic output to % a file in HTML format. Larger values generate more detailed % information. The file will be named 'equilibrate_log.html.' % Subsequent files will be named 'equilibrate_log1.html', % 'equilibrate_log2.html', etc., so that log files are not % overwritten. -% +% % % use the ChemEquil solver by default if nargin < 3 - solver = -1; + solver = -1; end if nargin < 4 - rtol = 1.0e-9; + rtol = 1.0e-9; end if nargin < 5 - maxsteps = 1000; + maxsteps = 1000; end if nargin < 6 - maxiter = 100; + maxiter = 100; end if nargin < 7 - loglevel = 0; + loglevel = 0; end iok = 0; @@ -60,7 +60,7 @@ iok = thermo_set(a.tp_id, 50, xy, solver, rtol, maxsteps, maxiter, loglevel); % $$$ case 'SP' % $$$ iok = thermo_set(a.tp_id, 50, 102, solver, rtol, maxsteps, loglevel); % $$$ case 'SV' -% $$$ iok = thermo_set(a.tp_id, 50, 107, solver, rtol, maxsteps, loglevel); +% $$$ iok = thermo_set(a.tp_id, 50, 107, solver, rtol, maxsteps, loglevel); % $$$ case 'UV' % $$$ iok = thermo_set(a.tp_id, 50, 105, solver, rtol, maxsteps, loglevel); % $$$ case 'PT' @@ -72,17 +72,17 @@ iok = thermo_set(a.tp_id, 50, xy, solver, rtol, maxsteps, maxiter, loglevel); % $$$ case 'PS' % $$$ iok = thermo_set(a.tp_id, 50, 102, solver, rtol, maxsteps, loglevel); % $$$ case 'VS' -% $$$ iok = thermo_set(a.tp_id, 50, 107, solver, rtol, maxsteps, loglevel); +% $$$ iok = thermo_set(a.tp_id, 50, 107, solver, rtol, maxsteps, loglevel); % $$$ case 'VU' -% $$$ iok = thermo_set(a.tp_id, 50, 105, solver, rtol, maxsteps, loglevel); +% $$$ iok = thermo_set(a.tp_id, 50, 105, solver, rtol, maxsteps, loglevel); % $$$ otherwise % $$$ error('unsupported option') % $$$ end if iok < 0 - e = geterr; - if e == 0 - e = 'unknown error'; - end - error(e); + e = geterr; + if e == 0 + e = 'unknown error'; + end + error(e); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m index b6ac1b187..78b082c58 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_RT.m @@ -1,8 +1,7 @@ function g_RT = gibbs_RT(p) % GIBBS_RT - Species non-dimensional Gibbs free energies. -% +% % This method returns an array containing the pure species -% standard-state Gibbs free energies. +% standard-state Gibbs free energies. % g_RT = enthalpies_RT(g) - entropies_R(g); - diff --git a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m index 0e268fda7..a6c587d2c 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mass.m @@ -1,3 +1,3 @@ function v = gibbs_mass(a) % GIBBS_MASS - Specific Gibbs function [J/kg]. - v = thermo_get(a.tp_id,12); +v = thermo_get(a.tp_id,12); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m index 604d260e2..9f35c223b 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/gibbs_mole.m @@ -1,3 +1,3 @@ function v = gibbs_mole(a) % GIBBS_MOLE - Molar Gibbs function [J/kmol]. - v = thermo_get(a.tp_id,5); +v = thermo_get(a.tp_id,5); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m index 93697d3ee..50aff6bf6 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mass.m @@ -1,3 +1,3 @@ function v = intEnergy_mass(a) % INTENERGY_MASS - Specific internal energy [J/kg]. - v = thermo_get(a.tp_id,10); +v = thermo_get(a.tp_id,10); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mole.m b/interfaces/matlab/toolbox/@ThermoPhase/intEnergy_mole.m index 568558c7a..fbf5bf3ae 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) % INTENERGY_MOLE - Molar internal energy [J/kmol]. - v = thermo_get(a.tp_id,3); +v = thermo_get(a.tp_id,3); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m b/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m index 516bcff4d..b1f8234f7 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/isIdealGas.m @@ -2,8 +2,8 @@ function v = isIdealGas(a) % ISIDEALGAS - True if the phase is an ideal gas or ideal gas % mixture, and false otherwise. % - if eosType(a) == 1 - v = 1; +if eosType(a) == 1 + v = 1; else - v = 0; + v = 0; end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m b/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m index 34b1dbb45..90dbaed50 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/massFraction.m @@ -3,17 +3,17 @@ function y = massFraction(s, species) y = 0.0; yarray = massFractions(s); if isa(species,'char') - k = speciesIndex(s, species); - if k > 0 - y = yarray(k); - end + k = speciesIndex(s, species); + if k > 0 + y = yarray(k); + end elseif isa(species,'cell') - n = length(species); - for j = 1:n - k = speciesIndex(s, species{j}); - if k > 0 - y(j) = yarray(k); + n = length(species); + for j = 1:n + k = speciesIndex(s, species{j}); + if k > 0 + y(j) = yarray(k); + end end - end end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m index 7887e4697..0dd5b2ad7 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/massFractions.m @@ -6,12 +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); - if nargout == 0 +x = phase_get(a.tp_id,21); +if nargout == 0 figure set(gcf,'Name','Mass Fractions') bar(x) xlabel('Species Number') ylabel('Mass Fraction') title('Species Mass Fractions') - end \ No newline at end of file +end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m b/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m index 2380cecae..7ad60e7aa 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/maxTemp.m @@ -1,6 +1,6 @@ function v = maxTemp(p) % MAXTEMP - Maximum temperature. -% +% % The parameterizations used to represent the temperature-dependent % species thermodynamic properties are generally only valid in some % finite temperature range, which may be different for each species @@ -8,5 +8,5 @@ function v = maxTemp(p) % the parameterizations are valid for all species in the phase. % % See also: minTemp -% - v = thermo_get(p.tp_id,17); +% +v = thermo_get(p.tp_id,17); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m b/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m index a9a6392de..e35e602ae 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/meanMolarMass.m @@ -5,4 +5,3 @@ function wtm = meanMolarMass(p) % molar masses of the individual species in the phase. % wtm = phase_get(p.tp_id,4); - \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m b/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m index faee89b0d..19f73acd9 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/meanMolecularWeight.m @@ -1,9 +1,9 @@ function wtm = meanMolecularWeight(p) -% MEANMOLECULARWEIGHT - Mean molecular weight. +% MEANMOLECULARWEIGHT - Mean molecular weight. % % This method is a synonym for method meanMolarMass and is % provided for backward compatibility. % % See also; meanMolarMass % - wtm = meanMolarMass(p); \ No newline at end of file +wtm = meanMolarMass(p); \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m b/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m index aa51949c1..5fad28579 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/minTemp.m @@ -1,6 +1,6 @@ function v = minTemp(p) % MINTEMP - Minimum temperature. -% +% % The parameterizations used to represent the temperature-dependent % species thermodynamic properties are generally only valid in some % finite temperature range, which may be different for each species @@ -8,6 +8,5 @@ function v = minTemp(p) % the parameterizations are valid for all species in the phase. % % See also: maxTemp -% - v = thermo_get(p.tp_id,16); - +% +v = thermo_get(p.tp_id,16); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m b/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m index 8ab6664d0..117e86d0c 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/molarDensity.m @@ -1,4 +1,4 @@ function n = molarDensity(p) % MOLARDENSITY - Molar density [kmol/m^3]. % - n = phase_get(p.tp_id,3); +n = phase_get(p.tp_id,3); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m b/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m index 390c0281c..4ad4826c4 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/molarMasses.m @@ -1,4 +1,4 @@ function x = molarMasses(a) % MOLARMASSES - Array of species molar masses [kg/kmol]. -% - x = phase_get(a.tp_id,22); +% +x = phase_get(a.tp_id,22); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m b/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m index 1c1f982fa..adf0e5912 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/moleFraction.m @@ -3,17 +3,17 @@ function x = moleFraction(s, species) x = 0.0; xarray = moleFractions(s); if isa(species,'char') - k = speciesIndex(s, species); - if k > 0 - x = xarray(k); - end - -elseif isa(species,'cell') - n = length(species); - for j = 1:n - k = speciesIndex(s, species{j}); - if k > 0 - x(j) = xarray(k); + k = speciesIndex(s, species); + if k > 0 + x = xarray(k); + end + +elseif isa(species,'cell') + n = length(species); + for j = 1:n + k = speciesIndex(s, species{j}); + if k > 0 + x(j) = xarray(k); + end end - end end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m index 8dbaa0169..3529ba044 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/moleFractions.m @@ -6,12 +6,12 @@ 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); - if nargout == 0 +x = phase_get(a.tp_id,20); +if nargout == 0 figure set(gcf,'Name','Mole Fractions') bar(x) xlabel('Species Number') ylabel('Mole Fraction') title('Species Mole Fractions') - end +end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/molecularWeights.m b/interfaces/matlab/toolbox/@ThermoPhase/molecularWeights.m index f073220c6..58d91f399 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/molecularWeights.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/molecularWeights.m @@ -1,9 +1,8 @@ function x = molecularWeights(a) % MOLECULARWEIGHTS - Array of species molar masses [kg/kmol]. -% +% % This method is deprecated - use molarMasses instead. % % See also: molarMasses % - x = molarMasses(a); - +x = molarMasses(a); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m b/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m index 30e1e2e51..154673be2 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/nAtoms.m @@ -1,7 +1,7 @@ function n = nAtoms(a,k,m) % NATOMS - Number of atoms of element m in species k. if nargin == 3 - n = phase_get(a.tp_id,14,k,m); + n = phase_get(a.tp_id,14,k,m); else - error('usage: nAtoms(phase, k, m)') -end \ No newline at end of file + error('usage: nAtoms(phase, k, m)') +end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/nElements.m b/interfaces/matlab/toolbox/@ThermoPhase/nElements.m index 4ec6b7991..259f87373 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/nElements.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/nElements.m @@ -1,4 +1,4 @@ function n = nElements(a) % NELEMENTS - Number of elements in the phase. % -n = phase_get(a.tp_id,10); \ No newline at end of file +n = phase_get(a.tp_id,10); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m b/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m index cec4fb0b4..d5a0fbd94 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/nSpecies.m @@ -1,4 +1,4 @@ function n = nSpecies(a) % NSPECIES - Number of species in the phase. % -n = phase_get(a.tp_id,11); \ No newline at end of file +n = phase_get(a.tp_id,11); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/name.m b/interfaces/matlab/toolbox/@ThermoPhase/name.m index 07942f411..56bd71bf3 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/name.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/name.m @@ -1,6 +1,3 @@ function nm = name(self) -% NAME - user-specified phase name. +% NAME - user-specified phase name. nm = phase_get(thermo_hndl(self), 42); - - - diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m index 5dc316adb..0d963e4b6 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_get.m @@ -1,8 +1,8 @@ -function i = phase_get(n, job, a, b) +function i = phase_get(n, job, a, b) if nargin == 2 - i = ctmethods(30,n,job); + i = ctmethods(30,n,job); elseif nargin == 3 - i = ctmethods(30,n,job,a); + i = ctmethods(30,n,job,a); else - i = ctmethods(30, n, job, a, b); + i = ctmethods(30, n, job, a, b); end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m index 2cbc21eff..0ce4e9010 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/phase_set.m @@ -1,8 +1,8 @@ -function phase_set(n, job, a, b) +function phase_set(n, job, a, b) if nargin == 2 - ctmethods(30,n,-job); + ctmethods(30,n,-job); elseif nargin == 3 - ctmethods(30,n,-job,a); + ctmethods(30,n,-job,a); else - ctmethods(30, n,-job, a, b); + ctmethods(30, n,-job, a, b); end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_get.m b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_get.m index 984282169..8be76892b 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) +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); + i = ctmethods(20, n, job, a, b); end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m index a9f8394ba..516f1c4a6 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/private/thermo_set.m @@ -1,16 +1,16 @@ -function i = thermo_set(n, job, a, b, c, d, e, f) +function i = thermo_set(n, job, a, b, c, d, e, f) 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); elseif nargin == 4 - i = ctmethods(20, n,-job, a, b); + i = ctmethods(20, n,-job, a, b); elseif nargin == 5 - i = ctmethods(20, n,-job, a, b, c); + i = ctmethods(20, n,-job, a, b, c); elseif nargin == 6 - i = ctmethods(20, n,-job, a, b, c, d); + i = ctmethods(20, n,-job, a, b, c, d); elseif nargin == 7 - i = ctmethods(20, n,-job, a, b, c, d, e); + i = ctmethods(20, n,-job, a, b, c, d, e); elseif nargin == 8 - i = ctmethods(20, n,-job, a, b, c, d, e, f); + i = ctmethods(20, n,-job, a, b, c, d, e, f); end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m index 0131adb40..dd194200d 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/satPressure.m @@ -1,3 +1,3 @@ function v = satPressure(a, T) % SATPRESSURE - Saturation pressure for temperature T. - v = thermo_get(a.tp_id,24,T); +v = thermo_get(a.tp_id,24,T); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m b/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m index 0a0b3d473..86b5a2e00 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/satTemperature.m @@ -1,3 +1,3 @@ function v = satTemperature(a, p) % SATTEMPERATURE - Saturation temperature for pressure p. - v = thermo_get(a.tp_id,23,p); +v = thermo_get(a.tp_id,23,p); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/set.m b/interfaces/matlab/toolbox/@ThermoPhase/set.m index 9a2deaca4..cc1b10e77 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/set.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/set.m @@ -6,11 +6,11 @@ while length(property_argin) >= 2, val = property_argin{2}; property_argin = property_argin(3:end); switch prop - case 'Temperature' - phase_set(a.tp_id,1,val); - case 'Density' - phase_set(a.tp_id,2,val); - otherwise - error('Phase properties: Temperature, Density') + case 'Temperature' + phase_set(a.tp_id,1,val); + case 'Density' + phase_set(a.tp_id,2,val); + otherwise + error('Phase properties: Temperature, Density') end -end \ No newline at end of file +end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m b/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m index 9a902187a..de4e2e0cd 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setDensity.m @@ -4,7 +4,7 @@ function a = setDensity(a,rho) % 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); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m b/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m index 83a4ef6da..8960a8c57 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setElectricPotential.m @@ -1,4 +1,4 @@ function a = setElectricPotential(a,phi) % SETELECTRICPOTENTIAL Set the electric potential [V]. % -thermo_set(a.tp_id,2,phi); \ No newline at end of file +thermo_set(a.tp_id,2,phi); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m index 47001616c..5d10be648 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setMassFractions.m @@ -1,7 +1,7 @@ function a = setMassFractions(a, y, norm) % SETMASSFRACTIONS Set the species mass fractions. % -% setMassFractions(a,y) +% setMassFractions(a,y) % % If y is a vector of doubles, this call sets the species mass % fractions to the values in y and then scales them so that they @@ -30,19 +30,18 @@ function a = setMassFractions(a, y, norm) % instead, or call setPressure after calling setMassFractions. % if isa(y,'double') - if nargin == 3 - if strcmp(norm,'nonorm') - phase_set(a.tp_id,23,y); + if nargin == 3 + if strcmp(norm,'nonorm') + phase_set(a.tp_id,23,y); + else + phase_set(a.tp_id,21,y); + end else - phase_set(a.tp_id,21,y); + phase_set(a.tp_id,21,y); end - else - phase_set(a.tp_id,21,y); - end -% -% string input -% + % + % string input + % elseif isa(y,'char') - phase_set(a.tp_id,31,y); + phase_set(a.tp_id,31,y); end - diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m b/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m index 7f332942d..4571c30cb 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setMoleFractions.m @@ -1,7 +1,7 @@ function a = setMoleFractions(a,x,norm) % SETMOLEFRACTIONS Set the species mole fractions. % -% setMoleFractions(a,x) +% setMoleFractions(a,x) % % If x is a vector of doubles, this call sets the species mole % fractions to the values in x and then scales them so that they @@ -30,18 +30,18 @@ function a = setMoleFractions(a,x,norm) % instead, or call setPressure after calling setMoleFractions. if isa(x,'double') - if nargin == 3 - if strcmp(norm,'nonorm') - phase_set(a.tp_id,22,x); + if nargin == 3 + if strcmp(norm,'nonorm') + phase_set(a.tp_id,22,x); + else + phase_set(a.tp_id,20,x); + end else - phase_set(a.tp_id,20,x); + phase_set(a.tp_id,20,x); end - else - phase_set(a.tp_id,20,x); - end -% -% string input -% + % + % string input + % elseif isa(x,'char') - phase_set(a.tp_id,30,x); + phase_set(a.tp_id,30,x); end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setName.m b/interfaces/matlab/toolbox/@ThermoPhase/setName.m index 283583d98..feebd8556 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setName.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setName.m @@ -1,9 +1,8 @@ function setName(self, name) % SETNAME - Set the name of the phase. -% +% if isa(name,'char') - phase_set(thermo_hndl(self), 32, name); + phase_set(thermo_hndl(self), 32, name); else - error('name must be a string.'); + error('name must be a string.'); end - diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m b/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m index cf6e41887..d2dd4220b 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setPressure.m @@ -5,7 +5,7 @@ function a = setPressure(a,p) % 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); \ No newline at end of file +thermo_set(a.tp_id,1,p); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState.m b/interfaces/matlab/toolbox/@ThermoPhase/setState.m index 83b3d2961..3ef8e812a 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) disp('deprecated') if nargin ~= 3 | ~isa(job,'char') - error('Syntax error. Type "help setState" for more information.') + error('Syntax error. Type "help setState" for more information.') end switch job - case 'T' - setTemperature(a,values) - otherwise - error(['unknown flag: ' job]) + case 'T' + 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 257645959..7042e49ab 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_HP.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_HP.m @@ -1,13 +1,13 @@ function a = setState_HP(a,hp) % SETSTATE_HP - Set the specific enthalpy [J/kg] and pressure [Pa]. -% +% % setState_HP(a, hp) sets the specific enthalpy and pressure % of object a, holding its composition fixed. Argument 'hp' must % 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); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_Psat.m index ec7b77190..d81617960 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) % SETSTATE_PSAT Set the fluid to a saturated state at % pressure P -% +% thermo_set(a.tp_id,24,px); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m index fa8899aed..2b14d7696 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_SP.m @@ -1,15 +1,15 @@ function a = setState_SP(a,sp) % SETSTATE_SP Set the specific entropy [J/kg/K] and pressure [Pa]. -% +% % setState_SP(a, sp) sets the specific entropy and pressure % of object a, holding its composition fixed. Argument 'sp' must % 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 pressure must be positive'); + error('the pressure must be positive'); end if sp(2) <= 0.0 - error('the specific entropy must be positive'); + error('the specific entropy must be positive'); end thermo_set(a.tp_id,23,sp); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m index ddbcf4e5d..9c1e25827 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_SV.m @@ -1,16 +1,16 @@ function a = setState_SV(a,sv) % SETSTATE_SV Set the specific entropy [J/kg/K] and specific % volume [m3/kg]. -% +% % setState_SV(a, sv) sets the specific entropy and specific volume % of object a, holding its composition fixed. Argument 'sv' must % 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); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m index 4758aa392..79897fed5 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_Tsat.m @@ -1,5 +1,5 @@ function a = setState_Tsat(a,tx) % SETSTATE_TSAT Set the fluid to a saturated state at % temperature t -% +% thermo_set(a.tp_id,25,tx); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m index 3f425a7a0..5f6f885f2 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_UV.m @@ -1,7 +1,7 @@ function a = setState_UV(a,uv) % SETSTATE_UV Set the specific internal energy [J/kg] and % specific volume [m^3/kg]. -% +% % setState_UV(a, uv) sets the specific internal energy and % specific volume of object a, holding its composition % fixed. Argument 'uv' must be a vector of length 2 containing @@ -9,6 +9,6 @@ function a = setState_UV(a,uv) % 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); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m index 805b7bf7f..22578f508 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_satLiquid.m @@ -1,5 +1,5 @@ function a = setState_satLiquid(a) % SETSTATE_SATLIQUID Set the fluid to the saturated liquid state -% at the current temperature. -% +% at the current temperature. +% thermo_set(a.tp_id,2,0); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m b/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m index ed0cb89f2..33e1c6568 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setState_satVapor.m @@ -1,5 +1,5 @@ function a = setState_satVapor(a) % SETSTATE_SATVAPOR Set the fluid to the saturated vapor state at the -% current temperature. -% +% current temperature. +% thermo_set(a.tp_id,3,0); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m b/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m index e2cdec900..0884f858a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/setTemperature.m @@ -2,6 +2,6 @@ function a = setTemperature(a,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); diff --git a/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m b/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m index ddea97d1e..819f76dc5 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/speciesIndex.m @@ -1,5 +1,5 @@ function k = speciesIndex(a,name) -% SPECIESINDEX - The species index of species with name 'name'. +% SPECIESINDEX - The species index of species with name 'name'. % % The index is an integer assigned to each species in sequence as it % is read in from the input file. @@ -20,13 +20,13 @@ function k = speciesIndex(a,name) % if iscell(name) - [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}); + [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}); + end end - end else - k = phase_get(a.tp_id,12,name); -end \ No newline at end of file + k = phase_get(a.tp_id,12,name); +end diff --git a/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m b/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m index 9d057c6e1..5e6d00e1a 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/speciesName.m @@ -8,9 +8,7 @@ function nm = speciesName(a, k) [m, n] = size(k); nm = {}; for i = 1:m - for j = 1:n - nm{i,j} = phase_get(a.tp_id, 40, k(i,j)); - end + for j = 1:n + nm{i,j} = phase_get(a.tp_id, 40, k(i,j)); + end end - - diff --git a/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m b/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m index 64c4acd3f..c45e38750 100644 --- a/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m +++ b/interfaces/matlab/toolbox/@ThermoPhase/vaporFraction.m @@ -1,5 +1,5 @@ function v = vaporFraction(a) % VAPORFRACTION - Vapor fraction. % If object 'a' represents a liquid/vapor mixture, this method -% returns the vapor fraction. - v = thermo_get(a.tp_id,22); +% returns the vapor fraction. +v = thermo_get(a.tp_id,22); diff --git a/interfaces/matlab/toolbox/@Transport/Transport.m b/interfaces/matlab/toolbox/@Transport/Transport.m index a1cb3abcc..4125e18dc 100644 --- a/interfaces/matlab/toolbox/@Transport/Transport.m +++ b/interfaces/matlab/toolbox/@Transport/Transport.m @@ -2,29 +2,28 @@ function tr = Transport(xml_phase, th, model, loglevel) %TRANSPORT Transport class constructor. % % k = TRANSPORT(model, p, loglevel) creates a transport -% manager for phase object p. +% manager for phase object p. % % The 'model' parameter is a string that specifies the transport % model. The phase object must have already been created. % tr.id = 0; if nargin == 4 - tr.th = th; - if model == 'default' - try - node = child(xml_phase,'transport'); - tr.model = attrib(node,'model'); - catch - tr.model = 'None'; + tr.th = th; + if model == 'default' + try + node = child(xml_phase,'transport'); + tr.model = attrib(node,'model'); + catch + tr.model = 'None'; + end + else + tr.model = model; end - else - tr.model = model; - end - tr.id = trans_get(hndl(th), -1, tr.model, loglevel) ; - tr = class(tr,'Transport'); + tr.id = trans_get(hndl(th), -1, tr.model, loglevel) ; + tr = class(tr,'Transport'); elseif isa(model,'Transport') - tr = model; + tr = model; else - error('syntax error'); + error('syntax error'); end - diff --git a/interfaces/matlab/toolbox/@Transport/binDiffCoeffs.m b/interfaces/matlab/toolbox/@Transport/binDiffCoeffs.m index 2eceb18ed..9a2c31d6b 100644 --- a/interfaces/matlab/toolbox/@Transport/binDiffCoeffs.m +++ b/interfaces/matlab/toolbox/@Transport/binDiffCoeffs.m @@ -1,10 +1,9 @@ function v = binDiffCoeffs(a) %BINDIFFCOEFFS Binary diffusion coefficients (m^2/s). % -% d = binDiffCoeffs(gas) +% d = binDiffCoeffs(gas) % % returns the matrix of binary diffusion coefficients in array % d. The matrix is symmetric: d(i,j) = d(j,i). % v = trans_get(a.id, 21, nSpecies(a.th)); - diff --git a/interfaces/matlab/toolbox/@Transport/mixDiffCoeffs.m b/interfaces/matlab/toolbox/@Transport/mixDiffCoeffs.m index 8ca7074f4..dfa7d1ddb 100644 --- a/interfaces/matlab/toolbox/@Transport/mixDiffCoeffs.m +++ b/interfaces/matlab/toolbox/@Transport/mixDiffCoeffs.m @@ -1,7 +1,7 @@ function v = mixDiffCoeffs(a) %MIXDIFFCOEFFS Mixture-averaged diffusion coefficients (m^2/s). -% -% d = mixDiffCoeffs(gas) +% +% d = mixDiffCoeffs(gas) % % returns in column vector d the mixture-averaged diffusion % coefficients. Object 'gas' must belong to a class derived from @@ -17,4 +17,3 @@ function v = mixDiffCoeffs(a) % gas = GRI30('Mix') % v = trans_get(a.id, 11, nSpecies(a.th)); - diff --git a/interfaces/matlab/toolbox/@Transport/multiDiffCoeffs.m b/interfaces/matlab/toolbox/@Transport/multiDiffCoeffs.m index 4f6cf3cd3..915705443 100644 --- a/interfaces/matlab/toolbox/@Transport/multiDiffCoeffs.m +++ b/interfaces/matlab/toolbox/@Transport/multiDiffCoeffs.m @@ -1,7 +1,7 @@ function v = multiDiffCoeffs(a) %MULTIDIFFCOEFFS Multicomponent diffusion coefficients (m^2/s). -% -% d = multiDiffCoeffs(gas) +% +% d = multiDiffCoeffs(gas) % % returns in d the array of multicomponent diffusion % coefficients. Object 'gas' must belong to a class derived from diff --git a/interfaces/matlab/toolbox/@Transport/private/trans_get.m b/interfaces/matlab/toolbox/@Transport/private/trans_get.m index f3848e593..a7e06fff2 100644 --- a/interfaces/matlab/toolbox/@Transport/private/trans_get.m +++ b/interfaces/matlab/toolbox/@Transport/private/trans_get.m @@ -1,14 +1,14 @@ function v = trans_get(n, job, a, b, c, d) -% TRANS_GET - get transport attributes +% TRANS_GET - get transport attributes % if nargin == 2 - v = ctmethods(50, n, job); + v = ctmethods(50, n, job); elseif nargin == 3 - v = ctmethods(50, n, job, a); + v = ctmethods(50, n, job, a); elseif nargin == 4 - v = ctmethods(50, n, job, a, b); + v = ctmethods(50, n, job, a, b); elseif nargin == 5 - v = ctmethods(50, n, job, a, b, c); + v = ctmethods(50, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(50, n, job, a, b, c, d); + v = ctmethods(50, n, job, a, b, c, d); end diff --git a/interfaces/matlab/toolbox/@Transport/setParameters.m b/interfaces/matlab/toolbox/@Transport/setParameters.m index 8e254aae7..a3d347c9d 100644 --- a/interfaces/matlab/toolbox/@Transport/setParameters.m +++ b/interfaces/matlab/toolbox/@Transport/setParameters.m @@ -1,5 +1,4 @@ function setParameters(tr, type, k, p) % SETPARAMETERS - set parameters. -% +% v = trans_get(tr.id, 31, type, k, p); - diff --git a/interfaces/matlab/toolbox/@Transport/setThermalConductivity.m b/interfaces/matlab/toolbox/@Transport/setThermalConductivity.m index ce698b79a..2f802acad 100644 --- a/interfaces/matlab/toolbox/@Transport/setThermalConductivity.m +++ b/interfaces/matlab/toolbox/@Transport/setThermalConductivity.m @@ -1,9 +1,8 @@ function setThermalConductivity(tr, lam) % SETTHERMALCONDUCTIVITY - Set the thermal conductivity. -% +% % This method can only be used with transport models that % support directly setting the value of the thermal -% conductivity. +% conductivity. % setParameters(tr, 1, 0, lam); - diff --git a/interfaces/matlab/toolbox/@Transport/thermalConductivity.m b/interfaces/matlab/toolbox/@Transport/thermalConductivity.m index 4dddfe2ac..77b5ba19c 100644 --- a/interfaces/matlab/toolbox/@Transport/thermalConductivity.m +++ b/interfaces/matlab/toolbox/@Transport/thermalConductivity.m @@ -1,8 +1,8 @@ function v = thermalConductivity(a) % THERMALCONDUCTIVITY Thermal conductivity in W/m^2/K. v = trans_get(a.id, 2); -if v == -1.0 - error(geterr); +if v == -1.0 + error(geterr); elseif v < 0.0 - error('exception raised'); -end \ No newline at end of file + error('exception raised'); +end diff --git a/interfaces/matlab/toolbox/@Transport/thermalDiffCoeffs.m b/interfaces/matlab/toolbox/@Transport/thermalDiffCoeffs.m index 0d591433f..648063525 100644 --- a/interfaces/matlab/toolbox/@Transport/thermalDiffCoeffs.m +++ b/interfaces/matlab/toolbox/@Transport/thermalDiffCoeffs.m @@ -1,7 +1,7 @@ function v = thermalDiffCoeffs(a) %THERMALDIFFCOEFFS Thermal diffusion coefficients. -% -% dt = thermalDiffCoeffs(gas) +% +% dt = thermalDiffCoeffs(gas) % % returns in column vector dt the thermal diffusion % coefficients. Object 'gas' must belong to a class derived from @@ -10,4 +10,3 @@ function v = thermalDiffCoeffs(a) % all be zero. % v = trans_get(a.id, 12, nSpecies(a.th)); - diff --git a/interfaces/matlab/toolbox/@Transport/viscosity.m b/interfaces/matlab/toolbox/@Transport/viscosity.m index 87a4bd509..d732cebbc 100644 --- a/interfaces/matlab/toolbox/@Transport/viscosity.m +++ b/interfaces/matlab/toolbox/@Transport/viscosity.m @@ -1,8 +1,7 @@ function v = viscosity(a) v = trans_get(a.id, 1); -if v == -1.0 - error(geterr); +if v == -1.0 + error(geterr); elseif v < 0.0 - error('exception raised'); + error('exception raised'); end - diff --git a/interfaces/matlab/toolbox/@Wall/Wall.m b/interfaces/matlab/toolbox/@Wall/Wall.m index d4c6fc054..cab69982e 100644 --- a/interfaces/matlab/toolbox/@Wall/Wall.m +++ b/interfaces/matlab/toolbox/@Wall/Wall.m @@ -1,14 +1,12 @@ function x = Wall(typ) % if nargin == 0 - typ = 1; + typ = 1; end x.index = wallmethods(0,typ); if x.index < 0 - error(geterr); + error(geterr); end x.left = -1; x.right = -1; x = class(x,'Wall'); - - diff --git a/interfaces/matlab/toolbox/@Wall/area.m b/interfaces/matlab/toolbox/@Wall/area.m index d9263e1d4..eab0ded34 100644 --- a/interfaces/matlab/toolbox/@Wall/area.m +++ b/interfaces/matlab/toolbox/@Wall/area.m @@ -1,5 +1,4 @@ function a = area(w) -% AREA - -% +% AREA - +% a = wallmethods(23, wall_hndl(w)) - diff --git a/interfaces/matlab/toolbox/@Wall/install.m b/interfaces/matlab/toolbox/@Wall/install.m index b34ad5590..b42c6e500 100644 --- a/interfaces/matlab/toolbox/@Wall/install.m +++ b/interfaces/matlab/toolbox/@Wall/install.m @@ -1,8 +1,7 @@ function install(w, left, right) -% INSTALL - -% +% INSTALL - +% w.left = left; w.right = right; wallmethods(4, wall_hndl(w), reactor_hndl(left), ... - reactor_hndl(right)); - + reactor_hndl(right)); diff --git a/interfaces/matlab/toolbox/@Wall/private/wallmethods.m b/interfaces/matlab/toolbox/@Wall/private/wallmethods.m index 188f50e9a..fd059cffc 100644 --- a/interfaces/matlab/toolbox/@Wall/private/wallmethods.m +++ b/interfaces/matlab/toolbox/@Wall/private/wallmethods.m @@ -1,13 +1,13 @@ function v = wallmethods(n, job, a, b, c, d) -% +% if nargin == 2 - v = ctmethods(70, n, job); + v = ctmethods(70, n, job); elseif nargin == 3 - v = ctmethods(70, n, job, a); + v = ctmethods(70, n, job, a); elseif nargin == 4 - v = ctmethods(70, n, job, a, b); + v = ctmethods(70, n, job, a, b); elseif nargin == 5 - v = ctmethods(70, n, job, a, b, c); + v = ctmethods(70, n, job, a, b, c); elseif nargin == 6 - v = ctmethods(70, n, job, a, b, c, d); -end \ No newline at end of file + v = ctmethods(70, n, job, a, b, c, d); +end diff --git a/interfaces/matlab/toolbox/@Wall/ready.m b/interfaces/matlab/toolbox/@Wall/ready.m index 25ab582e4..a1fe512c6 100644 --- a/interfaces/matlab/toolbox/@Wall/ready.m +++ b/interfaces/matlab/toolbox/@Wall/ready.m @@ -1,5 +1,4 @@ function ok = ready(w) -% READY - -% +% READY - +% ok = wallmethods(11, wall_hndl(w)); - diff --git a/interfaces/matlab/toolbox/@Wall/setArea.m b/interfaces/matlab/toolbox/@Wall/setArea.m index ede46e58c..cfd6762e8 100644 --- a/interfaces/matlab/toolbox/@Wall/setArea.m +++ b/interfaces/matlab/toolbox/@Wall/setArea.m @@ -1,5 +1,4 @@ function setArea(w, a) -% SETAREA - -% +% SETAREA - +% wallmethods(5, wall_hndl(w), a); - diff --git a/interfaces/matlab/toolbox/@Wall/setExpansionRateCoeff.m b/interfaces/matlab/toolbox/@Wall/setExpansionRateCoeff.m index 66e6bc300..0fd625e30 100644 --- a/interfaces/matlab/toolbox/@Wall/setExpansionRateCoeff.m +++ b/interfaces/matlab/toolbox/@Wall/setExpansionRateCoeff.m @@ -1,5 +1,4 @@ function setExpansionRateCoeff(w, k) -% SETEXPANSIONRATECOEFF - -% +% SETEXPANSIONRATECOEFF - +% wallmethods(9, wall_hndl(w), k); - diff --git a/interfaces/matlab/toolbox/@Wall/setHeatTransferCoeff.m b/interfaces/matlab/toolbox/@Wall/setHeatTransferCoeff.m index eed158c2e..3416ce6e5 100644 --- a/interfaces/matlab/toolbox/@Wall/setHeatTransferCoeff.m +++ b/interfaces/matlab/toolbox/@Wall/setHeatTransferCoeff.m @@ -1,5 +1,4 @@ function setHeatTransferCoeff(w, u) -% SETHEATTRANSFERCOEFF - -% +% SETHEATTRANSFERCOEFF - +% wallmethods(7, wall_hndl(w), u); - diff --git a/interfaces/matlab/toolbox/@Wall/setKinetics.m b/interfaces/matlab/toolbox/@Wall/setKinetics.m index dd78dd3d7..fcbd09ca8 100644 --- a/interfaces/matlab/toolbox/@Wall/setKinetics.m +++ b/interfaces/matlab/toolbox/@Wall/setKinetics.m @@ -1,14 +1,13 @@ function setKinetics(w, left, right) % SETKINETICS - Specify the left and right surface reaction mechanisms. -% +% ileft = 0; iright = 0; if isa(left,'Kinetics') - ileft = kinetics_hndl(left); + ileft = kinetics_hndl(left); end if isa(right,'Kinetics') - iright = kinetics_hndl(right); + iright = kinetics_hndl(right); end wallmethods(12, wall_hndl(w), ileft, iright); - diff --git a/interfaces/matlab/toolbox/@Wall/setThermalResistance.m b/interfaces/matlab/toolbox/@Wall/setThermalResistance.m index 1b9aed568..94d8cbc2b 100644 --- a/interfaces/matlab/toolbox/@Wall/setThermalResistance.m +++ b/interfaces/matlab/toolbox/@Wall/setThermalResistance.m @@ -1,5 +1,4 @@ function setThermalResistance(w, r) -% SETTHERMALRESISTANCE - -% +% SETTHERMALRESISTANCE - +% wallmethods(6, wall_hndl(w), r) - diff --git a/interfaces/matlab/toolbox/@Wall/wall_hndl.m b/interfaces/matlab/toolbox/@Wall/wall_hndl.m index 6d1ed3d96..808b4163d 100644 --- a/interfaces/matlab/toolbox/@Wall/wall_hndl.m +++ b/interfaces/matlab/toolbox/@Wall/wall_hndl.m @@ -1,4 +1,4 @@ function i = wall_hndl(w) -% WALL_HNDL - -% -i = w.index; \ No newline at end of file +% WALL_HNDL - +% +i = w.index; diff --git a/interfaces/matlab/toolbox/@XML_Node/XML_Node.m b/interfaces/matlab/toolbox/@XML_Node/XML_Node.m index d6907e460..d121fa2aa 100644 --- a/interfaces/matlab/toolbox/@XML_Node/XML_Node.m +++ b/interfaces/matlab/toolbox/@XML_Node/XML_Node.m @@ -5,16 +5,15 @@ function x = XML_Node(name, src, wrap) x.id = 0; if nargin == 3 - x.id = wrap; + x.id = wrap; elseif nargin == 2 - % read tree from a file - x.id = ctmethods(10,15,0,src); % newxml(name) - if x.id < 0 - error(geterr); - end + % read tree from a file + x.id = ctmethods(10,15,0,src); % newxml(name) + 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'); - diff --git a/interfaces/matlab/toolbox/@XML_Node/addChild.m b/interfaces/matlab/toolbox/@XML_Node/addChild.m index 77d294abf..573376e13 100644 --- a/interfaces/matlab/toolbox/@XML_Node/addChild.m +++ b/interfaces/matlab/toolbox/@XML_Node/addChild.m @@ -1,3 +1,3 @@ function n = addChild(root, id) -% +% n = ctmethods(10, 10, root.id, id); diff --git a/interfaces/matlab/toolbox/@XML_Node/attrib.m b/interfaces/matlab/toolbox/@XML_Node/attrib.m index d86d93f9b..3b632f5b5 100644 --- a/interfaces/matlab/toolbox/@XML_Node/attrib.m +++ b/interfaces/matlab/toolbox/@XML_Node/attrib.m @@ -1,9 +1,7 @@ function a = attrib(x, key) if nargin ~= 2 | ~isa(key,'char') - error('Syntax error. Type "help attrib" for more information.') + error('Syntax error. Type "help attrib" for more information.') end a = ctmethods(10, 20, x.id, key); - - diff --git a/interfaces/matlab/toolbox/@XML_Node/build.m b/interfaces/matlab/toolbox/@XML_Node/build.m index 280dcf109..e1ec2207a 100644 --- a/interfaces/matlab/toolbox/@XML_Node/build.m +++ b/interfaces/matlab/toolbox/@XML_Node/build.m @@ -1,13 +1,11 @@ function x = build(x, file, pre) if nargin < 2 | ~isa(file,'char') - error('Syntax error. Type "help build" for more information.') + error('Syntax error. Type "help build" for more information.') end if nargin == 3 & pre > 0 - iok = ctmethods(10, 15, x.id, file) + iok = ctmethods(10, 15, x.id, file) else - iok = ctmethods(10, 4, x.id, file) + iok = ctmethods(10, 4, x.id, file) end - - diff --git a/interfaces/matlab/toolbox/@XML_Node/child.m b/interfaces/matlab/toolbox/@XML_Node/child.m index c358cbcc8..72c076fb5 100644 --- a/interfaces/matlab/toolbox/@XML_Node/child.m +++ b/interfaces/matlab/toolbox/@XML_Node/child.m @@ -2,5 +2,3 @@ function v = child(x, loc) id = ctmethods(10, 6, x.id, loc); v = XML_Node('', '', id); - - diff --git a/interfaces/matlab/toolbox/@XML_Node/findByID.m b/interfaces/matlab/toolbox/@XML_Node/findByID.m index bf0fa6e2e..c3ebc8dc1 100644 --- a/interfaces/matlab/toolbox/@XML_Node/findByID.m +++ b/interfaces/matlab/toolbox/@XML_Node/findByID.m @@ -1,6 +1,5 @@ function x = findByID(root, id) % FINDBYID - Find an XML element by ID -% +% index = ctmethods(10, 8, root.id, id); x = XML_Node('','', index); - diff --git a/interfaces/matlab/toolbox/@XML_Node/findByName.m b/interfaces/matlab/toolbox/@XML_Node/findByName.m index b3239347e..5e6a0aa5d 100644 --- a/interfaces/matlab/toolbox/@XML_Node/findByName.m +++ b/interfaces/matlab/toolbox/@XML_Node/findByName.m @@ -1,6 +1,5 @@ function x = findByName(root, name) % FINDBYNAME - Find an XML element by name -% +% index = ctmethods(10, 9, root.id, name); x = XML_Node('','', index); - diff --git a/interfaces/matlab/toolbox/@XML_Node/nChildren.m b/interfaces/matlab/toolbox/@XML_Node/nChildren.m index fd5dd22b0..b8d4bd223 100644 --- a/interfaces/matlab/toolbox/@XML_Node/nChildren.m +++ b/interfaces/matlab/toolbox/@XML_Node/nChildren.m @@ -1,3 +1,3 @@ function n = nChildren(root, id) -% +% n = ctmethods(10, 10, root.id, id); diff --git a/interfaces/matlab/toolbox/@XML_Node/value.m b/interfaces/matlab/toolbox/@XML_Node/value.m index d943dc1a9..62788f41d 100644 --- a/interfaces/matlab/toolbox/@XML_Node/value.m +++ b/interfaces/matlab/toolbox/@XML_Node/value.m @@ -1,13 +1,12 @@ function v = value(x,loc) -% VALUE - value(x) returns the value of the XML element. +% VALUE - value(x) returns the value of the XML element. % value(x, loc) is shorthand for value(child(x,loc)) % if nargin == 2 - c = child(x, loc); - id = c.id; + c = child(x, loc); + id = c.id; else - id = x.id; + id = x.id; end v = ctmethods(10, 21, id); - diff --git a/interfaces/matlab/toolbox/@XML_Node/write.m b/interfaces/matlab/toolbox/@XML_Node/write.m index 5acb3a71f..39034216a 100644 --- a/interfaces/matlab/toolbox/@XML_Node/write.m +++ b/interfaces/matlab/toolbox/@XML_Node/write.m @@ -1,4 +1,3 @@ function write(x, file) ctmethods(10, 13, x.id, file); - diff --git a/interfaces/matlab/toolbox/GRI30.m b/interfaces/matlab/toolbox/GRI30.m index 5d6c0f985..7b0c23f93 100755 --- a/interfaces/matlab/toolbox/GRI30.m +++ b/interfaces/matlab/toolbox/GRI30.m @@ -19,13 +19,13 @@ 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'); - end + if strcmp(tr,'Mix') + s = Solution('gri30.cti','gri30_mix'); + elseif strcmp(tr,'Multi') + s = Solution('gri30.cti','gri30_multi'); + 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 3c20c2215..5b7ad4cad 100644 --- a/interfaces/matlab/toolbox/Hydrogen.m +++ b/interfaces/matlab/toolbox/Hydrogen.m @@ -11,4 +11,3 @@ function n = Hydrogen() % Cantera C++ source code documentation. % n = importPhase('liquidvapor.cti','hydrogen'); - diff --git a/interfaces/matlab/toolbox/IdealGasMix.m b/interfaces/matlab/toolbox/IdealGasMix.m index b7c12a7b3..2e0cf48dd 100755 --- a/interfaces/matlab/toolbox/IdealGasMix.m +++ b/interfaces/matlab/toolbox/IdealGasMix.m @@ -1,8 +1,8 @@ function s = IdealGasMix(a,b,c) % IDEALGASMIX - Create a Solution instance representing an ideal gas mixture. % -% gas1 = IdealGasMix('ctml_file'[,'transport_model']) -% gas2 = IdealGasMix('ck_file'[,'thermo_db'[,'tran_db'[,'transport_model']]]) +% gas1 = IdealGasMix('ctml_file'[,'transport_model']) +% gas2 = IdealGasMix('ck_file'[,'thermo_db'[,'tran_db'[,'transport_model']]]) % % creates an object that represents an ideal gas mixture. The % species in the mixture, their properties, and the reactions among @@ -33,22 +33,22 @@ function s = IdealGasMix(a,b,c) % dotloc = findstr(a,'.'); if dotloc(end) > 1 - ext = a(dotloc(end):end); - if ~strcmp(ext,'.inp') - if nargin == 1 - s = Solution(a); - elseif nargin == 2 - s = Solution(a, b); - end - return - end + ext = a(dotloc(end):end); + if ~strcmp(ext,'.inp') + if nargin == 1 + s = Solution(a); + elseif nargin == 2 + s = Solution(a, b); + end + return + end end if nargin == 1 - b = '-'; - c = '-'; + b = '-'; + c = '-'; elseif nargin == 2 - c = '-'; + c = '-'; end xml = ck2cti(a,b,c); s = Solution(xml); diff --git a/interfaces/matlab/toolbox/MassFlowController.m b/interfaces/matlab/toolbox/MassFlowController.m index 16c00a07e..1e6ae5cf8 100644 --- a/interfaces/matlab/toolbox/MassFlowController.m +++ b/interfaces/matlab/toolbox/MassFlowController.m @@ -3,17 +3,17 @@ function m = MassFlowController(upstream, downstream) % MASSFLOWCONTROLLER - Create a mass flow controller connecting two % reactors / reservoirs. % -% m = MassFlowController(upstream, downstream) +% m = MassFlowController(upstream, downstream) % % creates an instance of class FlowDevice configured to simulate a % mass flow controller that maintains a constant mass flow rate % independent of upstream or downstream conditions. If two reactor % objects are supplied as arguments, the controller is installed -% between the two reactors. +% between the two reactors. % % see also: FlowDevice % m = FlowDevice(1); if nargin == 2 - install(m, upstream, downstream) -end \ No newline at end of file + install(m, upstream, downstream) +end diff --git a/interfaces/matlab/toolbox/Methane.m b/interfaces/matlab/toolbox/Methane.m index cc55c1eaf..96010083d 100644 --- a/interfaces/matlab/toolbox/Methane.m +++ b/interfaces/matlab/toolbox/Methane.m @@ -8,4 +8,3 @@ function n = Methane() % Properties in SI." % n = importPhase('liquidvapor.cti','methane'); - diff --git a/interfaces/matlab/toolbox/Nitrogen.m b/interfaces/matlab/toolbox/Nitrogen.m index 011a086be..b73d2bf87 100644 --- a/interfaces/matlab/toolbox/Nitrogen.m +++ b/interfaces/matlab/toolbox/Nitrogen.m @@ -8,4 +8,3 @@ function n = Nitrogen() % Properties in SI." % n = importPhase('liquidvapor.cti','nitrogen'); - diff --git a/interfaces/matlab/toolbox/Oxygen.m b/interfaces/matlab/toolbox/Oxygen.m index 90d82dea9..b8dda0eba 100644 --- a/interfaces/matlab/toolbox/Oxygen.m +++ b/interfaces/matlab/toolbox/Oxygen.m @@ -8,4 +8,3 @@ function n = Oxygen() % Properties in SI." % n = importPhase('liquidvapor.cti','oxygen'); - diff --git a/interfaces/matlab/toolbox/Reservoir.m b/interfaces/matlab/toolbox/Reservoir.m index cfe648231..e04998487 100644 --- a/interfaces/matlab/toolbox/Reservoir.m +++ b/interfaces/matlab/toolbox/Reservoir.m @@ -8,7 +8,7 @@ function r = Reservoir(contents) % changing the composition or thermodynamic state. Note that even % if the reaction mechanism associated with the fluid in the % reactor defines reactions, they are disabled within -% reservoirs. +% reservoirs. % % r1 = Reservoir % an empty reservoir % r2 = Reservoir(gas) % a reservoir containing a gas @@ -16,6 +16,6 @@ function r = Reservoir(contents) % See also: Reactor % if nargin == 0 - contents = 0; + contents = 0; end r = Reactor(contents, 1); diff --git a/interfaces/matlab/toolbox/Valve.m b/interfaces/matlab/toolbox/Valve.m index 08bcc2e44..901f16d11 100644 --- a/interfaces/matlab/toolbox/Valve.m +++ b/interfaces/matlab/toolbox/Valve.m @@ -2,7 +2,7 @@ function m = Valve(upstream, downstream) % % VALVE - Create a valve connecting two reactors / reservoirs. % -% m = Valve(upstream, downstream) +% m = Valve(upstream, downstream) % % creates an instance of class FlowDevice configured to simulate a % valve that produces a flow rate proportional to the pressure @@ -12,7 +12,7 @@ function m = Valve(upstream, downstream) % % The mass flow rate [kg/s] is computed from the expression % -% mdot = K ( P_upstream - P_downstream ) +% mdot = K ( P_upstream - P_downstream ) % % as long as this produces a positive value. If this expression is % negative, zero is returned. Therefore, the Valve object acts as a @@ -23,10 +23,10 @@ function m = Valve(upstream, downstream) % to be linearly proportional to the mass flow rate, no matter how % large the pressure difference. THIS MAY CHANGE IN A FUTURE % RELEASE. -% +% % see also: FlowDevice, MassFlowController % m = FlowDevice(3); if nargin == 2 - install(m, upstream, downstream) -end \ No newline at end of file + install(m, upstream, downstream) +end diff --git a/interfaces/matlab/toolbox/Water.m b/interfaces/matlab/toolbox/Water.m index 3aa9fdfe9..26af2b1c4 100644 --- a/interfaces/matlab/toolbox/Water.m +++ b/interfaces/matlab/toolbox/Water.m @@ -11,4 +11,3 @@ function w = Water() % Cantera C++ source code documentation. % w = importPhase('liquidvapor.cti','water'); - diff --git a/interfaces/matlab/toolbox/adddir.m b/interfaces/matlab/toolbox/adddir.m index 97dee1dce..729d7d71a 100755 --- a/interfaces/matlab/toolbox/adddir.m +++ b/interfaces/matlab/toolbox/adddir.m @@ -1,7 +1,7 @@ function adddir(d) % ADDDIR Add a directory to the Cantera search path. -% -% adddir('directory') +% +% adddir('directory') % % adds 'directory' to the set of directories where Cantera looks for % input and data files. diff --git a/interfaces/matlab/toolbox/ck2cti.m b/interfaces/matlab/toolbox/ck2cti.m index fa4315ebe..4d2fefafb 100644 --- a/interfaces/matlab/toolbox/ck2cti.m +++ b/interfaces/matlab/toolbox/ck2cti.m @@ -1,6 +1,6 @@ function f = ck2cti(infile, thermo, transport) % CK2CTI - Convert a Chemkin-compatible reaction mechanism file to -% Cantera format. +% Cantera format. % % f = ck2cti('chem.inp') % f = ck2cti('chem.inp', 'therm.dat') @@ -19,40 +19,40 @@ function f = ck2cti(infile, thermo, transport) % set this to zero to turn off mechanism validation validate = 1; -% set this to one to turn on debugging. Use only if ck2cti +% set this to one to turn on debugging. Use only if ck2cti % fails, and you want to see how the parser is parsing the input file. debug = 0; if nargin == 0 - error('input file name must be supplied') + error('input file name must be supplied') elseif nargin == 1 - thermo = '-'; - transport = '-'; + thermo = '-'; + transport = '-'; elseif nargin == 2 transport = '-'; end - + dotloc = findstr(infile,'.'); if dotloc(end) > 1 - idtag = infile(1:dotloc(end)-1); - outfile = [idtag '.cti']; + idtag = infile(1:dotloc(end)-1); + outfile = [idtag '.cti']; else - idtag = infile; - outfile = [infile '.cti']; + idtag = infile; + outfile = [infile '.cti']; end iok = ctmethods(0,1, infile, thermo, transport, idtag, debug, validate); - + %iok = system([prog,' -i ',infile,' -t ',thermo,' -tr ',transport, ... % ' -id ',idtag,' > ',outfile]); if iok - %ierr2 = system([prog,' > log']) - %if ierr2 - % error(['Program ck2cti is not found at ',prog,['. Edit file' ... - % [' ctbin.m to point to the Cantera bin directory.']]]) - % else - error(['Error occurred while running ck2cti. Check file ck2cti.log' ... - ' for error messages.']); - %end + %ierr2 = system([prog,' > log']) + %if ierr2 + % error(['Program ck2cti is not found at ',prog,['. Edit file' ... + % [' ctbin.m to point to the Cantera bin directory.']]]) + % else + error(['Error occurred while running ck2cti. Check file ck2cti.log' ... + ' for error messages.']); + %end end f = outfile; diff --git a/interfaces/matlab/toolbox/ck2ctml.m b/interfaces/matlab/toolbox/ck2ctml.m index 3aef53dc9..47f136be6 100644 --- a/interfaces/matlab/toolbox/ck2ctml.m +++ b/interfaces/matlab/toolbox/ck2ctml.m @@ -1,6 +1,6 @@ function f = ck2ctml(infile, thermo, transport) % CK2CTML - Convert a Chemkin-compatible reaction mechanism file to -% CTML. +% CTML. % % Cantera uses an XML-based file format (CTML) for specifying input % parameters of any type, including specifying reaction mechanism @@ -18,28 +18,28 @@ function f = ck2ctml(infile, thermo, transport) % read from file 'therm.dat.' In the third form, the CTML file % created will also contain transport property parameters. The % function return value is a string containing the output file -% name. +% name. % if nargin == 0 - error('input file name must be supplied') + error('input file name must be supplied') elseif nargin == 1 - thermo = '-'; - transport = '-'; + thermo = '-'; + transport = '-'; elseif nargin == 2 transport = '-'; end - + dotloc = findstr(infile,'.'); if dotloc(end) > 1 - idtag = infile(1:dotloc(end)-1); - outfile = [idtag '.xml']; + idtag = infile(1:dotloc(end)-1); + outfile = [idtag '.xml']; else - idtag = infile; - outfile = [infile '.xml']; + idtag = infile; + outfile = [infile '.xml']; end iok = ctmethods(0, 1, infile, thermo, transport, outfile, idtag); if iok - error(geterr); + error(geterr); end f = outfile; diff --git a/interfaces/matlab/toolbox/cleanup.m b/interfaces/matlab/toolbox/cleanup.m index 5cbe90607..4a7b0d9be 100644 --- a/interfaces/matlab/toolbox/cleanup.m +++ b/interfaces/matlab/toolbox/cleanup.m @@ -1,4 +1,4 @@ function cleanup() -% CLEANUP - Delete all stored Cantera objects and reclaim memory -% +% CLEANUP - Delete all stored Cantera objects and reclaim memory +% ctmethods(0, 4); diff --git a/interfaces/matlab/toolbox/conhp.m b/interfaces/matlab/toolbox/conhp.m index e68a1ef3e..5241cf841 100755 --- a/interfaces/matlab/toolbox/conhp.m +++ b/interfaces/matlab/toolbox/conhp.m @@ -4,7 +4,7 @@ function dydt = conhp(t,y,gas,mw) % Function CONHP evaluates the system of ordinary differential % equations for an adiabatic, constant-pressure, % zero-dimensional reactor. It assumes that the 'gas' object -% represents a reacting ideal gas mixture. +% represents a reacting ideal gas mixture. % Set the state of the gas, based on the current solution vector. @@ -13,15 +13,15 @@ set(gas, 'T', y(1), 'P', pressure(gas), 'Y', y(2:end)); % energy equation wdot = netProdRates(gas); tdot = - temperature(gas) * gasconstant * enthalpies_RT(gas)' ... - * wdot / (density(gas)*cp_mass(gas)); + * wdot / (density(gas)*cp_mass(gas)); % set up column vector for dydt dydt = [ tdot - zeros(53,1) ]; + zeros(53,1) ]; % species equations rrho = 1.0/density(gas); nsp = nSpecies(gas); for i = 1:nsp - dydt(i+1) = rrho*mw(i)*wdot(i); + dydt(i+1) = rrho*mw(i)*wdot(i); end diff --git a/interfaces/matlab/toolbox/conuv.m b/interfaces/matlab/toolbox/conuv.m index 7f35b569d..cc8b1972c 100755 --- a/interfaces/matlab/toolbox/conuv.m +++ b/interfaces/matlab/toolbox/conuv.m @@ -4,7 +4,7 @@ function dydt = conuv(t,y,gas,mw) % Function CONUV evaluates the system of ordinary differential % equations for an adiabatic, constant-volume, % zero-dimensional reactor. It assumes that the 'gas' object -% represents a reacting ideal gas mixture. +% represents a reacting ideal gas mixture. % Set the state of the gas, based on the current solution vector. @@ -14,14 +14,14 @@ nsp = nSpecies(gas); % energy equation wdot = netProdRates(gas); tdot = - temperature(gas) * gasconstant * (enthalpies_RT(gas) - ones(nsp,1))' ... - * wdot / (density(gas)*cv_mass(gas)); + * wdot / (density(gas)*cv_mass(gas)); % set up column vector for dydt dydt = [ tdot - zeros(53,1) ]; + zeros(53,1) ]; % species equations rrho = 1.0/density(gas); for i = 1:nsp - dydt(i+1) = rrho*mw(i)*wdot(i); + dydt(i+1) = rrho*mw(i)*wdot(i); end diff --git a/interfaces/matlab/toolbox/gaussian.m b/interfaces/matlab/toolbox/gaussian.m index c3fabff59..47591460f 100644 --- a/interfaces/matlab/toolbox/gaussian.m +++ b/interfaces/matlab/toolbox/gaussian.m @@ -1,16 +1,13 @@ function g = gaussian(peak, center, width) % % GAUSSIAN - create a Gaussian Func instance -% +% % gaussian(peak, center, width) -% +% % peak - the peak value % center - value of x at which the peak is located % width - full width at half-maximum. The value of the -% function at center +/- (width)/2 is one-half +% function at center +/- (width)/2 is one-half % the peak value. % g = Func('gaussian', 0, [peak, center, width]); - - - diff --git a/interfaces/matlab/toolbox/geterr.m b/interfaces/matlab/toolbox/geterr.m index e06985f3a..ec9187753 100755 --- a/interfaces/matlab/toolbox/geterr.m +++ b/interfaces/matlab/toolbox/geterr.m @@ -1,6 +1,6 @@ function e = geterr try - e = ctmethods(0,2); % getCanteraError; + e = ctmethods(0,2); % getCanteraError; catch - e = ' '; + e = ' '; end \ No newline at end of file diff --git a/interfaces/matlab/toolbox/importEdge.m b/interfaces/matlab/toolbox/importEdge.m index 487978350..d0e27cd84 100644 --- a/interfaces/matlab/toolbox/importEdge.m +++ b/interfaces/matlab/toolbox/importEdge.m @@ -1,14 +1,14 @@ function s = importEdge(file, name, phase1, phase2, phase3, phase4) % IMPORTINTERFACE - import an interface -% +% if nargin == 3 - s = Interface(file, name, phase1); + s = Interface(file, name, phase1); elseif nargin == 4 - s = Interface(file, name, phase1, phase2); + s = Interface(file, name, phase1, phase2); elseif nargin == 5 - s = Interface(file, name, phase1, phase2, phase3); + s = Interface(file, name, phase1, phase2, phase3); elseif nargin == 6 - s = Interface(file, name, phase1, phase2, phase3, phase4); -else - error('importEdge only supports 4 neighbor phases'); + s = Interface(file, name, phase1, phase2, phase3, phase4); +else + error('importEdge only supports 4 neighbor phases'); end diff --git a/interfaces/matlab/toolbox/importInterface.m b/interfaces/matlab/toolbox/importInterface.m index c71b44c22..922317757 100644 --- a/interfaces/matlab/toolbox/importInterface.m +++ b/interfaces/matlab/toolbox/importInterface.m @@ -1,10 +1,10 @@ function s = importInterface(file, name, phase1, phase2) % IMPORTINTERFACE - import an interface -% +% if nargin == 3 - s = Interface(file, name, phase1); + s = Interface(file, name, phase1); elseif nargin == 4 - s = Interface(file, name, phase1, phase2); + s = Interface(file, name, phase1, phase2); else - error('importInterface only supports 2 bulk phases'); + error('importInterface only supports 2 bulk phases'); end diff --git a/interfaces/matlab/toolbox/importPhase.m b/interfaces/matlab/toolbox/importPhase.m index 19bad1cb1..2fc168956 100644 --- a/interfaces/matlab/toolbox/importPhase.m +++ b/interfaces/matlab/toolbox/importPhase.m @@ -1,8 +1,8 @@ function s = importPhase(file, name) % IMPORTPHASE - import a phase from a CTI file -% +% if nargin == 1 - s = Solution(file); -elseif nargin == 2 - s = Solution(file, name); + s = Solution(file); +elseif nargin == 2 + s = Solution(file, name); end diff --git a/interfaces/matlab/toolbox/polynom.m b/interfaces/matlab/toolbox/polynom.m index 5b6f5c0bd..10f19c74f 100644 --- a/interfaces/matlab/toolbox/polynom.m +++ b/interfaces/matlab/toolbox/polynom.m @@ -1,7 +1,7 @@ function poly = polynom(coeffs) % % POLY - create an instance of class 'Func' representing a polynomial. -% +% % The polynomial coefficients are specified by a one-dimensional % array [a0 a1 .... aN]. % @@ -10,10 +10,9 @@ function poly = polynom(coeffs) % [n m] = size(coeffs); if n == 1 - poly = Func('polynomial',m - 1,coeffs); + poly = Func('polynomial',m - 1,coeffs); elseif m == 1 - poly = Func('polynomial',n - 1,coeffs); + poly = Func('polynomial',n - 1,coeffs); else - error('wrong shape for coefficient array'); + error('wrong shape for coefficient array'); end - diff --git a/interfaces/matlab/toolbox/reactor_ode.m b/interfaces/matlab/toolbox/reactor_ode.m index 718d31079..000ae58d7 100644 --- a/interfaces/matlab/toolbox/reactor_ode.m +++ b/interfaces/matlab/toolbox/reactor_ode.m @@ -3,7 +3,7 @@ function dydt = reactor_ode(t,y,gas,vdot,area,heatflux) % % Function REACTOR evaluates the system of ordinary differential % equations for a zero-dimensional reactor with arbitrary heat -% transfer and volume change. +% transfer and volume change. % % Solution vector components: % y(1) Total internal energy U @@ -17,35 +17,34 @@ function dydt = reactor_ode(t,y,gas,vdot,area,heatflux) dydt = zeros(m,n); for j = 1:n - - this_y = y(:,j); - int_energy = this_y(1); - vol = this_y(2); - masses = this_y(3:end); - - % evaluate the total mass, and the specific internal energy and volume. - total_mass = sum(masses); - u_mass = int_energy/total_mass; - v_mass = vol/total_mass; + this_y = y(:,j); + int_energy = this_y(1); + vol = this_y(2); + masses = this_y(3:end); - % set the state of the gas by specifying (u,v,{Y_k}) - setMassFractions(gas,masses); - setState_UV(gas, [u_mass v_mass]); - p = pressure(gas); + % evaluate the total mass, and the specific internal energy and volume. + total_mass = sum(masses); + u_mass = int_energy/total_mass; + v_mass = vol/total_mass; - % volume equation - vdt = feval(vdot, t, vol, gas); + % set the state of the gas by specifying (u,v,{Y_k}) + setMassFractions(gas,masses); + setState_UV(gas, [u_mass v_mass]); + p = pressure(gas); - % energy equation - a = feval(area, t, vol); - q = feval(heatflux, t, gas); - udt = -p * vdt + a * q; + % volume equation + vdt = feval(vdot, t, vol, gas); - % species equations - ydt = total_mass * ydot(gas); + % energy equation + a = feval(area, t, vol); + q = feval(heatflux, t, gas); + udt = -p * vdt + a * q; - % set up column vector for dydt - dydt(:,j) = [ udt - vdt - ydt ]; + % species equations + ydt = total_mass * ydot(gas); + + % set up column vector for dydt + dydt(:,j) = [udt + vdt + ydt ]; end