[Matlab] Add option to specify transport modeling to @Solution constructor. Add options to specify information about @Wall on construction. Verify job number for @Domain1D
This commit is contained in:
parent
a067fcbc37
commit
0a0d5f2947
3 changed files with 97 additions and 14 deletions
|
|
@ -1,10 +1,16 @@
|
|||
function d = Domain1D(a, b, c, d, e)
|
||||
function d = Domain1D(a, b, c)
|
||||
% DOMAIN1D - Create a new one-dimensional domain.
|
||||
%
|
||||
d.dom_id = -1;
|
||||
|
||||
% Valid job numbers for one argument
|
||||
valid_jobs = [2, 3, 4, 5, -2];
|
||||
if nargin == 1
|
||||
d.dom_id = domain_methods(0, a);
|
||||
if any(a == valid_jobs)
|
||||
d.dom_id = domain_methods(0, a);
|
||||
else
|
||||
error('Not enough arguments for that job number')
|
||||
end
|
||||
elseif nargin == 2
|
||||
% a stagnation flow
|
||||
if a == 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
function s = Solution(src, id)
|
||||
function s = Solution(src, id, trans)
|
||||
% SOLUTION - class Solution constructor.
|
||||
%
|
||||
% Class Solution represents solutions of multiple species. A
|
||||
|
|
@ -27,17 +27,24 @@ function s = Solution(src, id)
|
|||
%
|
||||
% See also: ThermoPhase, Kinetics, Transport
|
||||
%
|
||||
doc = XML_Node('doc',src);
|
||||
doc = XML_Node('doc', src);
|
||||
if nargin == 1
|
||||
node = findByName(doc,'phase');
|
||||
node = findByName(doc, 'phase');
|
||||
else
|
||||
node = findByID(doc,id);
|
||||
node = findByID(doc, id);
|
||||
end
|
||||
t = ThermoPhase(node);
|
||||
k = Kinetics(node,t);
|
||||
k = Kinetics(node, t);
|
||||
s.kin = k;
|
||||
s.th = t;
|
||||
tr = Transport(node,t,'default',0);
|
||||
if nargin == 3
|
||||
if strcmp(trans, 'default') || strcmp(trans, 'Mix') || strcmp(trans, 'Multi')
|
||||
tr = Transport(node, t, trans, 4);
|
||||
else
|
||||
error('Unknown transport modeling specified.')
|
||||
end
|
||||
else
|
||||
tr = Transport(node, t, 'default', 4);
|
||||
end
|
||||
s.tr = tr;
|
||||
s = class(s,'Solution',t,k,tr);
|
||||
|
||||
s = class(s, 'Solution', t, k, tr);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,82 @@
|
|||
function x = Wall(typ)
|
||||
function x = Wall(left, right, area, k, u, q, v, kleft, kright)
|
||||
%
|
||||
if nargin == 0
|
||||
typ = 1;
|
||||
end
|
||||
|
||||
% This is a dummy argument, it is not actually used by wall_new in ctreactor.cpp
|
||||
typ = 1;
|
||||
|
||||
x.index = wallmethods(0, typ);
|
||||
|
||||
if x.index < 0
|
||||
error(geterr);
|
||||
end
|
||||
x.left = -1;
|
||||
x.right = -1;
|
||||
x = class(x, 'Wall');
|
||||
|
||||
if nargin >= 2
|
||||
if isa(left, 'Reactor') && isa(right, 'Reactor')
|
||||
install(x, left, right);
|
||||
else
|
||||
warning(['left and/or right were not instances of Reactor, ' ...
|
||||
'and were not installed.'])
|
||||
end
|
||||
end
|
||||
|
||||
if nargin >= 3
|
||||
if isnumeric(area)
|
||||
setArea(x, area);
|
||||
else
|
||||
warning('area was not a number and the area was not set')
|
||||
end
|
||||
end
|
||||
|
||||
if nargin >= 4
|
||||
if isnumeric(k)
|
||||
setExpansionRateCoeff(x, k);
|
||||
else
|
||||
warning('k was not a number and the expansion rate coefficient was not set')
|
||||
end
|
||||
end
|
||||
|
||||
if nargin >= 5
|
||||
if isnumeric(u)
|
||||
setHeatTransferCoeff(x, u);
|
||||
else
|
||||
warning('u was not a number and the expansion rate coefficient was not set')
|
||||
end
|
||||
end
|
||||
|
||||
if nargin >= 6
|
||||
if isa(q, 'Func')
|
||||
setHeatFlux(x, q);
|
||||
else
|
||||
warning('q was not an instance of Func and was not set')
|
||||
end
|
||||
end
|
||||
|
||||
if nargin >= 7
|
||||
if isa(v, 'Func')
|
||||
setVelocity(x, v)
|
||||
else
|
||||
warning('v was not an instance of Func and was not set')
|
||||
end
|
||||
end
|
||||
|
||||
if nargin >= 8
|
||||
if ~isa(kleft, 'Kinetics')
|
||||
kleft = 0;
|
||||
end
|
||||
if nargin == 9
|
||||
if ~isa(kright, 'Kinetics')
|
||||
kright = 0;
|
||||
end
|
||||
else
|
||||
kright = 0;
|
||||
end
|
||||
if ~isa(kleft, 'Kinetics') && ~isa(kright, 'Kinetics')
|
||||
warning(['kleft and kright were not instances of class Kinetics ' ...
|
||||
'and so were not set'])
|
||||
else
|
||||
setKinetics(x, kleft, kright);
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue