function quiver_fiber_heat_flux_mesh (scale, inc_g, wide, sign) % default (1.0, 1, 1) % Copyright 2000, J.E. Akin. All rights reserved. % ------------------------------------------------------ % Matlab plot of 2-D FE flux vectors at elem Gauss pts, with mesh % ------------------------------------------------------ % c_x = x coordinates of nod_per_el wide polygon % c_y = y coordinates of nod_per_el wide polygon % inc_e = increment in element numbers on plot, if > 0 % inc_g = increment in Gauss point vector plot, default = 1 % inc_p = increment in node numbers on plot, if > 0 % msh_typ_nodes = connectivity list for elements, nt x nod_per_el % loop = corners for nod_per_el wide polygon % lab_p = 1, if node points are circled lab_p = 0; % length = maximum length of arrows, in scaled x,y units % nod_per_el = Nodes per element % np = Number of Points % nt = Number of elements % pre_e = Element items before connectivity list % pre_p = Nodal items before coordinates pre_p = 1 ; % msh_bc_xyz = Nodal coordinates (with preceeding data) % scale = standard Matlab scale argument, default 1.0 % t_x = x coordinates of nod_per_el corners % t_y = y coordinates of nod_per_el corners %b % x_bar = x-centroid of each element % xy = Coordinates of points, np x 2 %b % y_bar = y-centroid of each element % set constants if ( nargin == 0 ) scale = 1. ; % the default scale inc_g = 1 ; wide = 2 ; sign = 1 ; elseif ( nargin == 1 ) inc_g = 1 ; wide = 2 ; sign = 1 ; elseif ( nargin == 2 ) wide = 2 ; sign = 1 ; elseif ( nargin == 3 ) sign = 1 ; end % if fprintf ('Using a scale of %g and vector increment of %g \n', ... scale, inc_g) format short % Read coordinate file and connectivity file % integer bc code, real xy pairs for np points (pre_p = 1) load msh_bc_xyz.tmp ; % Set control data: number of points np = size (msh_bc_xyz,1) ; % number of nodal points ns = size (msh_bc_xyz,2) - 1; % dimension of space fprintf ('Read %g mesh coordinates \n', np) fprintf ('In %g spatial dimensions \n', ns) % fprintf (' x y \n') % Set control data: number elements load msh_typ_nodes.tmp ; % nod_per_el nodes per element nt = size (msh_typ_nodes,1) ; % number of elements in mesh pre_e = 0 ; nod_per_el = size (msh_typ_nodes,2) - pre_e -1; % nodes per element fprintf ('Read %g elements connections \n', nt) x (np) = 0. ; % pre-allocate array x y (np) = 0. ; % pre-allocate array y t_nodes (nod_per_el) = 0 ; % Optional pre-allocation t_x (nod_per_el) = 0 ; % Optional pre-allocation t_y (nod_per_el) = 0 ; % Optional pre-allocation c_x (nod_per_el + 1) = 0 ; % Optional pre-allocation c_y (nod_per_el + 1) = 0 ; % Optional pre-allocation loop (nod_per_el + 1) = 0 ; % Optional pre-allocation % Mesh Range Alone % msh_bc_xyz has: pre_p items then: x, y x = msh_bc_xyz (1:np, (pre_p+1)) ; % extract x column of xy y = msh_bc_xyz (1:np, (pre_p+2)) ; % extract y column of xy gxmax = max (x) ; gxmin = min (x) ; gymax = max (y) ; gymin = min (y) ; gxdiff = gxmax - gxmin ; gydiff = gymax - gymin ; if ( gydiff == 0.0 ) gydiff = 0.5 ; % allow for 1-D mesh (with y == 0) end % if no y coordinates xmax = gxmax + gxdiff/20 ; ymax = gymax + gydiff/20 ; xmin = gxmin - gxdiff/20 ; ymin = gymin - gydiff/20 ; clf % clear graphics axis ([xmin, xmax, ymin, ymax]) % set axes axis ('equal') % true shape style hold on % hold image for plots grid % add grid dots xlabel (['X for ', int2str(nt),' Elements with ', ... int2str(nod_per_el), ' nodes']) ylabel (['Y; for ', int2str(np),' Nodes']) title ([' Nanofiber Heat Flux Vectors with Mesh']) % if ( inc_g == 1 ) % title ([' Heat Flux Vectors (max = ', ... % num2str(largest),') with Nanofibers']) % add title % else % title ([' Heat Flux Vectors at ', int2str(npg), ... % ' Gauss Pts, inc = ', int2str(inc_g), ... % ', max = ', num2str(largest)]) % add title % end % if alternate title % Select element type details [loop] = get_El_Loop (nod_per_el) ; %% Plot input mesh points & label them % if (lab_p == 1) % plot all points % plot (x, y, 'b.') % mark each node % end % if show labels % Loop over all elements for it = 1:nt ; % Extract corner connectivity t_nodes = msh_typ_nodes (it, (pre_e+2):(nod_per_el+pre_e+1)); % Extract corner coordinates t_x = x (t_nodes) ; % x at those nodes, only t_y = y (t_nodes) ; % y at those nodes, only % Plot this polygon c_x = t_x (loop) ; % x for nod_per_el wide polygon c_y = t_y (loop) ; % y for nod_per_el wide polygon plot (c_x, c_y, 'b-') % plot nod_per_el wides, in blue end % for over all elements % ---------------- Now add the vectors to the mesh -------------- %b quiver (g_x, g_y, g_dx, g_dy, scale) % now overlay the fibers %b fiber_loc_overlay (xmin, xmax, ymin, ymax, wide) fiber_heat_flux_overlay (xmin, xmax, ymin, ymax, scale, wide) % -depsc -tiff % for an eps version % print -dpsc quiver_qp_xyz_flux_mesh hold off % fprintf ('Created file quiver_qp_xyz_flux_mesh.ps \n') end % quiver_fiber_heat_flux_mesh