Deleted unnecessay code and added Cantera version info in LoadCantera

This commit is contained in:
ssun30 2022-09-09 19:57:58 -04:00 committed by Ray Speth
parent 0a27dcd1f8
commit 4ac5bdf707
8 changed files with 40 additions and 87 deletions

View File

@ -12,8 +12,6 @@ classdef Interface < handle & ThermoPhase & Kinetics
% 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:

View File

@ -1,33 +0,0 @@
function s = importEdge(file, name, phase1, phase2, phase3, phase4)
% Import edges between phases.
% s = importEdge(file, name, phase1, phase2, phase3, phase4)
% Supports up to four neighbor phases. See
%
% :param file:
% File containing phases
% :param name:
% Name of phase
% :param phase1:
% First neighbor phase
% :param phase2:
% Second neighbor phase
% :param phase3:
% Third neighbor phase
% :param phase4:
% Fourth neighbor phase
% :return:
% Instance of class :mat:func:`Interface`
%
if nargin == 3
s = Interface(file, name, phase1);
elseif nargin == 4
s = Interface(file, name, phase1, phase2);
elseif nargin == 5
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.');
end
end

View File

@ -1,24 +0,0 @@
function s = importInterface(file, name, phase1, phase2)
% Import an interface between phases.
% s = importInterface(file, name, phase1, phase2)
%
% :param file:
% YAML file containing the interface
% :param name:
% Name of the interface to import
% :param phase1:
% First phase in the interface
% :param phase2:
% Second phase in the interface
% :return:
% Instance of class :mat:func:`Interface`
%
if nargin == 3
s = Interface(file, name, phase1);
elseif nargin == 4
s = Interface(file, name, phase1, phase2);
else
error('importInterface only supports 2 bulk phases');
end
end

View File

@ -20,5 +20,6 @@ if ~libisloaded(ct)
'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

View File

@ -73,7 +73,7 @@ gas.TPX = {tinlet, p, comp1};
% 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

View File

@ -53,7 +53,7 @@ mw = dbulk.MolecularWeights;
% 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

View File

@ -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

View File

@ -25,7 +25,7 @@ gas.TPX = {t, oneatm, 'CH4:0.01, O2:0.21, N2:0.78'};
% 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;