Skip to content

Commit

Permalink
Deleted unnecessay code and added Cantera version info in LoadCantera
Browse files Browse the repository at this point in the history
  • Loading branch information
ssun30 authored and speth committed May 11, 2023
1 parent 0a27dcd commit 4ac5bdf
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 87 deletions.
2 changes: 0 additions & 2 deletions interfaces/matlab_experimental/Base/Interface.m
Expand Up @@ -12,8 +12,6 @@
% INTERFACE Interface class constructor.
% s = Interface(src, id, p1, p2, p3, p4)
%
% See also: :mat:func:`importEdge`, :mat:func:`importInterface`
%
% :param src:
% YAML file containing the interface or edge phase.
% :param id:
Expand Down
33 changes: 0 additions & 33 deletions interfaces/matlab_experimental/Phases/importEdge.m

This file was deleted.

24 changes: 0 additions & 24 deletions interfaces/matlab_experimental/Phases/importInterface.m

This file was deleted.

3 changes: 2 additions & 1 deletion interfaces/matlab_experimental/Utility/LoadCantera.m
Expand Up @@ -20,5 +20,6 @@
'ctonedim','addheader','ctreactor', ...
'addheader','ctrpath','addheader','ctsurf');
end
disp('Cantera is ready for use');
ct_ver = canteraVersion;
sprintf('%s is ready for use.', ct_ver);
clear all
2 changes: 1 addition & 1 deletion samples/matlab_experimental/catcomb.m
Expand Up @@ -73,7 +73,7 @@
% mechanism of Deutschmann et al., 1995 for catalytic combustion on
% platinum.

surf_phase = importInterface('ptcombust.yaml', 'Pt_surf', gas);
surf_phase = Interface('ptcombust.yaml', 'Pt_surf', gas);
surf_phase.T = tsurf;

% integrate the coverage equations in time for 1 s, holding the gas
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/diamond_cvd.m
Expand Up @@ -53,7 +53,7 @@
% rates. It will be created from the interface definition 'diamond_100'
% in input file 'diamond.yaml'.

surf_phase = importInterface('diamond.yaml', 'diamond_100', gas, dbulk);
surf_phase = Interface('diamond.yaml', 'diamond_100', gas, dbulk);

%% Advance Coverages

Expand Down
59 changes: 35 additions & 24 deletions samples/matlab_experimental/rankine.m
@@ -1,36 +1,47 @@
function [work, efficiency] = rankine(t1, p2, eta_pump, eta_turbine)
% This example computes the efficiency of a simple vapor power cycle.
%
% Keywords: thermodynamics, thermodynamic cycle, non-ideal fluid
% RANKINE - This example computes the efficiency of a simple vapor power cycle.
%
% Keywords: thermodynamics, thermodynamic cycle, non-ideal fluid

help rankine
clear all
close all
cleanup

% create an object representing water
w = Water;
help rankine

% start with saturated liquid water at t1
w.setState_Tsat(t1, 1.0);
p1 = w.P;
% Initialize parameters
eta_pump = 0.6;
eta_turbine = 0.8;
p_max = 8.0 * oneatm;

% pump it to p2
basis = 'mass';
pump_work = pump(w, p2, eta_pump);
h2 = w.H;
p2 = w.P;
% create an object representing water
w = Water;

% heat to saturated vapor
w.setState_Psat(p2, 1.0);
h3 = w.H;
% start with saturated liquid water at t1
basis = 'mass';
w.setState_Tsat(t1, 1.0);
h1 = w.H;
p1 = w.P;
w

heat_added = h3 - h2;
% pump it to p2
pump_work = pump(w, p_max, eta_pump);
h2 = w.H;
w

% expand adiabatically back to the initial pressure
work = expand(w, p1, eta_turbine);
% heat to saturated vapor
w.setState_Psat(p_max, 1.0);
h3 = w.H;
w

% compute the efficiency
efficiency = (work - pump_work)/heat_added;
end
heat_added = h3 - h2;

% expand adiabatically back to the initial pressure
turbine_work = w.expand(p1, eta_turbine);
w

% compute the efficiency
efficiency = (turbine_work - pump_work)/heat_added;
disp('efficiency = ', eff);

function w = pump(fluid, pfinal, eta)
% PUMP - Adiabatically pump a fluid to pressure pfinal, using a pump
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/surfreactor.m
Expand Up @@ -25,7 +25,7 @@
% The surface reaction mechanism describes catalytic combustion of
% methane on platinum, and is from Deutschman et al., 26th
% Symp. (Intl.) on Combustion,1996, pp. 1747-1754
surf = importInterface('ptcombust.yaml','Pt_surf', gas);
surf = Interface('ptcombust.yaml','Pt_surf', gas);
surf.T = t;

nsp = gas.nSpecies;
Expand Down

0 comments on commit 4ac5bdf

Please sign in to comment.