Skip to content

Commit

Permalink
Deprecate XML-era transport names 'Mix' and 'Multi'
Browse files Browse the repository at this point in the history
Fixes #1425
  • Loading branch information
speth authored and ischoegl committed Mar 14, 2023
1 parent fde6650 commit 23ebd13
Show file tree
Hide file tree
Showing 38 changed files with 95 additions and 106 deletions.
2 changes: 1 addition & 1 deletion include/cantera/transport/MixTransport.h
Expand Up @@ -60,7 +60,7 @@ class MixTransport : public GasTransport
MixTransport() = default;

virtual std::string transportModel() const {
return (m_mode == CK_Mode) ? "mixture-averaged-CK" : "Mix";
return (m_mode == CK_Mode) ? "mixture-averaged-CK" : "mixture-averaged";
}

//! Return the thermal diffusion coefficients
Expand Down
2 changes: 1 addition & 1 deletion include/cantera/transport/MultiTransport.h
Expand Up @@ -33,7 +33,7 @@ class MultiTransport : public GasTransport
MultiTransport(ThermoPhase* thermo=0);

virtual std::string transportModel() const {
return (m_mode == CK_Mode) ? "multicomponent-CK" : "Multi";
return (m_mode == CK_Mode) ? "multicomponent-CK" : "multicomponent";
}

//! Return the thermal diffusion coefficients (kg/m/s)
Expand Down
6 changes: 3 additions & 3 deletions interfaces/cython/cantera/_onedim.pyx
Expand Up @@ -1227,9 +1227,9 @@ cdef class Sim1D:

# Do initial solution steps without multicomponent transport
transport = self.transport_model
solve_multi = self.transport_model == 'Multi'
solve_multi = self.transport_model == 'multicomponent'
if solve_multi:
set_transport('Mix')
set_transport('mixture-averaged')

def log(msg, *args):
if loglevel:
Expand Down Expand Up @@ -1340,7 +1340,7 @@ cdef class Sim1D:

if solve_multi:
log('Solving with multicomponent transport')
set_transport('Multi')
set_transport('multicomponent')

if soret_doms:
log('Solving with Soret diffusion')
Expand Down
12 changes: 4 additions & 8 deletions interfaces/matlab/toolbox/@Solution/Solution.m
Expand Up @@ -18,7 +18,8 @@
% included in ``input.yaml``, it will be included in the :mat:func:`Solution`
% instance with the default transport modeling as set
% in the input file. To specify the transport modeling, set the input
% argument ``trans`` to one of ``'default'``, ``'None'``, ``'Mix'``, or ``'Multi'``.
% argument ``trans`` to one of ``'default'``, ``'None'``, or specific transport model
% such as ``'mixture-averaged'`` or ``'multicomponent'``.
% In this case, the phase name must be specified as well. Alternatively,
% change the ``transport`` field in the YAML file before loading the phase. The
% transport modeling cannot be changed once the phase is loaded.
Expand All @@ -39,7 +40,7 @@
% import as specified in the YAML file.
% :param trans:
% String, transport modeling. Possible values are ``'default'``, ``'None'``,
% ``'Mix'``, or ``'Multi'``. If not specified, ``'default'`` is used.
% or a specific transport model name. If not specified, ``'default'`` is used.
% :return:
% Instance of class :mat:func:`Solution`
%
Expand All @@ -51,12 +52,7 @@
s.kin = k;
s.th = t;
if nargin == 3
if (strcmp(trans, 'default') || strcmp(trans, 'None')...
|| strcmp(trans, 'Mix') || strcmp(trans, 'Multi'))
tr = Transport(t, trans, 0);
else
error('Unknown transport modeling specified.')
end
tr = Transport(t, trans, 0);
else
tr = Transport(t, 'default', 0);
end
Expand Down
9 changes: 5 additions & 4 deletions interfaces/matlab/toolbox/@Transport/Transport.m
Expand Up @@ -4,16 +4,17 @@
% Create a new instance of class :mat:func:`Transport`. One to three arguments
% may be supplied. The first must be an instance of class
% :mat:func:`ThermoPhase`. The second (optional) argument is the type of
% model desired, specified by the string ``'default'``, ``'Mix'`` or
% ``'Multi'``. ``'default'`` uses the default transport specified in the
% model desired, specified by the string ``'default'`` or a specific transport model
% name such as ``'mixture-averaged'`` or ``'multicomponent'``.
% ``'default'`` uses the default transport specified in the
% phase definition. The third argument is the logging level desired.
%
% :param th:
% Instance of class :mat:func:`ThermoPhase`
% :param model:
% String indicating the transport model to use. Possible values
% are ``'default'``, ``'None'``, ``'Mix'``, and ``'Multi'``.
% Optional.
% are ``'default'``, ``'None'``, ``'mixture-averaged'``, and ``'multicomponent'``,
% among others. Optional.
% :param loglevel:
% Level of diagnostic logging. Default if not specified is 4.
% :return:
Expand Down
11 changes: 5 additions & 6 deletions interfaces/matlab/toolbox/@Transport/mixDiffCoeffs.m
Expand Up @@ -2,16 +2,15 @@
% MIXDIFFCOEFFS Get the mixture-averaged diffusion coefficients.
% v = mixDiffCoeffs(a)
% Object ``a`` must belong to a class derived from
% Transport, and that was constructed by specifying the ``'Mix'``
% option. If ``'Mix'`` was not specified, you will get the error message ::
% Transport, and that was constructed using a model that implements
% mixture-averaged transport properties. If not, you will get the error message ::
%
% **** Method getMixDiffCoeffs not implemented. ****
%
% In this case, try method :mat:func:`multiDiffCoeffs`, or create a
% new gas mixture model that uses a mixture-averaged transport manager,
% for example::
% In this case, create a new gas mixture model that uses a mixture-averaged
% transport manager, for example::
%
% >> gas = GRI30('Mix');
% >> gas = GRI30('mixture-averaged');
%
% See also: :mat:func:`MultiDiffCoeffs`
%
Expand Down
6 changes: 3 additions & 3 deletions interfaces/matlab/toolbox/@Transport/multiDiffCoeffs.m
Expand Up @@ -2,8 +2,8 @@
% MULTIDIFFCOEFFS Get the multicomponent diffusion coefficients.
% v = multiDiffCoeffs(a)
% Object ``a`` must belong to a class derived from
% Transport, and that was constructed by specifying the ``'Multi'``
% option. If ``'Multi'`` was not specified, you will get the
% Transport, and that was constructed by specifying the ``'multicomponent'``
% option. If ``'multicomponent'`` was not specified, you will get the
% error message ::
%
% **** Method getMultiDiffCoeffs not implemented. ****
Expand All @@ -12,7 +12,7 @@
% new gas mixture model that uses a mixture-averaged transport manager,
% for example::
%
% >> gas = GRI30('Multi');
% >> gas = GRI30('multicompnent');
%
% :param a:
% Instance of class :mat:func:`Transport` (or another
Expand Down
4 changes: 2 additions & 2 deletions interfaces/matlab/toolbox/@Transport/thermalDiffCoeffs.m
Expand Up @@ -2,8 +2,8 @@
% THERMALDIFFCOEFFS Get the thermal diffusion coefficients.
% v = thermalDiffCoeffs(a)
% Object ``a`` must belong to a class derived from
% Transport, and that was constructed by specifying the ``'Multi'``
% option. If ``'Multi'`` was not specified, the returned values will
% Transport, and that was constructed by specifying the ``'multicomponent'``
% option. If ``'multicomponent'`` was not specified, the returned values will
% all be zero.
%
% :param a:
Expand Down
20 changes: 6 additions & 14 deletions interfaces/matlab/toolbox/GRI30.m
Expand Up @@ -19,29 +19,21 @@
%
% .. code-block:: matlab
%
% g1 = GRI30 % mixture-averaged transport properties
% g2 = GRI30('Mix') % mixture-averaged transport properties
% g3 = GRI30('Multi') % miulticomponent transport properties
% g4 = GRI30('None') % no transport properties
% g1 = GRI30 % mixture-averaged transport properties
% g2 = GRI30('mixture-averaged') % mixture-averaged transport properties
% g3 = GRI30('multicomponent') % miulticomponent transport properties
% g4 = GRI30('None') % no transport properties
%
% :param tr:
% Transport modeling, ``'None'``, ``'Mix'``, or ``'Multi'``
% Transport modeling, ``'None'``, ``'mixture-averaged'``, or ``'multicomponent'``
% :return:
% Instance of class :mat:func:`Solution`
%

if nargin == 0
s = Solution('gri30.yaml', 'gri30');
elseif nargin == 1
if strcmp(tr, 'None')
s = Solution('gri30.yaml', 'gri30', 'None');
elseif strcmp(tr, 'Mix')
s = Solution('gri30.yaml', 'gri30', 'Mix');
elseif strcmp(tr, 'Multi')
s = Solution('gri30.yaml', 'gri30', 'Multi')
else
error('Unknown transport specified. "None", "Mix", or "Multi" are supported.')
end
s = Solution('gri30.yaml', 'gri30', tr);
else
error('Wrong number of arguments.');
end
2 changes: 1 addition & 1 deletion samples/cxx/gas_transport/gas_transport.cpp
Expand Up @@ -48,7 +48,7 @@ void write_csv(const std::string& name, const std::vector<std::string>& names,
void transport_example()
{
// create a gas mixture, and set its state
auto sol = newSolution("gri30.yaml", "gri30", "Mix");
auto sol = newSolution("gri30.yaml", "gri30", "mixture-averaged");
auto gas = sol->thermo();
double temp = 500.0;
double pres = 2.0*OneAtm;
Expand Down
2 changes: 1 addition & 1 deletion samples/f77/demo.f
Expand Up @@ -23,7 +23,7 @@ program demo
write(*,*)
write(*,*) '******** Fortran 77 Test Program ********'

call newIdealGasMix('h2o2.yaml','ohmech','Mix')
call newIdealGasMix('h2o2.yaml','ohmech','mixture-averaged')
t = 1200.0
p = 101325.0
call setState_TPX_String(t, p,
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/catcomb.m
Expand Up @@ -26,7 +26,7 @@
tinlet = 300.0; % inlet temperature
tsurf = 900.0; % surface temperature
mdot = 0.06; % kg/m^2/s
transport = 'Mix'; % transport model
transport = 'mixture-averaged'; % transport model

% We will solve first for a hydrogen/air case to
% use as the initial estimate for the methane/air case
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/diffflame.m
Expand Up @@ -17,7 +17,7 @@
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
transport = 'Mix'; % Transport model
transport = 'mixture-averaged'; % Transport model
% NOTE: Transport model needed if mechanism file does not have transport
% properties.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/flame1.m
Expand Up @@ -36,7 +36,7 @@
% This object will be used to evaluate all thermodynamic, kinetic,
% and transport properties
%
gas = Solution(rxnmech, 'ohmech', 'Mix');
gas = Solution(rxnmech, 'ohmech', 'mixture-averaged');

% set its state to that of the unburned gas at the burner
set(gas,'T', tburner, 'P', p, 'X', comp);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/flame2.m
Expand Up @@ -33,7 +33,7 @@
% This object will be used to evaluate all thermodynamic, kinetic,
% and transport properties
%
gas = Solution(rxnmech,'gri30','Mix');
gas = Solution(rxnmech,'gri30','mixture-averaged');

% set its state to that of the fuel (arbitrary)
set(gas,'T', tin, 'P', p, 'X', comp2);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/prandtl1.m
Expand Up @@ -12,7 +12,7 @@ function prandtl1(g)
if nargin == 1
gas = g;
else
gas = Solution('h2o2.yaml', 'ohmech', 'Mix');
gas = Solution('h2o2.yaml', 'ohmech', 'mixture-averaged');
end

pr = zeros(31,31);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/prandtl2.m
Expand Up @@ -11,7 +11,7 @@ function prandtl2(g)
if nargin == 1
gas = g;
else
gas = Solution('h2o2.yaml', 'ohmech', 'Multi');
gas = Solution('h2o2.yaml', 'ohmech', 'multicomponent');
end

pr = zeros(31,31);
Expand Down
2 changes: 1 addition & 1 deletion samples/matlab/tut2.m
Expand Up @@ -18,7 +18,7 @@
% GRI-Mech 3.0. Another way to do this is shown here, with statements
% added to measure how long this takes:

gas1 = Solution('gri30.yaml', 'gas', 'Mix');
gas1 = Solution('gri30.yaml', 'gas', 'mixture-averaged');
msg = sprintf('time to create gas1: %f', cputime - t0)

% Function 'Solution' constructs an object representing a phase of
Expand Down
4 changes: 2 additions & 2 deletions samples/matlab/tut6.m
Expand Up @@ -29,11 +29,11 @@
% To use the multicomponent model with GRI-Mech 3.0, call function
% GRI30 as follows:

g1 = GRI30('Multi')
g1 = GRI30('multicomponent')

% To use the mixture-averaged model:

g2 = GRI30('Mix')
g2 = GRI30('mixture-averaged')

% Both models use a mixture-averaged formulation for the viscosity.
visc = [viscosity(g1), viscosity(g2)]
Expand Down
3 changes: 2 additions & 1 deletion samples/python/kinetics/extract_submechanism.py
Expand Up @@ -56,7 +56,8 @@

gas1 = ct.Solution(input_file)
gas2 = ct.Solution(name="gri30-CO-H2-submech",
thermo="ideal-gas", kinetics="gas", transport_model="Mix",
thermo="ideal-gas", kinetics="gas",
transport_model="mixture-averaged",
species=species, reactions=reactions)

# Save the resulting mechanism for later use
Expand Down
4 changes: 2 additions & 2 deletions samples/python/onedim/adiabatic_flame.py
Expand Up @@ -29,7 +29,7 @@
f.show_solution()

# Solve with mixture-averaged transport model
f.transport_model = 'Mix'
f.transport_model = 'mixture-averaged'
f.solve(loglevel=loglevel, auto=True)

if "native" in ct.hdf_support():
Expand All @@ -45,7 +45,7 @@
print(f"mixture-averaged flamespeed = {f.velocity[0]:7f} m/s")

# Solve with multi-component transport properties
f.transport_model = 'Multi'
f.transport_model = 'multicomponent'
f.solve(loglevel) # don't use 'auto' on subsequent solves
f.show_solution()
print(f"multicomponent flamespeed = {f.velocity[0]:7f} m/s")
Expand Down
4 changes: 2 additions & 2 deletions samples/python/onedim/burner_flame.py
Expand Up @@ -24,7 +24,7 @@
f.set_refine_criteria(ratio=3.0, slope=0.05, curve=0.1)
f.show_solution()

f.transport_model = 'Mix'
f.transport_model = 'mixture-averaged'
f.solve(loglevel, auto=True)

if "native" in ct.hdf_support():
Expand All @@ -35,7 +35,7 @@

f.save(output, name="mix", description="solution with mixture-averaged transport")

f.transport_model = 'Multi'
f.transport_model = 'multicomponent'
f.solve(loglevel) # don't use 'auto' on subsequent solves
f.show_solution()
f.save(output, name="multi", description="solution with multicomponent transport")
Expand Down
4 changes: 2 additions & 2 deletions samples/python/onedim/flame_fixed_T.py
Expand Up @@ -57,7 +57,7 @@
f.energy_enabled = False

# first solve the flame with mixture-averaged transport properties
f.transport_model = 'Mix'
f.transport_model = 'mixture-averaged'
f.set_refine_criteria(ratio=3.0, slope=0.3, curve=1)

f.solve(loglevel, refine_grid)
Expand All @@ -71,7 +71,7 @@
f.save(output, name="mix", description="solution with mixture-averaged transport")

print('\n\n switching to multicomponent transport...\n\n')
f.transport_model = 'Multi'
f.transport_model = 'multicomponent'

f.set_refine_criteria(ratio=3.0, slope=0.1, curve=0.2)
f.solve(loglevel, refine_grid)
Expand Down
2 changes: 1 addition & 1 deletion samples/python/onedim/premixed_counterflow_twin_flame.py
Expand Up @@ -103,7 +103,7 @@ def solveOpposedFlame(oppFlame, massFlux=0.12, loglevel=1,

# Uncomment the following line to use a Multi-component formulation. Default is
# mixture-averaged
# oppFlame.transport_model = 'Multi'
# oppFlame.transport_model = 'multicomponent'

# Now run the solver. The solver returns the peak temperature, strain rate and
# the point which we ascribe to the characteristic strain rate.
Expand Down
2 changes: 1 addition & 1 deletion samples/python/surface_chemistry/catalytic_combustion.py
Expand Up @@ -22,7 +22,7 @@
tinlet = 300.0 # inlet temperature
tsurf = 900.0 # surface temperature
mdot = 0.06 # kg/m^2/s
transport = 'Mix' # transport model
transport = 'mixture-averaged' # transport model

# We will solve first for a hydrogen/air case to use as the initial estimate
# for the methane/air case
Expand Down
2 changes: 1 addition & 1 deletion samples/python/transport/multiprocessing_viscosity.py
Expand Up @@ -28,7 +28,7 @@ def init_process(mech):
initialize any Cantera objects we need to use.
"""
gases[mech] = ct.Solution(mech)
gases[mech].transport_model = 'Multi'
gases[mech].transport_model = 'multicomponent'


def get_thermal_conductivity(args):
Expand Down

0 comments on commit 23ebd13

Please sign in to comment.