function elem_qp_flux_1d_graph () % Copyright 2000, J.E. Akin. All rights reserved. % ------------------------------------------------------ % Matlab graph of error estimate value at mesh nodes % ------------------------------------------------------ % c_x = x coordinates of nod_per_el line element % msh_typ_nodes = connectivity list for elements, nt x nod_per_el % loop = corners for nod_per_el line element % nod_per_el = Nodes per element % np = Number of Points % nt = Number of elements % pre_e = Element items before connectivity list pre_e = 0 ; % pre_p = Nodal items before coordinates pre_p = 1; % msh_bc_xyz = Nodal coordinates (with preceeding data) % t_x = x coordinates of nod_per_el corners fprintf ('Begin element qp flux graph: \n') % 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 fprintf ('Read %g mesh coordinate pairs \n', np) ns = size (msh_bc_xyz,2) - pre_p ; % space dimension if ( ns ~= 1) error ('This is not a 1D mesh') end % if not 1D 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 nod_per_el = size (msh_typ_nodes,2) - pre_e -1 ; % nodes per elem fprintf ('Read %g elements connections \n', nt) % Read new Gauss locations & flux component load el_qp_xyz_fluxes.tmp ; % x, du/dx % Set control data: number of gauss points npg = size(el_qp_xyz_fluxes,1) ; % quadrature pts w vectors if ( npg == 0 ) error ('Error: missing file el_qp_xyz_fluxes.tmp') end % if error fprintf ('Read %g Gauss x coord & flux sets \n', npg) nf = size(el_qp_xyz_fluxes,2) - ns; % flux components if ( nf ~= 1 ) % vectors not meaningful fprintf ('Read %g flux components instead of 1 \n', nf) fprintf ('Using only first component \n') nf = 1 ; %b fprintf ('Use contour_el_fluxes or smooth_el_fluxes instead \n') %b error ('Error: These are not 1-D data') end % if 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) = 0 ; % Optional pre-allocation c_y (nod_per_el) = 0 ; % Optional pre-allocation g_x(npg) = 0. ; % pre-allocate position array g_dx(npg) = 0. ; % pre-allocate flux array % FE Flux Values d_x(2) = 0. ; d_y(2) = 0. ; % vector ends on paper % Gauss points are always inside the mesh geometry g_x = el_qp_xyz_fluxes(:,1) ; % position g_dx = el_qp_xyz_fluxes(:,2) ; % flux % set constants loop = [1:nod_per_el] ; % default to sequential order % msh_bc_xyz has: pre_p items then: x, y x = msh_bc_xyz (1:np, (pre_p+1)) ; % extract x column % Cite max, min values [V_X, L_X] = max (g_dx) ; [V_N, L_N] = min (g_dx) ; fprintf ('Max value is %g \n', V_X) fprintf ('Min value is %g \n', V_N) null (1:np) = V_N ; % Initialize plots xmax = max (x) ; xmin = min (x) ; ymax = V_X ; ymin = V_N ; if ( ymax == ymin ) if ( abs (ymax) > 0 ) ymax = ymax + abs (ymax)/20. ; ymin = ymin - abs (ymin)/20. ; end % if end % if clf % clear graphics % ymax= 1.0 % ymin= 0.0 axis ([xmin, xmax, ymin, ymax]) % set axes hold on % hold image for plots xlabel ('X, Node number at 45 deg, Element number at 90 deg') title(['Flux Value at Element Quadrature Points: ', ... int2str(nt),' Elements, ', int2str(np),' Nodes']) ylabel (['Flux (max = ', ... num2str(V_X), ', min = ', num2str(V_N), ')']) plot (g_x, g_dx, 'ko') % plot node points on axis for i = 1:np t_text = sprintf (' %g', i); % offset # from pt text (x(i), null(i), t_text, 'Rotation', 45) % incline end % for all plot (x, null, 'k*') grid % label max min points v_text = sprintf ('---min') ; text (g_x(L_N), V_N, v_text) ; v_text = sprintf ('---max') ; text (g_x(L_X), V_X, [v_text]) ; % -depsc -tiff % for an eps version %bprint ('-dpsc', ['elem_qp_flux_1d_graph']) hold off %bv_text = ['Created elem_qp_flux_1d_graph.ps'] ; %bfprintf (1,'%s', v_text) ; fprintf (1, ' \n' ) % end of elem_qp_flux_1d_graph