function contour_qp_d_vec_mesh (i_p, row) %CL Pts_wide=2; % Copyright 2004, J.E. Akin. All rights reserved. % plot element Gauss point Dvec i_p magnitude % x,y == nodal coordinates of the FEA % f == nodal solution of the FEA % X,Y == nodal coordinates of the structured square mesh % F == interpolated solution for the structured square mesh % NX == number of nodes in x-direction for structured mesh % NY == number of nodes in y-direction for structured mesh % pre_e = Element items before connectivity list % pre_p = Nodal items before coordinates % pre_r = Nodal items before results %CL % row = row number where cord & connectivity start, 1 or 2 %CL pre_e = 0 ; pre_p = 1; if ( nargin == 0 ) i_p = 0 ; row = 1 ; elseif ( nargin == 1 ) %CL row = 1 ; %CL elseif ( nargin == 2 ) %CL pre_e = 0 ; %CL end % if no arguments less = row - 1 ; %CL load msh_bc_xyz.tmp; np = size (msh_bc_xyz, 1); np = np - less ; %C fprintf ('Read %g mesh coordinate pairs \n', np) ns = size (msh_bc_xyz,2) - pre_p ; % space dimension if ( ns < 2 ) error ('This is not a 2D mesh') end % if not 2D data load msh_typ_nodes.tmp ; % nod_per_el nodes per element nt = size (msh_typ_nodes,1); % number of elements nt = nt - less ; %C fprintf ('Read %g element topology sets \n', nt) if ( nt <= 0 ) %CL error ('Error missing file msh_typ_nodes.tmp') end % if error nod_per_el = size (msh_typ_nodes,2) - pre_e -1 ; % nodes per element Col_1 = pre_e+2 ; %CL Col_2 = nod_per_el+pre_e+1 ; %CL load qp_xy_d_vector.tmp; % x,y followed by grad list ng = size (qp_xy_d_vector, 1) ; % count points nf = size (qp_xy_d_vector, 2) - 2; % count components fprintf ('Read %g Gauss point locations \n', ng) fprintf ('with %g grad components \n', nf) if ( ng == 0 ) error ('Error missing file qp_xy_d_vector.tmp') end % if error if ( nf <= 0 ) error ('Error, no grads in file qp_xy_d_vector.tmp') end % if error if ( i_p > nf ) error ('Error, requested component not present') end % if error % NX, NY = 31 are default values, these can be altered by user NX = 51; NY = 51; x = qp_xy_d_vector (:, 1); y = qp_xy_d_vector (:, 2); if ( i_p > 0 ) f = qp_xy_d_vector (:, (i_p + 2)) ; else for j = 1:ng f(j) = sqrt ( sum(qp_xy_d_vector (j, 3:(nf+2)).^2) ) ; end % for ng points end % which component xlin = linspace (min(x), max(x), NX); ylin = linspace (min(y), max(y), NY); [X, Y] = meshgrid (xlin, ylin); F = griddata (x, y, f, X, Y, 'cubic'); clf c = contour (X,Y,F,'LineWidth',Pts_wide); clabel (c); hold on grid % draw the mesh % set constants [loop] = get_El_Loop (nod_per_el) ; % get mesh x,y (not QP x,y) %b x_m = msh_bc_xyz (:, 2); y_m = msh_bc_xyz (:, 3); x_m = msh_bc_xyz (row:(np+less), (pre_p+1)) ; % extract x %C y_m = msh_bc_xyz (row:(np+less), (pre_p+2)) ; % extract y %C % Loop over all elements for it = 1:nt ; % Extract corner connectivity %b t_nodes = msh_typ_nodes (it,(pre_e+2):(nod_per_el+pre_e+1)); t_nodes = msh_typ_nodes ((it+less), Col_1:Col_2 ) ; %CL % Extract corner coordinates t_x = x_m (t_nodes) ; % x at those nodes, only t_y = y_m (t_nodes) ; % y at those nodes, only % Plot this polygon c_x = t_x (loop) ; % x for nod_per_el line polygon c_y = t_y (loop) ; % y for nod_per_el line polygon plot (c_x, c_y) % plot nod_per_el lines end % for over all elements xlabel (['X: ', int2str(nt),' Elements']) ylabel (['Y: ', int2str(np),' Nodes']) % xlabel ('X'); ylabel ('Y'); if ( i_p > 0 ) title (['FEA QP D Vector Component\_', int2str(i_p), ... ': at ', int2str(ng), ' Gauss Points']); else title (['FEA QP D Vector RMS Value at ', ... int2str(ng), ' Gauss Points']) end % which component % -depsc -tiff % for an eps version %bprint ('-dpsc', ['contour_qp_d_vec_mesh_', int2str(i_p)]) hold off %bv_text = ['Created contour_qp_d_vec_mesh_', int2str(i_p), '.ps']; %bfprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of contour_qp_d_vec_mesh