Create laplacian smoothing matlab
13 views (last 30 days)
Hi! I would like to create a laplacian smoothing like on the image i attach below. The necessary files I need to make this quadmesh (the mesh generator) and the nodeconnect.m file is also attached here. I managed to create a regular mesh using the quadmesh generator, but I dont know how to increase the boundaries to create a laplician smoothing mesh like on the picture.
The attached nodeconnect.m -> nodeconnect computes all nodes connected to a given node. Called as nnods = nodeconnect(nodes,inod); here nnods i a list of connected nodes to the node and nodes=p.Connectivity is the connectivity matrix. Thank you so much for your help! :)
Precise Simulation on 24 Oct 2017
Edited: Precise Simulation on 26 Oct 2017
You can get something quite similar with the following code, and tune it by playing around with the gridsmooth function, number of smoothing steps, and relaxation parameter.
nx = 24;
ny = 8;
xmin = 0;
xmax = 3;
ymin = -0.5;
ymax = 1.5;
grid = rectgrid( nx, ny, [xmin,ymin,xmax,ymax] );
if( 1 ) % Squeeze only right side y-coordinates.
grid.p(2,grid.p(1,:)==3) = linspace(0,1,ny+1);
else % Squeeze y-coordinates.
yl = linspace(-0.5,1.5,ny+1);
yr = linspace(0,1,ny+1);
y = ;
y = [ y linspace(yl(i),yr(i),nx+1) ];
grid.p(2,:) = y;
% Remove boundary indicators from upper/lower
% boundaries to allow smoothing.
b_orig = grid.b;
grid.b(:,grid.b(3,:)==1) = ; % Remove lower boundary indices.
grid.b(:,grid.b(3,:)==3) = ; % Remove upper boundary indices.
grid = gridsmooth( grid, 60, 0.1, 2 );
grid.b = b_orig;
plotgrid( grid )