[Matlab] Remove automatic figure generation for kinetic rate functions

Miscellaneous formatting updates
This commit is contained in:
ssun30 2022-03-04 16:33:49 -05:00 committed by Ray Speth
parent 3dad11e9ff
commit c11b157add
11 changed files with 107 additions and 108 deletions

View File

@ -346,7 +346,7 @@ classdef Stack < handle
% step to be taken first time the steady-state solution
% attempted. If this failed, two time steps would be taken.
checklib;
calllib(ct, 'sim1D_', s.st_id, ...
calllib(ct, 'sim1D_TimeStep', s.st_id, ...
stepsize, length(steps), steps);
end

View File

@ -53,17 +53,17 @@ classdef Interface < handle & ThermoPhase & Kinetics
calllib(ct, 'surf_getCoverages', surf_id, xx);
c = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Coverages')
bar(c);
colormap(summer);
nm = s.speciesNames;
set(gca, 'XTickLabel', nm);
xlabel('Species Name');
ylabel('Coverage');
title('Surface Species Coverages');
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Coverages')
% bar(c);
% colormap(summer);
% nm = s.speciesNames;
% set(gca, 'XTickLabel', nm);
% xlabel('Species Name');
% ylabel('Coverage');
% title('Surface Species Coverages');
% end
end
function c = concentrations(s)
@ -82,17 +82,17 @@ classdef Interface < handle & ThermoPhase & Kinetics
calllib(ct, 'surf_getConcentrations', surf_id, xx);
c = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Concentrations')
bar(c);
colormap(summer);
nm = speciesNames(s);
set(gca, 'XTickLabel', nm);
xlabel('Species Name');
ylabel('Concentration [kmol/m^2]');
title('Surface Species Concentrations');
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Concentrations')
% bar(c);
% colormap(summer);
% nm = speciesNames(s);
% set(gca, 'XTickLabel', nm);
% xlabel('Species Name');
% ylabel('Concentration [kmol/m^2]');
% title('Surface Species Concentrations');
% end
end
function set.coverages(s, cov, norm)

View File

@ -240,14 +240,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getCreationRates', kin.kin_id, nsp, pt);
cdot = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Creation Rates')
bar(q)
xlabel('Species Number')
ylabel('Creation Rate [kmol/m^3-s]')
title('Species Chemical Reaction Rates')
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Creation Rates')
% bar(q)
% xlabel('Species Number')
% ylabel('Creation Rate [kmol/m^3-s]')
% title('Species Chemical Reaction Rates')
% end
end
function ddot = destructionRates(kin)
@ -264,14 +264,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getDestructionRates', kin.kin_id, nsp, pt);
ddot = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Destruction Rates')
bar(q)
xlabel('Species Number')
ylabel('Destruction Rate [kmol/m^3-s]')
title('Species Chemical Reaction Rates')
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Destruction Rates')
% bar(q)
% xlabel('Species Number')
% ylabel('Destruction Rate [kmol/m^3-s]')
% title('Species Chemical Reaction Rates')
% end
end
function wdot = netProdRates(kin)
@ -288,14 +288,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getNetProductionRates', kin.kin_id, nsp, pt);
wdot = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Production Rates')
bar(q)
xlabel('Species Number')
ylabel('Net Production Rate [kmol/m^3-s]')
title('Species Net Chemical Reaction Rates')
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Production Rates')
% bar(q)
% xlabel('Species Number')
% ylabel('Net Production Rate [kmol/m^3-s]')
% title('Species Net Chemical Reaction Rates')
% end
end
function q = rop_f(kin)
@ -312,14 +312,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getFwdRateOfProgress', kin.kin_id, nr, pt);
q = pt.Value;
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')
end
% 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')
% end
end
function q = rop_r(kin)
@ -336,14 +336,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getRevRateOfProgress', kin.kin_id, nr, pt);
q = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Rates of Progress')
bar(q)
xlabel('Reaction Number')
ylabel('Reverse Rate of Progress [kmol/m^3]')
title('Reverse Rates of Progress')
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Rates of Progress')
% bar(q)
% xlabel('Reaction Number')
% ylabel('Reverse Rate of Progress [kmol/m^3]')
% title('Reverse Rates of Progress')
% end
end
function q = rop(kin)
@ -360,15 +360,15 @@ classdef Kinetics < handle
f = rop_f(kin);
r = rop_r(kin);
q = [f, r];
if nargout == 0
figure
set(gcf, 'Name', 'Rates of Progress')
bar(q)
xlabel('Reaction Number')
ylabel('Rate of Progress [kmol/m^3]')
title('Rates of Progress')
legend('Forward', 'Reverse')
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Rates of Progress')
% bar(q)
% xlabel('Reaction Number')
% ylabel('Rate of Progress [kmol/m^3]')
% title('Rates of Progress')
% legend('Forward', 'Reverse')
% end
end
function q = rop_net(kin)
@ -385,14 +385,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getNetRatesOfProgress', kin.kin_id, nr, pt);
q = pt.Value;
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')
end
% 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')
% end
end
function rxn = reactionEqn(kin, irxn)
@ -492,14 +492,14 @@ classdef Kinetics < handle
pt = libpointer('doublePtr', xx);
calllib(ct, 'kin_getEquilibriumConstants', kin.kin_id, nr, pt);
k = pt.Value;
if nargout == 0
figure
set(gcf, 'Name', 'Equilibrium Constants')
bar(k)
xlabel('Reaction Number')
ylabel('log_{10} Kc [kmol,m, s]')
title('Equilibrium Constants')
end
% if nargout == 0
% figure
% set(gcf, 'Name', 'Equilibrium Constants')
% bar(k)
% xlabel('Reaction Number')
% ylabel('log_{10} Kc [kmol,m, s]')
% title('Equilibrium Constants')
% end
end
function k = get.Kf(kin)

View File

@ -2,4 +2,3 @@ function w = Water()
% Return an object representing water.
w = Solution('liquidvapor.yaml', 'water');
end

View File

@ -115,7 +115,7 @@ for i = 2:length(x_calc)
%--------------------------------------------------------------------------
%--------------------------------------------------------------------------
% These values are passed onto the ode15s solver
[~,y] = ode15s(@PFR_Solver, limits, inlet_soln, options,...,
[~,y] = ode15s(@PFR_Solver, limits, inlet_soln, options, ...
gas_calc, mdot_calc, A_in, dAdx, k);
T_calc(i) = y(end, 2);

View File

@ -47,7 +47,7 @@ gas = Solution(rxnmech, 'gri30', 'Mix');
gas.TPX = {tin, p, comp2};
%% Create the flow object
%
f = AxisymmetricFlow(gas,'flow');
f.setPressure(p);
f.setupGrid(initial_grid);
@ -65,7 +65,7 @@ inlet_o.setMdot(mdot_o);
inlet_o.setMoleFractions(comp1);
%% Create the fuel inlet
%
inlet_f = Inlet('fuel_inlet');
inlet_f.T = tin;
inlet_f.setMdot(mdot_f);