diff --git a/interfaces/matlab_experimental/Base/Interface.m b/interfaces/matlab_experimental/Base/Interface.m index 0a00474703..a8e462b813 100644 --- a/interfaces/matlab_experimental/Base/Interface.m +++ b/interfaces/matlab_experimental/Base/Interface.m @@ -84,7 +84,7 @@ end function c = get.concentrations(s) - surfID = s.tr_id; + surfID = s.tpID; nsp = s.nSpecies; xx = zeros(1, nsp); pt = libpointer('doublePtr', xx); diff --git a/interfaces/matlab_experimental/Base/ThermoPhase.m b/interfaces/matlab_experimental/Base/ThermoPhase.m index 8f42f53db8..78b7cfc166 100644 --- a/interfaces/matlab_experimental/Base/ThermoPhase.m +++ b/interfaces/matlab_experimental/Base/ThermoPhase.m @@ -66,6 +66,8 @@ % Scalar double mean molecular weight. Units: kg/kmol. meanMolecularWeight + massDensity % Mass basis density. Units: kg/m^3. + molarDensity % Molar basis density. Units: kmol/m^3. molecularWeights % Molecular weights of the species. Units: kg/kmol. @@ -903,6 +905,10 @@ function display(tp) mmw = ctFunc('thermo_meanMolecularWeight', tp.tpID); end + function density = get.massDensity(tp) + density = ctFunc('thermo_density', tp.tpID); + end + function density = get.molarDensity(tp) density = ctFunc('thermo_molarDensity', tp.tpID); end diff --git a/interfaces/matlab_experimental/OneDim/Sim1D.m b/interfaces/matlab_experimental/OneDim/Sim1D.m index 0c41aecefe..156d0c42a1 100644 --- a/interfaces/matlab_experimental/OneDim/Sim1D.m +++ b/interfaces/matlab_experimental/OneDim/Sim1D.m @@ -58,14 +58,9 @@ function delete(s) %% Sim1D Utility Methods - function display(s, fname) + function display(s) % Show all domains. - - if nargin == 1 - fname = '-'; - end - - ctFunc('sim1D_show', s.stID, fname); + ctFunc('sim1D_show', s.stID); end function restore(s, fname, id) diff --git a/interfaces/matlab_experimental/Reactor/ReactorSurface.m b/interfaces/matlab_experimental/Reactor/ReactorSurface.m index b09c94b997..784fb5ab5e 100644 --- a/interfaces/matlab_experimental/Reactor/ReactorSurface.m +++ b/interfaces/matlab_experimental/Reactor/ReactorSurface.m @@ -40,7 +40,7 @@ name = '(none)'; end - s.surfID = ctFunc('reactor_new', 'ReactorSurface', surf.solnID, name); + s@Reactor(surf, 'ReactorSurface', name) ctFunc('reactorsurface_install', s.id, reactor.id); end diff --git a/samples/matlab_experimental/conhp.m b/samples/matlab_experimental/conhp.m index 8483a40d0a..d477682506 100644 --- a/samples/matlab_experimental/conhp.m +++ b/samples/matlab_experimental/conhp.m @@ -6,6 +6,7 @@ % It assumes that the ``gas`` object represents a reacting ideal gas mixture. % Set the state of the gas, based on the current solution vector. + gas.basis = 'mass'; gas.Y = y(2:end); gas.TP = {y(1), gas.P}; nsp = gas.nSpecies; @@ -13,7 +14,6 @@ % energy equation wdot = gas.netProdRates; H = gas.partialMolarEnthalpies'; - gas.basis = 'mass'; tdot =- 1 / (gas.D * gas.cp) .* wdot * H; % set up column vector for dydt diff --git a/samples/matlab_experimental/conuv.m b/samples/matlab_experimental/conuv.m index 84f4768777..b183f25e5b 100644 --- a/samples/matlab_experimental/conuv.m +++ b/samples/matlab_experimental/conuv.m @@ -6,6 +6,7 @@ % It assumes that the ``gas`` object represents a reacting ideal gas mixture. % Set the state of the gas, based on the current solution vector. + gas.basis = 'mass'; gas.Y = y(2:end); gas.TD = {y(1), gas.D}; nsp = gas.nSpecies; @@ -13,7 +14,6 @@ % energy equation wdot = gas.netProdRates; U = gas.partialMolarIntEnergies'; - gas.basis = 'mass'; tdot =- 1 / (gas.D * gas.cv) .* wdot * U; % set up column vector for dydt diff --git a/samples/matlab_experimental/diamond_cvd.m b/samples/matlab_experimental/diamond_cvd.m index 651d4ec6f6..dd9499e5af 100644 --- a/samples/matlab_experimental/diamond_cvd.m +++ b/samples/matlab_experimental/diamond_cvd.m @@ -69,7 +69,7 @@ r = surf_phase.netProdRates; carbon_dot = r(iC); mdot = mw * carbon_dot; - rate = mdot / dbulk.D; + rate = mdot / dbulk.massDensity; xx = [xx; x(ih)]; rr = [rr; rate * 1.0e6 * 3600.0]; cov = [cov; surf_phase.coverages]; diff --git a/samples/matlab_experimental/diff_flame.m b/samples/matlab_experimental/diff_flame.m index 021e54f0ef..769fa42b3c 100644 --- a/samples/matlab_experimental/diff_flame.m +++ b/samples/matlab_experimental/diff_flame.m @@ -104,7 +104,7 @@ % ``help setRefineCriteria``. f.energyEnabled = true; -fl.setRefineCriteria(2, 200.0, 0.1, 0.2); +fl.setRefineCriteria(2, 4, 0.2, 0.3, 0.04); fl.solve(loglevel, refine_grid); %% Show statistics of solution and elapsed time diff --git a/samples/matlab_experimental/flame.m b/samples/matlab_experimental/flame.m index 12ba9beeb5..ded43474c3 100644 --- a/samples/matlab_experimental/flame.m +++ b/samples/matlab_experimental/flame.m @@ -32,7 +32,7 @@ f = Sim1D({left flow right}); % set default initial profiles. - rho0 = gas.D; + rho0 = gas.massDensity; % find the adiabatic flame temperature and corresponding % equilibrium composition diff --git a/samples/matlab_experimental/ignite.m b/samples/matlab_experimental/ignite.m index 239b6c0aa3..13f7e00625 100644 --- a/samples/matlab_experimental/ignite.m +++ b/samples/matlab_experimental/ignite.m @@ -25,7 +25,7 @@ gas.TPX = {1001.0, OneAtm, 'H2:2,O2:1,N2:4'}; gas.basis = 'mass'; y0 = [gas.U - 1.0 / gas.D + 1.0 / gas.massDensity gas.Y']; time_interval = [0 0.001]; diff --git a/samples/matlab_experimental/periodic_cstr.m b/samples/matlab_experimental/periodic_cstr.m index 380bc51300..18414fc598 100644 --- a/samples/matlab_experimental/periodic_cstr.m +++ b/samples/matlab_experimental/periodic_cstr.m @@ -72,7 +72,7 @@ % controller (constant mdot). Set the mass flow rate to 1.25 sccm. sccm = 1.25; vdot = sccm * 1.0e-6/60.0 * ((OneAtm / gas.P) * (gas.T / 273.15)); % m^3/s - mdot = gas.D * vdot; % kg/s + mdot = gas.massDensity * vdot; % kg/s mfc = MassFlowController(upstream, cstr); mfc.massFlowRate = mdot; @@ -109,6 +109,8 @@ plot(tm, y) legend('H2', 'O2', 'H2O') title('Mass Fractions') + ylabel('Mass Fractions') + xlabel('Time (s)') toc end diff --git a/samples/matlab_experimental/plug_flow_reactor.m b/samples/matlab_experimental/plug_flow_reactor.m index d026fcf031..94e16b0351 100644 --- a/samples/matlab_experimental/plug_flow_reactor.m +++ b/samples/matlab_experimental/plug_flow_reactor.m @@ -99,7 +99,7 @@ T_calc(1) = gas_calc.T; Y_calc(1, :) = gas_calc.Y; -rho_calc(1) = gas_calc.D; +rho_calc(1) = gas_calc.massDensity; for i = 2:length(x_calc)