diff --git a/Validations/Functions/get_problems_solved.m b/Validations/Functions/get_problems_solved.m index ec27e95b..9d584f49 100644 --- a/Validations/Functions/get_problems_solved.m +++ b/Validations/Functions/get_problems_solved.m @@ -1,7 +1,17 @@ -function value = get_problems_solved(mix, variable) +function value = get_problems_solved(varargin) % Get problems solved based on the length of the given variable - for i=length(mix):-1:1 - value(i) = length(mix{i}.(variable)); + + mix = varargin{1}; + variable = varargin{2}; + if nargin == 3 + subvariable = varargin{3}; + for i=length(mix):-1:1 + value(i) = length(mix{i}.(variable).(subvariable)); + end + else + for i=length(mix):-1:1 + value(i) = length(mix{i}.(variable)); + end end value = sum(value); end \ No newline at end of file diff --git a/Validations/Functions/plot_validation_shock_polar_SDToolbox.m b/Validations/Functions/plot_validation_shock_polar_SDToolbox.m index e88e5b1e..56b12b0a 100644 --- a/Validations/Functions/plot_validation_shock_polar_SDToolbox.m +++ b/Validations/Functions/plot_validation_shock_polar_SDToolbox.m @@ -1,13 +1,15 @@ -function [fig1, fig2] = plot_validation_shock_polar_SDToolbox(results_SDToolbox, config) +function [fig1, fig2] = plot_validation_shock_polar_SDToolbox(results_CT, results_SDToolbox, config) % Plot numerical results obtained with SDToolbox, which use CANTERA as a thermochemical kernel. % * Pressure ratio with the deflection angle [deg] % * Wave angle [deg] with the deflection angle [deg] - nfrec = [2, 4, 7, 10]; - fig1 = figure(1); ax1 = gca; - fig2 = figure(2); ax2 = gca; - set(fig1, 'position', [1921 -471 1080 1795]); - set(fig2, 'position', [1921 -471 1080 1795]); + % Set figures + fig1 = figure(1); set(fig1, 'position', [1921 -471 1080 1795]); + fig2 = figure(2); set(fig2, 'position', [1921 -471 1080 1795]); + % Shock polars from Combustion Toolbox + [ax1, ax2] = plot_shock_polar(results_CT, results_CT.PS.strR, results_CT.PS.strP); + % Shock polars from SDToolbox + nfrec = [2, 4, 7, 10]; % frec points SD Toolbox per case for i=length(results_SDToolbox):-1:1 plot(ax1, results_SDToolbox{i}.theta(1:nfrec(i):end) * 180/pi, results_SDToolbox{i}.P2P1(1:nfrec(i):end), 'ko', 'LineWidth', config.linewidth, 'MarkerFaceColor', 'auto'); plot(ax2, results_SDToolbox{i}.theta(1:nfrec(i):end) * 180/pi, results_SDToolbox{i}.beta(1:nfrec(i):end) * 180/pi, 'ko', 'LineWidth', config.linewidth, 'MarkerFaceColor', 'auto'); diff --git a/Validations/SDToolbox/run_validation_SHOCK_POLAR_SDToolbox_1.m b/Validations/SDToolbox/run_validation_SHOCK_POLAR_SDToolbox_1.m index 31dbc611..72f8bce5 100644 --- a/Validations/SDToolbox/run_validation_SHOCK_POLAR_SDToolbox_1.m +++ b/Validations/SDToolbox/run_validation_SHOCK_POLAR_SDToolbox_1.m @@ -22,11 +22,11 @@ 'S_Oxidizer', Oxidizer, 'S_Inert', Inert,... 'proportion_inerts_O2', proportion_inerts_O2, 'u1', u1,... 'tolN', tolN); - problems_solved = get_problems_solved(results_CT.PS.strP, 'theta_range'); + problems_solved = get_problems_solved(results_CT.PS.strP, 'polar', 'theta'); % Load results SDToolbox results_SDToolbox = load_struct(filename, 'data'); % Display validation (plot) - [fig1, fig2] = plot_validation_shock_polar_SDToolbox(results_SDToolbox, results_CT.Misc.config); + [fig1, fig2] = plot_validation_shock_polar_SDToolbox(results_CT, results_SDToolbox, results_CT.Misc.config); % Save plots folderpath = strcat(pwd,'\Validations\Figures\'); stack_trace = dbstack;