File Exchange

image thumbnail

gradedmesh

version 1.5 (24 KB) by

Meta-function and optional GUI that transforms linear mesh coordinates into a chosen graded mesh

0 Downloads

Updated

View License

gradedmesh is a set of utilities for creating graded mesh. A graded mesh is a symmetric mesh which becomes finer at each interval. Choosing a graded mesh is problem specific therefore having a simple and efficient utility for designing them is helpful.

The core of this module is the function meshfunc which takes two parameters. Curvature and Weight. It uses these to create a parabola y(x) which defines the graded step size vector dx. The curvature parameter is the c term in the (x-a)^c part of the parabolic equation. Thus it controls how quickly dx changes step sizes and how wide the trough of the parabola is. The weight term is the ratio between the smallest dx and the largest, so weight = 0.1 would give a graded mesh where the finest mesh scale is 10% of the largest.
Calling meshfunc(curve, weight) returns a function which can be used to transform various linear dimension vectors, all using the same curve and weight parameters used to build the function. This means that multiple applications of the returned function on linear vectors performs the same transformation on all of them, regardless of their length or range. This function returns two outputs, x and dx, the transformed coordinates of the inputs.

Example:
curve = 4;
weight = 0.2;
gmesh = meshfunc(curve, weight);

% Untransformed Coordinates
x = linspace(0, 1, 100);
y = linspace(3, 3.5, 100);
z = linspace(0, 100, 1000);

% Transformed Coordinates
[x dx] = gmesh(x)
[y dy] = gmesh(y)
[z dz] = gmesh(z)
 
plotMesh(x, z)
plotMesh(x, y)

Function meshgui opens a gui for easy selection of the meshfunc parameters: curvature and weight.

gmesh = meshgui();

Sliders allow the user to increase and decrease both parameters and visually check the appearance of the mesh.
Note: meshgui has both plotMesh and meshfunc as dependencies, it is just a GUI wrapper around these functions, so they must be in the same directory or on the matlab path.

plotMesh is a quick function for viewing the transformed graded mesh.

See the meshtest.m file included in this module for a working example.

Comments and Ratings (0)

Updates

1.5

Clean up files

1.2

Added some additional tags

1.1

Update documentation and meshtest script.

MATLAB Release
MATLAB 7.14 (R2012a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video