Added several missing functions to the Matlab toolbox

This commit is contained in:
Ray Speth 2011-12-14 01:54:18 +00:00
parent 54315d4472
commit 107ba5d381
7 changed files with 81 additions and 1 deletions

View file

@ -0,0 +1,12 @@
function setFunction(f, mf)
% SETMASSFLOWRATE -
%
if f.type == 1
k = flowdevicemethods(5, f.index, func_hndl(mf));
if k < 0
error(geterr);
end
else
error('Mass flow rate can only be set for mass flow controllers')
end

View file

@ -49,6 +49,43 @@ else
s = ['Gaussian(' num2str(p.coeffs(1)) ',' ...
num2str(p.coeffs(2)) ',' ...
num2str(p.coeffs(3)) ')'];
elseif strcmp(p.typ,'fourier')
c = reshape(p.coeffs, [],2);
Ao = c(1,1);
w = c(1,2);
A = c(2:end,1);
B = c(2:end,2);
N = size(c,1)-1;
if Ao ~= 0
s = [num2str(Ao/2)];
else
s = '';
end
for n=1:N
if A(n) ~= 0
if A(n) < 0
prefix = ' - ';
elseif s
prefix = ' + ';
else
prefix = '';
end
s = [s prefix num2str(abs(A(n))) '*cos(' num2str(n*w) '*x)'];
end
if B(n) ~= 0
if B(n) < 0
prefix = ' - ';
elseif s
prefix = ' + ';
else
prefix = '';
end
s = [s prefix num2str(abs(B(n))) '*sin(' num2str(n*w) '*x)'];
end
end
else
s = ['*** char not yet implemented for' p.typ ' ***'];
end

View file

@ -0,0 +1,4 @@
function i = func_hndl(f)
% FUNC_HNDL -
%
i = f.index;

View file

@ -4,7 +4,7 @@ switch s.type
case '()'
ind = s.subs{:};
for k = 1:length(ind)
b(k) = funcmethods(2,a.index,ind(k))
b(k) = funcmethods(2,a.index,ind(k));
end
otherwise
error('Specify value for x as p(x)')

View file

@ -0,0 +1,19 @@
function y = massFraction(s, species)
y = 0.0;
yarray = massFractions(s);
if isa(species,'char')
k = speciesIndex(s, species);
if k > 0
y = yarray(k);
end
elseif isa(species,'cell')
n = length(species);
for j = 1:n
k = speciesIndex(s, species{j});
if k > 0
y(j) = yarray(k);
end
end
end

View file

@ -0,0 +1,4 @@
function setHeatFlux(w, f)
% SET HEAT FLUX -
%
wallmethods(8, wall_hndl(w), func_hndl(f));

View file

@ -0,0 +1,4 @@
function setVelocity(w, f)
% SET VELOCITY -
%
wallmethods(10, wall_hndl(w), func_hndl(f));