function g = GUIflow(options,ea) % This window specifies the flow of the water around the sphere % Choose a stream function from the pull-down menu: % % Stokes flow. This is the analytical solution to the linearised % flow equation, useful at low Reynolds numbers. % Numerical Navier-Stokes solver. This solves the non-linear % equations for the flow around the translating sphere. You should % start with small computational grids; otherwise you may experience % very long computational times (several hours). % Free flow. Here the velocity is constant in space. % Spherical pump. This is also Stokes approximation, but of the % spherical pump flow, where water is flowing through the sphere % with constant velocity inside the sphere. % % You can have plotted the stream function itself, or various component % of the flow field: The flow velocity vector using a ''quiver'' plot, % velocity compenents in various directions, deformation, or vorticity. % % Each of these plots can be made as contour lines (careful for large % grids: it takes long to compute contour lines), surf plots, or profiles % in the polar line or the equitorial plane. In addition, the flow % velocity vector can be plotted as quiver plots, i.e. you see arrows % indicating the vectors. % % For contour lines, you can have the program choose contour values % automatically, or you can set them manually through a vector of values, % e.g. [1,2,3] or 1:3 % DOCUMENTATION FOR THE DEVELOPER % % GUIflow - constructor for the GUI flow object % % Syntax: g = GUIflow(options) % % IF no GUIflow object exists, then one is constructed when this % function is called. In this case options (if present) ... % % At most one GUIflow object can live at once. % % If there exists a GUIflow object, then the options is interpreted % as an action to modify this object and is passed on to GUIflowAction. % % The GUIflow object is returned in g. % % Written by Uffe H. Thygesen, 2000. See the README file for % no warranty, copyleft and distribution issues. persistent NotFirstTime TheGUIflow if nargin==0, options = []; end if isempty(NotFirstTime), NotFirstTime = 1; StreamStrings = {'Stokes','Numerical N-S solver','Free','Pump'}; % Streamstrings which we do not present: % 'PP Multiplicative','Oseen','PP Additive','PP Inner','PP Outer','PP I/O','PP Convex' PlotObjectNames = {'Stream function','Flow field','Ur','Ut','Ux','Uz','Deformation','Vorticity','Coagulation Kernel'}; PlotStyleNames = {'Contour','Surf','Pole','Equator','Quiver'}; dummy = GUIflowFig(StreamStrings,PlotObjectNames,PlotStyleNames); TheGUIflow = class(dummy,'GUIflow'); TheGUIflow = GUIflowAction(TheGUIflow,'refresh'); else if ~isempty(options) TheGUIflow = GUIflowAction(TheGUIflow,options); end end if nargout ==1, g = TheGUIflow; end return function pars = GUIflowFig(StreamStrings,PlotObjectNames,PlotStyleNames) % Declare class fields; to be filled later pars.FlowField = []; pars.StreamFunctionField = []; pars.AutoCLVS = []; pars.UserCLVS = []; pars.Reynold = []; pars.psi = []; pars.PsiNames = StreamStrings; pars.ObjectNames = PlotObjectNames; pars.StyleNames = PlotStyleNames; % Layout parameters figpos = [1 3 85 25]; textdim = [14 1.5]; blockx = [55]; blocky = [0.5]; editdim = [14 1.5]; editx = 70; ydiff = 1.5; h0 = figure('Units','char', ... 'ResizeFcn','Resize(GUIflow)',... 'Name','Flow field',... 'PaperPositionMode','auto',... 'Color',[0.8 0.8 0.8], ... 'Position',figpos, ... 'Tag','GUIflowFig'); pars.FigHandle = h0; pars.AxesPos = [4 2 47 20]; h1 = axes('Parent',h0, ... 'Units','char', ... 'CameraUpVector',[0 1 0], ... 'CameraUpVectorMode','manual', ... 'Color',[1 1 1], ... 'Position',pars.AxesPos, ... 'Tag','GUIflowAxes', ... 'XColor',[0 0 0], ... 'YColor',[0 0 0], ... 'ZColor',[0 0 0]); pars.AxesHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'ListboxTop',0, ... 'Position',[blockx blocky+15.3*ydiff editdim], ... 'String','Flow', ... 'hor','left',... 'Style','text', ... 'Tag','StaticText1'); pars.StrfunTextHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''stream'')', ... 'ListboxTop',0, ... 'Position',[blockx blocky+14.5*ydiff editx+editdim(1)-blockx ydiff], ... 'String',StreamStrings, ... 'Style','popupmenu', ... 'Tag','GUIflowStream', ... 'Value',1); pars.StreamHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'BackgroundColor',[1 1 1], ... 'Callback','GUIflow(''Re'')', ... 'ListboxTop',0, ... 'Position',[editx blocky+13*ydiff editdim], ... 'String','1', ... 'Style','edit', ... 'Tag','GUIflowReynold'); pars.ReHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'ListboxTop',0, ... 'Position',[blockx blocky+13*ydiff editdim], ... 'String','Re=', ... 'Style','text', ... 'Tag','StaticText1'); pars.ReTextHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'ListboxTop',0, ... 'Position',[blockx blocky+11.5*ydiff editx+editdim(1)-blockx ydiff], ... 'String','What to plot', ... 'Style','text', ... 'Tag','StaticText2'); pars.WhatTextHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''object'')', ... 'ListboxTop',0, ... 'Position',[blockx blocky+10.5*ydiff editx+editdim(1)-blockx ydiff], ... 'String',PlotObjectNames, ... 'Style','popupmenu', ... 'Tag','GUIflowObject', ... 'Value',1); pars.ObjectHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Position',[blockx blocky+9*ydiff textdim], ... 'ListboxTop',0, ... 'String','Style', ... 'Style','text', ... 'Tag','StaticText2'); pars.StyleStringHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''style'')', ... 'ListboxTop',0, ... 'Position',[editx blocky+9*ydiff editdim], ... 'String',PlotStyleNames, ... 'Style','popupmenu', ... 'Tag','GUIflowStyle', ... 'Value',2); pars.StyleHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''cbar'')', ... 'ListboxTop',0, ... 'Position',[blockx blocky+7.5*ydiff editx+editdim(1)-blockx ydiff], ... 'String','Show colorbar', ... 'Style','checkbox', ... 'Value',0,... 'Tag','GUIflowCbar'); pars.CbarHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''both'')', ... 'ListboxTop',0, ... 'Value',1,... 'Position',[blockx blocky+6.5*ydiff editx+editdim(1)-blockx ydiff], ... 'String','Show both sides', ... 'Style','checkbox', ... 'Tag','GUIflowBothBox'); pars.BothHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''auto'')', ... 'ListboxTop',0, ... 'Position',[blockx blocky+5.5*ydiff editx+editdim(1)-blockx ydiff], ... 'String','Automatic contour levels', ... 'Value',1,... 'Style','checkbox', ... 'Tag','GUIflowAuto'); pars.AutoHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'ListboxTop',0, ... 'Position',[blockx blocky+4*ydiff editx+editdim(1)-blockx ydiff], ... 'String','User C-levels', ... 'Style','text', ... 'Tag','StaticText2'); pars.UserStringHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''user'')', ... 'BackgroundColor',[1 1 1]*0.5, ... 'ListboxTop',0, ... 'Position',[blockx blocky+3*ydiff editx+editdim(1)-blockx ydiff], ... 'String','1:10', ... 'Style','edit', ... 'Tag','GUIflowUserCLev'); pars.UserCLevHandle= h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''save'')', ... 'ListboxTop',0, ... 'Position',[blockx blocky+1.5*ydiff textdim], ... 'String','Save'); pars.SaveHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''load'')', ... 'ListboxTop',0, ... 'Position',[blockx blocky+0.5*ydiff textdim], ... 'String','Load'); pars.LoadHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','GUIflow(''solve'')', ... 'enable','off',... 'ListboxTop',0, ... 'Position',[editx blocky+1.5*ydiff textdim], ... 'String','Solve'); pars.SolveHandle = h1; h1 = uicontrol('Parent',h0, ... 'Units','char', ... 'Callback','helpwin(''GUIflow'')', ... 'ListboxTop',0, ... 'Position',[editx blocky+0.5*ydiff textdim], ... 'String','Help'); pars.HelpHandle = h1; return