function hidden_T3_flux_surface (i_p, row) %CL %b function hidden_T3_flux_surface (i_p) % Copyright 2000, J.E. Akin. All rights reserved. % ------------------------------------------------------ % Matlab hidden surface (discontinuous) plot of i_p-th % flux component value in linear T3 elements % ------------------------------------------------------ %? global az el ? these are not changing with new view % c_x = x coordinates of nod_per_el line polygon % c_y = y coordinates of nod_per_el line polygon % msh_typ_nodes = connectivity list for elements, nt x nod_per_el % loop = corners for nod_per_el line polygon % 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_r = Elem items before flux results %CL % row = row number where cord & connectivity start, 1 or 2 %CL % msh_bc_xyz = Nodal coordinates (with preceeding data) % t_x = x coordinates of nod_per_el corners % t_y = y coordinates of nod_per_el corners pre_e = 0 ; pre_p = 1; pre_r = 0 ; %CL %bfprintf ('Begin component value hidden carpet plots: \n') if ( nargin == 0 ) i_p = 0 ; row = 1 ; elseif ( nargin == 1 ) %CL row = 1 ; elseif ( nargin == 2 ) %CL pre_e = 0 ; %CL % pre_r = 2 ; %CL %b row = 1 ; %CL end % if no arguments less = row - 1 ; %CL % 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 np = np - less ; %CL % fprintf ('Read %g mesh coordinate pairs \n', np) ns = size (msh_bc_xyz,2) - pre_p ; % space dimension pre_r = ns ; % coordinates of point are before flux if ( ns < 2 ) error ('This is not a 2D mesh') end % if not 2D data % 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 nt = nt - less ; %CL nod_per_el = size (msh_typ_nodes,2) - pre_e -1 ; % nodes per elem % fprintf ('Read %g elements connections \n', nt) Col_1 = pre_e+2 ; %CL Col_2 = nod_per_el+pre_e+1 ; %CL load el_qp_xyz_fluxes.tmp nr = size (el_qp_xyz_fluxes, 1) ; % n_elem * n_qp if ( nr == 0 ) error ('Error missing file el_qp_xyz_fluxes.tmp') end % if error nq = nr / nt; % quadrature pts per el, use only first max_p = size (el_qp_xyz_fluxes, 2) - pre_r ; % number of columns %CL fprintf ('Read %g element Gauss points \n', nq) 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 z (nt) = 0. ; % pre-allocate array z 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 t_z (nod_per_el) = 0 ; % Optional pre-allocation, all same 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 % set constants [loop] = get_El_Loop (nod_per_el) ; % msh_bc_xyz has: pre_p items then: x, y %b x = msh_bc_xyz (1:np, (pre_p+1)) ; % extract x column x = msh_bc_xyz (row:(np+less), (pre_p+1)) ; % extract x %CL %b y = msh_bc_xyz (1:np, (pre_p+2)) ; % extract y column y = msh_bc_xyz (row:(np+less), (pre_p+2)) ; % extract y %CL if ( i_p >= 1 ) for k = 1:nt; % element loop kq = 1 + nq*(k-1); % single gauss point z (k) = el_qp_xyz_fluxes(kq, pre_r+i_p) ; %CL end % for else % i_p = 0, get root mean sq for k = 1:nt kq = 1 + nq*(k-1); % single gauss point z (k) = sqrt(sum(el_qp_xyz_fluxes (kq, pre_r+1:pre_r+max_p).^2)); end % for k end % if get RMS value % Cite max, min values [V_X, L_X] = max (z) ; [V_N, L_N] = min (z) ; fprintf ('Max value is %g at element %g \n', V_X, L_X) fprintf ('Min value is %g at element %g \n', V_N, L_N) % Initialize plots xmax = max (x) ; xmin = min (x) ; ymax = max (y) ; ymin = min (y) ; zmax = max (z) ; zmin = min (z) ; z_inc = abs(zmax - zmin)/1000 ; % zmax=16 % zmin=0 clf % clear graphics axis ([xmin, xmax, ymin, ymax, zmin, zmax]) % set axes % view([52.5,30]) hold on % hold image for plots xlabel ('X') % add label ylabel ('Y') % add label if ( i_p >= 1 ) zlabel (['Flux ', int2str(i_p), ' (max = ', ... num2str(V_X), ', min = ', num2str(V_N), ')']) title(['FEA T3 Flux Component\_', int2str(i_p),': ', ... int2str(nt),' Elements, ', int2str(np), ... ' Nodes, (', int2str(nod_per_el), ' per Element)']) else % i_p = 0, get root mean sq % zlabel (['RMS Value (max = ', num2str(V_X), ... % ', min = ', num2str(V_N), ')']) title(['FEA T3 Flux RMS Value: ', ... int2str(nt),' Elements, ', int2str(np), ... ' Nodes, (', int2str(nod_per_el), ' per Element)']) zlabel ('RMS Flux Value') end % if get RMS value % Loop over all elements %b n1 = pre_e+2 ; n2 = nod_per_el+pre_e+1 ; inc_e = 0 ; % user control for it = 1:nt ; % Extract corner connectivity t_nodes = msh_typ_nodes ((it+less), Col_1:Col_2 ) ; %CL if ( all ( t_nodes > 0 ) ) %B % Extract corner coordinates t_x = x (t_nodes) ; % x at those nodes, only t_y = y (t_nodes) ; % y at those nodes, only t_z(1:nod_per_el) = z (it); % constant at all el nodes % Get the centroid x_bar = sum (t_x' )/nod_per_el ; y_bar = sum (t_y' )/nod_per_el ; % 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 c_z = t_z (loop) ; fill3 (c_x, c_y, c_z, 'y' ) % plot nod_per_el lines % show element number if ( inc_e > 0 ) t_text = sprintf ('%g', it); z_bar = z(it) + z_inc ; text (x_bar, y_bar, z_bar, t_text) end % if end % if all end % for over all elements, it grid %% label max min points % v_text = sprintf ('------min') ; % text (x(L_N), y(L_N), V_N, v_text) ; % v_text = sprintf ('------max') ; % text (x(L_X), y(L_X), V_X, [v_text]) ; ; % end % if show labels % -depsc -tiff % for an eps version % print ('-dpsc', ['hidden_T3_flux_', int2str(i_p), '_surface']) hold off % v_text = ['Created hidden_T3_flux_', int2str(i_p), '_surface.ps'] ; % fprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of hidden_T3_flux_surface