Transform velocity field into wall coordinates

Interpolate velocity field on a wall-based grid. Useful to plot boundary layer
317 Downloads
Updated 9 Feb 2016

View License

[xw,yw,uw,vw,xgr,ygr,ugr,vgr] = VELOCITYPROFILE(xwall,ywall,x,y,u,v,height,varargin)
Interpolates the velocity field provided by [x,y,u,v] on a grid generated
as an offset of a 2D curve [xwall,ywall] and transforms the interpolated
field into wall coordinates, rotating each vector according to the wall
angle.
Typical example: plot of the boundary layer of an airfoil, provided the
velocity field and the airfoil points.

[xwall,ywall] are the coordinates of the wall

[x,y,u,v] are the points and the components of the velocity field (can be
both structured or unstructured)

[height] is the extent of the profile in the direction normal to the
wall

Additional input arguments are:
VELOCITYPROFILE(xwall,ywall,x,y,u,v,height,Nh,Nw,interp_type,graphic_mode)

[Nh] is number of points in which the grid is discretised vertically.
Default value is 20

[Nw] is number of points in which the grid is discretised horizontally.
By default, the points provided for the wall are used to generate the
grid. If Nw is specified, wall points are interpolated in Nw new
locations

[interp_type]: type of interpolant ('nearest', 'linear' or 'natural'), see
scatteredInterpolant for additional info on the interpolation method.
Values outside the velocity field will always be linarly extrapolated

[graphic_mode]: true or false, create two figures with the velocity data
to show the result of the conversion

Output arguments
[xw,yw,uw,vw]: are the points and the components of the velocity data
rotated into wall coordinates. The first elements of uw and vw are the
velocities for the first point of the provided wall. Elements for the
successive columns are the velocities on the successive elements of the
wall.

[xgr,ygr,ugr,vgr]: are the points and the components of the velocity data
interpolated on the wall generated grid, before the coordinate
transformation

Additional info
The direction in which the mesh is extended can be changed flipping the
wall points direction. See fliplr

The interpolation is performed using the scatteredInterpolant function,
which uses a Delaunay triangulation. If no vectors are provided on the
wall, those values will be interpolated (or extrapolated) using a
Delaunay triangulation of the entire flow field. See help
scatteredInterpolant for more information.

Run the code without any input argument to see an example

Author: Alessandro Masullo 2016

Cite As

Alessandro Masullo (2024). Transform velocity field into wall coordinates (https://www.mathworks.com/matlabcentral/fileexchange/55311-transform-velocity-field-into-wall-coordinates), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2015a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: inpaint_nans, interparc

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0.0