Changed name of constants to be consistent with C++ core.

This commit is contained in:
ssun30 2023-01-31 18:09:25 -05:00 committed by Ray Speth
parent 0fbf09bba5
commit cd3bc73a53
23 changed files with 29 additions and 29 deletions

View File

@ -1,7 +1,7 @@
function r = faradayconstant
function r = FaradayConstant
% Get the Faraday constant in C/kmol of electron. ::
%
% >> r = faradayconstant
% >> r = FaradayConstant
%
% :return:
% The Faraday constant in C/kmol-e.

View File

@ -1,7 +1,7 @@
function r = gasconstant
function r = GasConstant
% Get the universal gas constant in J/kmol-K. ::
%
% >> r = gasconstant
% >> r = gasConstant
%
% :return:
% The universal gas constant in J/kmol-K.

View File

@ -1,4 +1,4 @@
function p = oneatm
function p = OneAtm
% Get one atmosphere in Pa. ::
%
% >> p = oneatm

View File

@ -23,7 +23,7 @@ function F = PFR_Solver(x, soln_vector, gas, mdot, A_in, dAdx, k)
gas.TDY = {T, rho, Y};
MW_mix = gas.meanMolecularWeight;
Ru = gasconstant;
Ru = GasConstant;
R = Ru / MW_mix;
nsp = gas.nSpecies;
vx = mdot / (rho * A);

View File

@ -23,7 +23,7 @@ t0 = cputime; % record the starting time
%% Set parameter values
p = oneatm; % pressure
p = OneAtm; % pressure
tinlet = 300.0; % inlet temperature
tsurf = 900.0; % surface temperature
mdot = 0.06; % kg/m^2/s

View File

@ -14,7 +14,7 @@ function dydt = conhp(t, y, gas, mw)
wdot = gas.netProdRates;
H = gas.enthalpies_RT';
gas.basis = 'mass';
tdot =- gas.T * gasconstant / (gas.D * gas.cp) .* wdot * H;
tdot =- gas.T * GasConstant / (gas.D * gas.cp) .* wdot * H;
% set up column vector for dydt
dydt = [tdot

View File

@ -14,7 +14,7 @@ function dydt = conuv(t, y, gas, mw)
wdot = gas.netProdRates;
H = (gas.enthalpies_RT - ones(1, nsp))';
gas.basis = 'mass';
tdot =- gas.T * gasconstant / (gas.D * gas.cv) .* wdot * H;
tdot =- gas.T * GasConstant / (gas.D * gas.cv) .* wdot * H;
% set up column vector for dydt
dydt = [tdot

View File

@ -23,7 +23,7 @@ t0 = cputime; % record the starting time
%% Operation Parameters
t = 1200.0; % surface temperature
p = 20.0 * oneatm / 760.0; % pressure
p = 20.0 * OneAtm / 760.0; % pressure
%% Create the gas object
%

View File

@ -18,7 +18,7 @@ runtime = cputime; % Record the starting time
%% Parameter values of inlet streams
p = oneatm; % Pressure
p = OneAtm; % Pressure
tin = 300.0; % Inlet temperature
mdot_o = 0.72; % Air mass flux, kg/m^2/s
mdot_f = 0.24; % Fuel mass flux, kg/m^2/s

View File

@ -17,7 +17,7 @@ t0 = cputime; % record the starting time
%% Set parameter values
p = 0.05 * oneatm; % pressure
p = 0.05 * OneAtm; % pressure
tburner = 373.0; % burner temperature
mdot = 0.06; % kg/m^2/s

View File

@ -16,7 +16,7 @@ t0 = cputime; % record the starting time
%% Set parameter values
p = oneatm; % pressure
p = OneAtm; % pressure
tin = 300.0; % inlet temperature
mdot_o = 0.72; % air, kg/m^2/s
mdot_f = 0.24; % fuel, kg/m^2/s

View File

@ -21,7 +21,7 @@ function plotdata = ignite(g)
% set the initial conditions
gas.TPX = {1001.0, oneatm, 'H2:2,O2:1,N2:4'};
gas.TPX = {1001.0, OneAtm, 'H2:2,O2:1,N2:4'};
gas.basis = 'mass';
y0 = [gas.U
1.0 / gas.D
@ -77,7 +77,7 @@ function plotdata = ignite(g)
[~, n] = size(times);
pv = zeros(gas.nSpecies + 4, n);
gas.TP = {1001.0, oneatm};
gas.TP = {1001.0, OneAtm};
for j = 1:n
ss = soln(:, j);

View File

@ -15,7 +15,7 @@ function ignite_hp(gas)
end
mw = gas.molecularWeights;
gas.TPX = {1001.0, oneatm, 'H2:2,O2:1,N2:4'};
gas.TPX = {1001.0, OneAtm, 'H2:2,O2:1,N2:4'};
y0 = [gas.T
gas.X'];

View File

@ -15,7 +15,7 @@ function ignite_uv(gas)
end
mw = gas.molecularWeights;
gas.TPX = {1001.0, oneatm, 'H2:2,O2:1,N2:4'};
gas.TPX = {1001.0, OneAtm, 'H2:2,O2:1,N2:4'};
y0 = [gas.T
gas.X'];

View File

@ -19,7 +19,7 @@ function isentropic(g)
end
% set the stagnation state
gas.TPX = {1200.0, 10.0 * oneatm, 'H2:1,N2:0.1'};
gas.TPX = {1200.0, 10.0 * OneAtm, 'H2:1,N2:0.1'};
gas.basis = 'mass';
s0 = gas.S;
h0 = gas.H;

View File

@ -34,7 +34,7 @@ help lithium_ion_battery
SOC = 0:0.02:1; % [-] Input state of charge (0...1) (can be a vector)
I_app = -1; % [A] Externally-applied current, negative for discharge
T = 293; % [K] Temperature
P = oneatm; % [Pa] Pressure
P = OneAtm; % [Pa] Pressure
%% Cell properties
@ -125,7 +125,7 @@ function anCurr = anode_curr(phi_s, phi_l, X_Li_an, anode, elde, elyt, ...
r = anode_interface.ropNet; % [kmol/m2/s]
% Calculate the current. Should be negative for cell discharge.
anCurr = r * faradayconstant * S_an; %
anCurr = r * FaradayConstant * S_an; %
end
% This function returns the Cantera calculated cathode current (in A)
@ -142,5 +142,5 @@ function caCurr = cathode_curr(phi_s, phi_l, X_Li_ca, cathode, elde, elyt, catho
r = cathode_interface.ropNet; % [kmol/m2/s]
% Calculate the current. Should be negative for cell discharge.
caCurr = r * faradayconstant * S_ca * (-1); %
caCurr = r * FaradayConstant * S_ca * (-1); %
end

View File

@ -66,7 +66,7 @@ function periodic_cstr
% Connect the upstream reservoir to the reactor with a mass flow
% 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
vdot = sccm * 1.0e-6/60.0 * ((OneAtm / gas.P) * (gas.T / 273.15)); % m^3/s
mdot = gas.D * vdot; % kg/s
mfc = MassFlowController;
mfc.install(upstream, cstr);

View File

@ -140,7 +140,7 @@ for i = 1:length(x_calc)
% Velocity is calculated from Mass flow rate, Area and Density
vx_calc(i) = mdot_calc ./ (A_calc(i) * rho_calc(i));
% Specific Gas Constant
R_calc(i) = gasconstant() / gas_calc.meanMolecularWeight;
R_calc(i) = GasConstant() / gas_calc.meanMolecularWeight;
% Mach No. is calculated from local velocity and local speed of sound
M_calc(i) = vx_calc(i) / gas_calc.soundSpeed;
% Pressure is calculated from density, temperature and gas constant

View File

@ -42,7 +42,7 @@ function prandtl1(g)
x = zeros(gas.nSpecies, 1);
x(io2) = xo2(j);
x(ih2) = 1.0 - xo2(j);
gas.TPX = {t(i), oneatm, x};
gas.TPX = {t(i), OneAtm, x};
equilibrate(gas, 'TP');
visc(i, j) = gas.viscosity;
lambda(i, j) = gas.thermalConductivity;

View File

@ -41,7 +41,7 @@ function prandtl2(g)
x = zeros(gas.nSpecies, 1);
x(io2) = xo2(j);
x(ih2) = 1.0 - xo2(j);
gas.TPX = {t(i), oneatm, x};
gas.TPX = {t(i), OneAtm, x};
equilibrate(gas, 'TP');
visc(i, j) = gas.viscosity;
lambda(i, j) = gas.thermalConductivity;

View File

@ -10,7 +10,7 @@ help rankine
% Initialize parameters
eta_pump = 0.6;
eta_turbine = 0.8;
p_max = 8.0 * oneatm;
p_max = 8.0 * OneAtm;
t1 = 300.0;
% create an object representing water

View File

@ -20,7 +20,7 @@ function reactor2(g)
end
% set the initial conditions
gas.TPX = {1001.0, oneatm, 'H2:2,O2:1,N2:4'};
gas.TPX = {1001.0, OneAtm, 'H2:2,O2:1,N2:4'};
% create a reactor, and insert the gas
r = IdealGasReactor(gas);

View File

@ -18,7 +18,7 @@ help surfreactor
t = 870.0;
gas = Solution('ptcombust.yaml', 'gas');
gas.TPX = {t, oneatm, 'CH4:0.01, O2:0.21, N2:0.78'};
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
@ -35,7 +35,7 @@ r.V = 1.0e-6;
% create a reservoir to represent the environment
a = Solution('air.yaml', 'air', 'None');
a.TP = {t, oneatm};
a.TP = {t, OneAtm};
env = Reservoir(a);
% Define a wall between the reactor and the environment and