function contour_n_exact_flux (i_p) Pts_wide=2; % Copyright 2000, J.E. Akin. All rights reserved. % plot node scp ave of i_p flux component % convert any type of mesh to a structured square mesh % The flux gradients are stored as N_R_B flux components % associated with N_SPACE grident components. Here N_SPACE = 2 % Poisson Eq: U,x,x U,y,x : U,y,x U,y,y : % Plane stress: e_x,x e_y,x e_xy,x : e_x,y e_y,y, e_xy,y % or U,x,x U,y,x (U,y,x + U,x,x) : U,x,y U,y,y (U,y,y + U,x,y) % 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 if ( nargin == 0 ) i_p = 0 ; end % if no arguments format short load msh_bc_xyz.tmp; np = size (msh_bc_xyz, 1); fprintf ('Read %g mesh coordinate pairs \n', np) pre_p = 1; 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 pre_e = 0 ; load msh_typ_nodes.tmp ; % nod_per_el nodes per element nt = size (msh_typ_nodes,1); % number of elements if ( nt == 0 ) 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 load exact_node_flux.tmp; % x,y followed by flux list ng = size (exact_node_flux, 1) ; % count points nf = size (exact_node_flux, 2) ; % count components if ( ng == 0 ) error ('Error missing file exact_node_flux.tmp') end % if error if ( nf <= 0 ) error ('Error, no fluxes in file exact_node_flux.tmp') else fprintf ('%g flux components with 2 gradient components \n', nf/2) nf = nf/2 ; end % if error % NX, NY = 31 are default values, these can be altered by user NX = 41; NY = 41; x = msh_bc_xyz (:, 1+pre_p); y = msh_bc_xyz (:, 2+pre_p); if ( i_p > 0 ) % then f = exact_node_flux (:, i_p) ; else % use RMS for j = 1:ng f(j) = sqrt ( sum(exact_node_flux (j, :).^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 xlabel (['X: ', int2str(nt),' Elements']) ylabel (['Y: ', int2str(np),' Nodes (', int2str(nod_per_el), ' per Element)']) if ( i_p > 0 ) title (['Smoothed Exact Flux Component\_', int2str(i_p)']) else title (['Smoothed Exact Flux RMS Value ']) end % which component % -depsc -tiff % for an eps version %b print ('-dpsc', ['contour_n_exact_flux_', int2str(i_p)]) hold off %b v_text = ['Created contour_n_exact_flux_', int2str(i_p), '.ps']; %b fprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of contour_n_exact_flux