cantera/interfaces/matlab/toolbox/@Interface/setCoverages.m
Steven DeCaluwe 14864e840b Extend NoNorm option for setCoverages to the Matlab toolbox
Because normalizing the species coverages leads to incorrect Jacobian
calculations, it is sometimes necessary to not normalize the coverages.
As for bulk species mass/mole fractions, this option is currently only
available when passing the coverages as a vector (i.e., not available
for string identifiers).
2015-11-07 21:14:03 -05:00

34 lines
1.2 KiB
Matlab

function setCoverages(s, cov, norm)
% SETCOVERAGES Set surface coverages of the species on an interface.
% setCoverages(s, cov, norm)
% :param s:
% Instance of class :mat:func:`Interface`
% :param cov:
% Coverage of the species. ``cov`` can be either a vector of
% length ``n_surf_species``, or a string in the format
% ``'Species:Coverage, Species:Coverage'``
% :param norm:
% Optional flag that denotes whether or not to normalize the species
% coverages. ``norm`` is either of the two strings ``'nonorm'``` or
% ``'norm'``. If left unset, the default is `norm`. This only works if
% ``s`` is a vector, not a string. Since unnormalized coverages can lead to
% unphysical results, ``'nonorm'`` should be used only in rare cases, such
% as computing partial derivatives with respect to a species coverage.
%
if nargin == 3 && strcmp(norm,'nonorm')
norm_flag = 0;
else
norm_flag = 1;
end
if isa(cov, 'double')
sz = length(cov);
if sz == nSpecies(s)
surfmethods(thermo_hndl(s), 3, cov, norm_flag);
else
error('wrong size for coverage array');
end
elseif isa(cov,'char')
surfmethods(thermo_hndl(s), 5, cov);
end