function node_graph_result (i_p, start, stop, inc) % Copyright 2000, J.E. Akin. All rights reserved. % ------------------------------------------------------ % Matlab graph of i_p-th component value at mesh node numbers % If i_p = 0, show RMS value % ------------------------------------------------------ % c_x = x coordinates of nod_per_el line element % msh_typ_nodes = connectivity list for elements, nt x nod_per_el % loop = corners for nod_per_el line element % nod_per_el = Nodes per element % np = Number of Points % nt = Number of elements % pre_e = Element items before connectivity list pre_e = 0 ; % pre_p = Nodal items before coordinates pre_p = 1; % msh_bc_xyz = Nodal coordinates (with preceeding data) % t_x = x coordinates of nod_per_el corners fprintf ('Begin component value graph: \n') if ( nargin == 0 ) i_p = 0 ; end % if no arguments load node_results.tmp nr = size (node_results, 1); np = nr ; if ( nr == 0 ) error ('Error missing file node_results.tmp') end % if error max_p = size (node_results, 2) ; % number of columns fprintf ('Read %g nodal solution values \n', nr) fprintf (' with %g components each \n', max_p) if ( i_p > max_p ) error ('i_p > available data') end % if error x = [1:np] ; % node numbers only if ( nargin == 0 | nargin == 1 ) start = 1 ; stop = np ; inc = 1 ; elseif ( nargin == 2 ) stop = np ; inc = 1 ; elseif ( nargin == 3 ) inc = 1 ; end % if argument count if ( i_p >= 1 ) y = node_results(:, i_p) ; else % i_p = 0, get root mean sq for k = 1:np y (k) = sqrt ( sum (node_results (k, 1:max_p).^2)) ; end % for k end % if get RMS value % Cite max, min values [V_X, L_X] = max (y(start:inc:stop)) ; [V_N, L_N] = min (y(start:inc:stop)) ; L_X = start - 1 + L_X ; L_N = start - 1 + L_N ; fprintf ('Max value in range is %g at node %g \n', V_X, L_X) fprintf ('Min value in range is %g at node %g \n', V_N, L_N) [V_X, L_X] = max (y) ; [V_N, L_N] = min (y) ; fprintf ('Max value is %g at node %g \n', V_X, L_X) fprintf ('Min value is %g at node %g \n', V_N, L_N) % Initialize plots xmax = max (x(start:inc:stop)) ; xmin = min (x(start:inc:stop)) ; ymax = max (y(start:inc:stop)) ; ymin = min (y(start:inc:stop)) ; if ( ymax == ymin ) if ( abs (ymax) > 0 ) ymax = ymax + abs (ymax)/20. ; ymin = ymin - abs (ymin)/20. ; end % if end % if clf % clear graphics axis ([xmin, xmax, ymin, ymax]) % set axes hold on % hold image for plots xlabel (['Node Numbers, ', int2str(start),':', int2str(inc), ... ':', int2str(stop)]) if ( i_p >= 1 ) title(['FEA Solution Component\_', int2str(i_p),': ', ... int2str(np),' Nodes']) %b int2str(nt),' Elements, ', int2str(np),' Nodes']) ylabel (['Component ', int2str(i_p), ' (max = ', ... num2str(V_X), ', min = ', num2str(V_N), ')']) else % i_p = 0, get root mean sq title(['FEA RMS\_value: ', int2str(np),' Nodes']) ylabel (['FEA Solution RMS Value (max = ', ... num2str(V_X), ', min = ', num2str(V_N), ')']) end % if get RMS value % plot graph vs node number plot (x(start:inc:stop), y(start:inc:stop), 'k-') if ( inc > 1 ) plot (x(start:inc:stop), y(start:inc:stop), 'r+') end % if % mark every 20th node if ( np > 20 ) count = 0 ; for i = start:inc:stop count = count + 1 ; if ( count == 20 ) count = 0 ; plot (x(i), y(i), 'k*') end % if end % for all end % if grid % label max min points v_text = sprintf ('---min') ; text (x(L_N), V_N, v_text) ; v_text = sprintf ('---max') ; text (x(L_X), V_X, [v_text]) ; % -depsc -tiff % for an eps version % print ('-dpsc', ['node_result_', int2str(i_p), '_graph']) hold off % v_text = ['Created node_result_', int2str(i_p), '_graph.ps'] ; % fprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of node_graph_result