Environmental Engineering Reference
In-Depth Information
The data, given by the user in the GUI window, have to be allocated to
corresponding variables. The reader recognizes the relevant variables on the left
side of the assignments above. In the sequel we give some clues how to understand
the remainder of the lines. handles is a structure which contains the entire GUI
implementation. handles.D_edit is a call of the D_edit function of the given
structure. The name of the function corresponds with the 'Tag' , specified in the
Property Inspector. The value, entered by the GUI user during program execution,
can be found under 'String' and is reached by the get command. The content of
the ' String' is of data type string, i.e. a listing of characters. As for the further
processing in the program the numerical value is relevant (not the text-string), the
string has to be converted to a numerical double type. In MATLAB
the command
®
that performs such conversion is str2double .
Using the debugging mode, the user may check some parameter functions.
For example the variable D contains the value found in the edit box for diffusivity.
The given command sequence delivers the values of the parameters for further
processing. In Chaps. 4-6 the same task was performed in the specification part of
the M-files in a more obvious way.
Now that the parameters are available, the execution part can be adopted
almost identically from former transport models. The remainder of the
runbutton_Callback function is taken from the 'analtrans.m' , outlined in Chap. 6:
c0 = 0; % initial concentration
cin = 1; % inflow concentration
%Calculate data
y ='rgbcmyk';
e = ones (1,100);
u = sqrt(v*v+4*lambda*R*D);
% Create space plot
t = linspace (T/10,T,10);
axes(handles.xaxes);
x = linspace(0,L,100);
for i = 1:size(t,2)
h = 1./(2.*sqrt(D*R*t(i)));
hh = plot (x,c0*exp(-lambda*t(i))*(e-0.5*erfc(h*(R*x-...
e*v*t(i)))-0.5*exp((v/D)*x).*erfc(h*(R*x+e*v*t(i)))) +...
(cin-c0)*0.5*(exp((v-u)/(D+D)*x).*erfc(h*(R*x-e*u*t(i)))+...
exp((v+u)/(D+D)*x).*erfc(h*(R*x+e*u*t(i)))),y(mod(i,7)+1));
set (hh,'LineWidth',2)
hold on;
end
grid on
hold off
As the mathematical aspects of the command sequence are explained in Chap. 6,
we can restrict our description to the graphics commands. After having set
initialization values for c0 , cin , y , e and u , the t vector is computed. t contains
those time instants at which a concentration profile is plotted. Here the entire time
period of length T is equidistantly divided into 10 parts (the starting time t ¼
0is
not included). The following axes command tells that the following graphic
Search WWH ::




Custom Search