<< gf_plot_mesh sci_getfem gf_poly >>

sci_getfem >> sci_getfem > gf_plot_slice

gf_plot_slice

this function is used to plot a slice of mesh/mesh_fem

Calling Sequence

function [hfaces, htube, hquiver, hmesh]=gf_plot_slice(sl,varargin)

Description

This function is used to plot a slice of mesh/mesh_fem (see gf_slice).

The options are specified as pairs of 'option name'/'option value':

The 'data' and 'convex_data' are mutually exclusive.

Examples

Consider that you have a 3D mesh fem mf and a vector field U defined on this mesh fem, solution of the Stokes problem in a tank (see the demo demo_stokes_3D_tank_draw.m in the tests directory).

scf();
// use a nice colormap
c = [0 0 1; 0 .5 1; 0 1 .5; 0 1 0; .5 1 0; 1 .5 0; 1 .4 0; 1 0 0; 1 .2 0; 1 .4 0; 1 .6 0; 1 .8 0];
h = gcf();
h.color_map = colormap(c);
// slice the mesh with two half spaces, and take the boundary of the resulting quarter-cylinder
sl = gf_slice(list('boundary',list('intersection',list('planar',+1,[0;0;0],[0;1;0]},...
                              list('planar',+1,[0;0;0],[1;0;0]))),m,6);
Usl = gf_compute(pde('mf_u'),U,'interpolate on', sl); // interpolate the solution on the slice
// show the norm of the displacement on this slice
gf_plot_slice(sl,'mesh','on','data',sqrt(sum(Usl.^2,1)),'mesh_slice_edges','off');
  
// another slice: now we take the lower part of the mesh
sl = gf_slice(list('boundary',list('intersection',list('planar',+1,[0;0;6],[0;0;-1]},...
                              list('planar',+1,[0;0;0],[0;1;0]))),m,6);
Usl = gf_compute(pde('mf_u'),U,'interpolate on', sl);
gf_plot_slice(sl,'mesh','on','data',sqrt(sum(Usl.^2,1)),'mesh_slice_edges','off');
  
// this slice contains the transparent mesh faces displayed on the picture
sl2 = gf_slice(list('boundary',list('planar',+1,[0;0;0],[0;1;0])),...
               m,6,_setdiff(all_faces',TOPfaces','rows')');
gf_plot_slice(sl2,'mesh_faces','off','mesh','on','pcolor','off'); 

// last step is to plot the streamlines
hh = [1 5 9 12.5 16 19.5]; // vertical position of the different starting points of the streamlines
H  = [zeros(2,length(hh));hh];

// compute the streamlines
tsl  = gf_slice('streamlines',pde('mf_u'),U,H);
Utsl = gf_compute(pde('mf_u'),U,'interpolate on', tsl);

// render them with "tube plot"
[a,h] = gf_plot_slice(tsl,'mesh','off','tube_radius',.2,'tube_color','white');

See Also


Report an issue
<< gf_plot_mesh sci_getfem gf_poly >>