Skip to content

Commit

Permalink
Changed name of constants to be consistent with C++ core.
Browse files Browse the repository at this point in the history
  • Loading branch information
ssun30 authored and speth committed May 11, 2023
1 parent 0fbf09b commit cd3bc73
Show file tree
Hide file tree
Showing 23 changed files with 29 additions and 29 deletions.
@@ -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.
Expand Down
@@ -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.
Expand Down
@@ -1,4 +1,4 @@
function p = oneatm
function p = OneAtm
% Get one atmosphere in Pa. ::
%
% >> p = oneatm
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/PFR_solver.m
Expand Up @@ -23,7 +23,7 @@
gas.TDY = {T, rho, Y};

MW_mix = gas.meanMolecularWeight;
Ru = gasconstant;
Ru = GasConstant;
R = Ru / MW_mix;
nsp = gas.nSpecies;
vx = mdot / (rho * A);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/catcomb.m
Expand Up @@ -23,7 +23,7 @@

%% 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
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/conhp.m
Expand Up @@ -14,7 +14,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/conuv.m
Expand Up @@ -14,7 +14,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/diamond_cvd.m
Expand Up @@ -23,7 +23,7 @@
%% 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
%
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/diff_flame.m
Expand Up @@ -18,7 +18,7 @@

%% 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
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/flame1.m
Expand Up @@ -17,7 +17,7 @@

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

Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/flame2.m
Expand Up @@ -16,7 +16,7 @@

%% 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
Expand Down
4 changes: 2 additions & 2 deletions samples/matlab_experimental/ignite.m
Expand Up @@ -21,7 +21,7 @@

% 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
Expand Down Expand Up @@ -77,7 +77,7 @@
[~, 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);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/ignite_hp.m
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/ignite_uv.m
Expand Up @@ -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'];
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/isentropic.m
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions samples/matlab_experimental/lithium_ion_battery.m
Expand Up @@ -34,7 +34,7 @@
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

Expand Down Expand Up @@ -125,7 +125,7 @@
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)
Expand All @@ -142,5 +142,5 @@
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
2 changes: 1 addition & 1 deletion samples/matlab_experimental/periodic_cstr.m
Expand Up @@ -66,7 +66,7 @@
% 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);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/plug_flow_reactor.m
Expand Up @@ -140,7 +140,7 @@
% 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
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/prandtl1.m
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/prandtl2.m
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/rankine.m
Expand Up @@ -10,7 +10,7 @@
% 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
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab_experimental/reactor2.m
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions samples/matlab_experimental/surf_reactor.m
Expand Up @@ -18,7 +18,7 @@
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
Expand All @@ -35,7 +35,7 @@

% 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
Expand Down

0 comments on commit cd3bc73

Please sign in to comment.