function contour_n_cross_d2 Pts_wide=2; % Copyright 2000, J.E. Akin. All rights reserved. % plot square of node scp ave cross derivative defferences % The flux gradients are stored as N_R_B flux components % associated with N_SPACE grident components. Here N_SPACE = 2 % Poisson Eq: (U,y,x - U,x,y)^2 % 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 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 pt_ave_grad_flux.tmp; % x,y followed by flux list ng = size (pt_ave_grad_flux, 1) ; % count points nf = size (pt_ave_grad_flux, 2) ; % count components if ( ng == 0 ) error ('Error missing file pt_ave_grad_flux.tmp') end % if error if ( nf <= 0 ) error ('Error, no fluxes in file pt_ave_grad_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 = 31; NY = 31; x = msh_bc_xyz (:, 1+pre_p); y = msh_bc_xyz (:, 2+pre_p); f = (pt_ave_grad_flux (:, 2) - pt_ave_grad_flux (:, 3)).^2 ; 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']) % xlabel ('X'); ylabel ('Y'); title (['Matlab Smoothed Square of Differences of ', ... 'SCP Cross Derivatives']) % -depsc -tiff % for an eps version %bprint ('-dpsc', ['contour_n_cross_d2']) hold off %bv_text = ['Created contour_n_cross_d2.ps']; %bfprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of contour_n_cross_d2