Skip to content

Mesh File Formats

Sourabh Bhat edited this page Jul 31, 2019 · 11 revisions

Mesh File Formats

File format for ASCII (numbers written using ASCII characters):

Structured Mesh

An example of structured mesh is given below.

% Mesh description
dimension = 3  % 1, 2 or 3
mode = ASCII   % ASCII or BINARY
xi = 3         % for dimension 1, 2 and 3
eta = 2        % for dimension 2 and 3
zeta = 5       % for dimension 3 only

% mesh point co-ordinates below (x y z)
% separated by one or more spaces (delimited using "\\s+").
1.00000000000000000000    0.49999999999999956000    2.33012701892219360000   
4.75000000000000000000    0.49999999999999956000    2.33012701892219360000   
8.50000000000000000000    0.49999999999999956000    2.33012701892219360000   
12.25000000000000000000   0.49999999999999956000    2.33012701892219360000   
16.00000000000000000000   0.49999999999999956000    2.33012701892219360000   
1.00000000000000000000    1.99999999999999960000    4.92820323027551000000   
4.75000000000000000000    1.99999999999999960000    4.92820323027551000000   
8.50000000000000000000    1.99999999999999960000    4.92820323027551000000   
12.25000000000000000000   1.99999999999999960000    4.92820323027551000000   
16.00000000000000000000   1.99999999999999960000    4.92820323027551000000   
1.00000000000000000000    2.76858475374113400000    -0.49647100247863360000  
4.75000000000000000000    2.76858475374113400000    -0.49647100247863360000  
8.50000000000000000000    2.76858475374113400000    -0.49647100247863360000  
12.25000000000000000000   2.76858475374113400000    -0.49647100247863360000  
16.00000000000000000000   2.76858475374113400000    -0.49647100247863360000  
1.00000000000000000000    5.62973560598581500000    0.40564639603418630000   
4.75000000000000000000    5.62973560598581500000    0.40564639603418630000   
8.50000000000000000000    5.62973560598581500000    0.40564639603418630000   
12.25000000000000000000   5.62973560598581500000    0.40564639603418630000   
16.00000000000000000000   5.62973560598581500000    0.40564639603418630000   
1.00000000000000000000    2.53153893518325020000    -4.11309130870349700000  
4.75000000000000000000    2.53153893518325020000    -4.11309130870349700000  
8.50000000000000000000    2.53153893518325020000    -4.11309130870349700000  
12.25000000000000000000   2.53153893518325020000    -4.11309130870349700000  
16.00000000000000000000   2.53153893518325020000    -4.11309130870349700000  
1.00000000000000000000    5.25046229629320000000    -5.38094609392559400000  
4.75000000000000000000    5.25046229629320000000    -5.38094609392559400000  
8.50000000000000000000    5.25046229629320000000    -5.38094609392559400000  
12.25000000000000000000   5.25046229629320000000    -5.38094609392559400000  
16.00000000000000000000   5.25046229629320000000    -5.38094609392559400000

A program loop for writing the co-ordinates for the above example will look like the following.

for(xi = 0; xi < 3; xi++) {
    for(eta = 0; eta < 2; eta++) {
        for(zeta = 0; zeta < 5; zeta++) {
            double x = x(xi, eta, zeta);
            double y = y(xi, eta, zeta);
            double z = z(xi, eta, zeta);
            printf("%-20.15f %-20.15f %-20.15f\n", x, y, z);
        }
    }
}

Unstructured Mesh

An example of unstructured mesh is given below:

Unstructured Mesh
% Mesh description
dimension = 2       % 2, 3, hybrid
mode = ASCII        % ASCII or BINARY

points = 11
222.86        427.14        0.0
324.26        383.86        0.0
372.75        432.85        0.0
229.81        551.54        0.0
434.37        575.28        0.0
333.35        732.36        0.0
458.61        486.89        0.0
545.48        417.19        0.0
518.21        661.65        0.0
477.30        743.47        0.0
500.53        548.01        0.0

elements = 6
9    0    1   2    3
5    3    2   4
7    2    6   7    10    4
9    4    10  7    8
9    4    8   9    5
5    3    4   5

boundaries = 3
bname = Blue Boundary
bfaces = 3
3    0    3
3    3    5
3    5    9

bname = Green Boundary
bfaces = 4
3    0    1
3    1    2
3    2    6
3    6    7

bname = Red Boundary
bfaces = 2
3    7    8
3    8    9

Note that the point index starts from '0'

An unstructured mesh with "dimension = 2" implies that the elements are two dimensional (like triangle, quad, polygon). It does not imply that the elements are in x-y plane or even that they are in a single plane.