function biggs_time_hist (i_p, save, p_max) % exact solution for FEA node 3, Biggs node 2 % Copyright 2000, J.E. Akin. All rights reserved. % ------------------------------------------------------ % Matlab time-history of i_p-th component value at mesh node % If i_p = 0, show RMS value, save = time group number % p_max = N_G_DOF number of nodal parameters % ------------------------------------------------------ % 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 %b fprintf ('Begin component value graph: \n') if ( nargin == 1 ) save = 1 ; p_max = 1 ; elseif ( nargin == 0 ) i_p = 1 ; save = 1 ; p_max = 1 ; end % if no arguments if ( save < 10 ) file = ['node_history_00', int2str(save)]; elseif ( save < 100 ) file = ['node_history_0', int2str(save)]; else file = ['node_history_', int2str(save)]; end % if filename = [file, '.tmp'] fid= fopen(filename, 'r') ; %b load node_history_001.tmp ; history = fscanf (fid, '%g \n', [(p_max+2),inf]) ; node_history = history' ; load Biggs_exact_y2.tmp X2 = Biggs_exact_y2(:, 2) ; Y2 = Biggs_exact_y2(:, 3) ; Y2dot = Biggs_exact_y2(:, 4); Y2dd = Biggs_exact_y2(:, 5); % Set control data: number of points np = size (node_history,1) ; % number of nodal points fprintf ('Read %g time-history sets \n', np) max_p = size (node_history,2) - pre_p -1 ; % space dimension fprintf ('with %g nodal dof values \n', max_p) node = node_history (1, 1) ; fprintf ('for node number %g \n', node) if ( i_p > max_p ) error ('i_p > available data') end % if error x (np) = 0. ; % pre-allocate array x y (np) = 0. ; % pre-allocate array y x = node_history (1:np, (pre_p+1)) ; % extract x column if ( i_p >= 1 ) y = node_history(:, i_p+2) ; else % i_p = 0, get root mean sq for k = 1:np y (k) = sqrt(sum (node_history (k, 3:(2+max_p)).^2)); end % for k end % if get RMS value % Cite max, min values [V_X, L_X] = max (y) ; [V_N, L_N] = min (y) ; fprintf ('Max value is %g at step %g \n', V_X, (L_X-1)) fprintf ('Min value is %g at step %g \n', V_N, (L_N-1)) null (1:np) = V_N ; % Initialize plots xmax = max (x) ; xmin = min (x) ; ymax = max (y) ; ymin = min (y) ; if ( ymax == ymin ) if ( abs (ymax) > 0 ) ymax = ymax + abs (ymax)/20. ; ymin = ymin - abs (ymin)/20. ; end % if end % if if ( i_p ==1 ) ymax=1.4 ymin=-1.4 end if (i_p == 2 ) ymax=60 ymin=-60 end if (i_p == 3 ) ymax=4000 ymin=-4000 end clf % clear graphics axis ([xmin, xmax, ymin, ymax]) % set axes hold on % hold image for plots xlabel ('Time') if ( i_p >= 1 ) %title(['FEA Time-History for Component\_', int2str(i_p) ]) title(['FEA Time-History for Component\_', int2str(i_p), ... ' at Node ', int2str(node) ]) 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 Time-History at Node ', int2str(node)']) ylabel (['FEA Solution RMS Value (max = ', ... num2str(V_X), ', min = ', num2str(V_N), ')']) end % if get RMS value % plot node values plot (x, y, 'k-') %b plot (x, y, 'ko') if ( i_p == 1 ) plot (X2,Y2,'b--') end % if if ( i_p == 2 ) plot (X2,Y2dot,'b--') end % if if ( i_p == 3 ) plot (X2,Y2dd,'b--') end % if grid legend (['Numerical'], ['Biggs exact']) % label max min points %b v_text = sprintf ('---min') ; %b text (x(L_N), V_N, v_text) ; %b v_text = sprintf ('---max') ; %b text (x(L_X), V_X, [v_text]) ; % -depsc -tiff % for an eps version %b print ('-dpsc', ['node_', int2str(i_p), '_hist']) hold off %b v_text = ['Created node_', int2str(i_p), '_hist.ps'] ; %b fprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of biggs_time_hist