manpagez: man pages & more
info gmsh
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.3.1 Specifying mesh element sizes

There are three ways to specify the size of the mesh elements for a given geometry:

  1. First, if Mesh.CharacteristicLengthFromPoints is set (it is by default), you can simply specify desired mesh element sizes at the geometrical points of the model (with the Point command: see Points). The size of the mesh elements will then be computed by linearly interpolating these values on the initial mesh (see Mesh: finite element mesh generation). This might sometimes lead to over-refinement in some areas, so that you may have to add “dummy” geometrical entities in the model in order to get the desired element sizes.

    This method works with all the algorithms implemented in the mesh module. The final element sizes are of course constrained by the structured algorithms for which the element sizes are explicitly specified (e.g., transfinite and extruded grids: see Structured grids).

  2. Second, if Mesh.CharacteristicLengthFromCurvature is set (it is not by default), the mesh will be adapted with respect to the curvature of the geometrical entities.
  3. Finally, you can specify general mesh size “fields”. Various fields exist:
    • A PostView field specifies an explicit background mesh in the form of a scalar post-processing view (see Post-processing commands, and File formats) in which the nodal values are the target element sizes. This method is very general but it requires a first (usually rough) mesh and a way to compute the target sizes on this mesh (usually through an error estimation procedure, in an iterative process of mesh adaptation). Warning: only parsed (‘.pos’) files can currently be used as background meshes (‘.msh’ files cannot be used, since the mesh used to define the field will be destroyed during the meshing process).

      (Note that you can also load a background mesh directly from the command line using the -bgm option (see section Command-line options), or in the GUI by selecting ‘Apply as background mesh’ in the post-processing view option menu.)

    • A Box field specifies the size of the elements inside and outside of a parallelepipedic region.
    • A Threshold field specifies the size of the mesh according to the distance to some geometrical entities. These entities can for example be geometry points and lines specified by an Attractor field.
    • A MathEval field specifies the size of the mesh using an explicit mathematical function.
    • A Min field specifies the size as the minimum of the sizes computed using other fields

    Fields are supported by all the algorithms except those based on Netgen. The list of available fields with their options is given below.

The three aforementioned methods can be used simultaneously, in which case the smallest element size is selected at any given point.

All element sizes are further constrained by the Mesh.CharacteristicLengthMin, Mesh.CharacteristicLengthMax and Mesh.CharacteristicLengthFactor options (see section Mesh options list)

Here are the mesh commands that are related to the specification of mesh element sizes:

Characteristic Length { expression-list } = expression;

Modify the prescribed mesh element size of the points whose identification numbers are listed in expression-list. The new value is given by expression.

Field[expression] = string;

Create a new field (with id number expression), of type string.

Field[expression].string = char-expression | expression | expression-list;

Set the option string of the expression-th field.

Background Field = expression;

Select the expression-th field as the one used to compute element sizes. Only one background field can be given; if you want to combine several field, use the Min or Max field (see below).

Here is the list of all available fields with their associated options:

Attractor

Compute the distance from the nearest node in a list. It can also be used to compute the distance from curves, in which case each curve is replaced by NNodesByEdge equidistant nodes and the distance from those nodes is computed.
Options:

EdgesList

Indices of curves in the geometric model
type: list
default value: {}

FacesList

Indices of surfaces in the geometric model (Warning, this feature is still experimental. It might (read: will probably) give wrong results for complex surfaces)
type: list
default value: {}

FieldX

Id of the field to use as x coordinate.
type: integer
default value: -1

FieldY

Id of the field to use as y coordinate.
type: integer
default value: -1

FieldZ

Id of the field to use as z coordinate.
type: integer
default value: -1

NNodesByEdge

Number of nodes used to discretized each curve
type: integer
default value: 20

NodesList

Indices of nodes in the geometric model
type: list
default value: {}

AttractorAnisoCurve

Compute the distance from the nearest curve in a list. Then the mesh size can be specified independently in the direction normal to the curve and in the direction parallel to the curve (Each curve is replaced by NNodesByEdge equidistant nodes and the distance from those nodes is computed.)
Options:

EdgesList

Indices of curves in the geometric model
type: list
default value: {}

NNodesByEdge

Number of nodes used to discretized each curve
type: integer
default value: 20

dMax

Maxmium distance, above this distance from the curves, prescribe the maximum mesh sizes.
type: float
default value: 0.5

dMin

Minimum distance, bellow this distance from the curves, prescribe the minimum mesh sizes.
type: float
default value: 0.1

lMaxNormal

Maximum mesh size in the direction normal to the closest curve.
type: float
default value: 0.5

lMaxTangent

Maximum mesh size in the direction tangeant to the closest curve.
type: float
default value: 0.5

lMinNormal

Minimum mesh size in the direction normal to the closest curve.
type: float
default value: 0.05

lMinTangent

Minimum mesh size in the direction tangeant to the closest curve.
type: float
default value: 0.5

BoundaryLayer

hwall * ratio^(dist/hwall)
Options:

AnisoMax

Threshold angle for creating a mesh fan in the boundary layer
type: float
default value: 10000000000

EdgesList

Indices of curves in the geometric model for which a boundary layer is needed
type: list
default value: {}

FacesList

Indices of faces in the geometric model for which a boundary layer is needed
type: list
default value: {}

FanNodesList

Indices of vertices in the geometric model for which a fan is created
type: list
default value: {}

FansList

Indices of edges in the geometric model for which a fan is created
type: list
default value: {}

IntersectMetrics

Intersect metrics of all faces
type: integer
default value: 0

NodesList

Indices of nodes in the geometric model
type: list
default value: {}

Quads

Generate recombined elements in the boundary layer
type: integer
default value: 0

hfar

Element size far from the wall
type: float
default value: 1

hwall_n

Mesh Size Normal to the The Wall
type: float
default value: 0.1

hwall_t

Mesh Size Tangent to the Wall
type: float
default value: 0.5

ratio

Size Ratio Between Two Successive Layers
type: float
default value: 1.1

thickness

Maximal thickness of the boundary layer
type: float
default value: 0.01

Box

The value of this field is VIn inside the box, VOut outside the box. The box is given by

Xmin <= x <= XMax &&
YMin <= y <= YMax &&
ZMin <= z <= ZMax
Options:

VIn

Value inside the box
type: float
default value: 0

VOut

Value outside the box
type: float
default value: 0

XMax

Maximum X coordinate of the box
type: float
default value: 0

XMin

Minimum X coordinate of the box
type: float
default value: 0

YMax

Maximum Y coordinate of the box
type: float
default value: 0

YMin

Minimum Y coordinate of the box
type: float
default value: 0

ZMax

Maximum Z coordinate of the box
type: float
default value: 0

ZMin

Minimum Z coordinate of the box
type: float
default value: 0

Centerline

The value of this field is the distance to the centerline.

You should specify a fileName that contains the centerline. The centerline of a surface can be obtained with the open source software vmtk (http://www.vmtk.org/) using the following script:

vmtk vmtkcenterlines -seedselector openprofiles -ifile mysurface.stl -ofile centerlines.vtp –pipe vmtksurfacewriter -ifile centerlines.vtp -ofile centerlines.vtk

Options:

FileName

File name for the centerlines
type: string
default value: "centerlines.vtk"

closeVolume

Action: Create In/Outlet planar faces
type: integer
default value: 0

extrudeWall

Action: Extrude wall
type: integer
default value: 0

hLayer

Thickness (% of radius) of the extruded layer
type: float
default value: 0.3

hSecondLayer

Thickness (% of radius) of the second extruded layer
type: float
default value: 0.3

nbElemLayer

Number of mesh elements the extruded layer
type: integer
default value: 3

nbElemSecondLayer

Number of mesh elements the second extruded layer
type: integer
default value: 0

nbPoints

Number of mesh elements in a circle
type: integer
default value: 25

reMesh

Action: Cut the initial mesh in different mesh partitions using the centerlines
type: integer
default value: 0

Actions:

run

Run actions (closeVolume, extrudeWall, cutMesh)

Curvature

Compute the curvature of Field[IField]:

F = div(norm(grad(Field[IField])))
Options:

Delta

Step of the finite differences
type: float
default value: 0

IField

Field index
type: integer
default value: 1

Cylinder

The value of this field is VIn inside a frustrated cylinder, VOut outside. The cylinder is given by

||dX||^2 < R^2 &&
(X-X0).A < ||A||^2
dX = (X - X0) - ((X - X0).A)/(||A||^2) . A
Options:

Radius

Radius
type: float
default value: 0

VIn

Value inside the cylinder
type: float
default value: 0

VOut

Value outside the cylinder
type: float
default value: 0

XAxis

X component of the cylinder axis
type: float
default value: 0

XCenter

X coordinate of the cylinder center
type: float
default value: 0

YAxis

Y component of the cylinder axis
type: float
default value: 0

YCenter

Y coordinate of the cylinder center
type: float
default value: 0

ZAxis

Z component of the cylinder axis
type: float
default value: 1

ZCenter

Z coordinate of the cylinder center
type: float
default value: 0

Frustum

This field is an extended cylinder with inner (i) and outer (o) radiuseson both endpoints (1 and 2). Length scale is bilinearly interpolated betweenthese locations (inner and outer radiuses, endpoints 1 and 2)The field values for a point P are given by : u = P1P.P1P2/||P1P2|| r = || P1P - u*P1P2 || Ri = (1-u)*R1i + u*R2i Ro = (1-u)*R1o + u*R2o v = (r-Ri)/(Ro-Ri) lc = (1-v)*( (1-u)*v1i + u*v2i ) + v*( (1-u)*v1o + u*v2o ) where (u,v) in [0,1]x[0,1]
Options:

R1_inner

Inner radius of Frustum at endpoint 1
type: float
default value: 0

R1_outer

Outer radius of Frustum at endpoint 1
type: float
default value: 1

R2_inner

Inner radius of Frustum at endpoint 2
type: float
default value: 0

R2_outer

Outer radius of Frustum at endpoint 2
type: float
default value: 1

V1_inner

Element size at point 1, inner radius
type: float
default value: 0.1

V1_outer

Element size at point 1, outer radius
type: float
default value: 1

V2_inner

Element size at point 2, inner radius
type: float
default value: 0.1

V2_outer

Element size at point 2, outer radius
type: float
default value: 1

X1

X coordinate of endpoint 1
type: float
default value: 0

X2

X coordinate of endpoint 2
type: float
default value: 0

Y1

Y coordinate of endpoint 1
type: float
default value: 0

Y2

Y coordinate of endpoint 2
type: float
default value: 0

Z1

Z coordinate of endpoint 1
type: float
default value: 1

Z2

Z coordinate of endpoint 2
type: float
default value: 2.26338226046034e+146

Gradient

Compute the finite difference gradient of Field[IField]:

F = (Field[IField](X + Delta/2) - Field[IField](X - Delta/2)) / Delta
Options:

Delta

Finite difference step
type: float
default value: 0

IField

Field index
type: integer
default value: 1

Kind

Component of the gradient to evaluate: 0 for X, 1 for Y, 2 for Z, 3 for the norm
type: integer
default value: 0

Laplacian

Compute finite difference the Laplacian of Field[IField]:

F = G(x+d,y,z) + G(x-d,y,z) +
G(x,y+d,z) + G(x,y-d,z) +
G(x,y,z+d) + G(x,y,z-d) - 6 * G(x,y,z),

where G=Field[IField] and d=Delta
Options:

Delta

Finite difference step
type: float
default value: 0.1

IField

Field index
type: integer
default value: 1

LonLat

Evaluate Field[IField] in geographic coordinates (longitude, latitude):

F = Field[IField](atan(y/x), asin(z/sqrt(x^2+y^2+z^2))
Options:

FromStereo

if = 1, the mesh is in stereographic coordinates. xi = 2Rx/(R+z), eta = 2Ry/(R+z)
type: integer
default value: 0

IField

Index of the field to evaluate.
type: integer
default value: 1

RadiusStereo

radius of the sphere of the stereograpic coordinates
type: float
default value: 6371000

MathEval

Evaluate a mathematical expression. The expression can contain x, y, z for spatial coordinates, F0, F1, ... for field values, and and mathematical functions.
Options:

F

Mathematical function to evaluate.
type: string
default value: "F2 + Sin(z)"

Actions:

test

description blabla

MathEvalAniso

Evaluate a metric expression. The expressions can contain x, y, z for spatial coordinates, F0, F1, ... for field values, and and mathematical functions.
Options:

m11

element 11 of the metric tensor.
type: string
default value: "F2 + Sin(z)"

m12

element 12 of the metric tensor.
type: string
default value: "F2 + Sin(z)"

m13

element 13 of the metric tensor.
type: string
default value: "F2 + Sin(z)"

m22

element 22 of the metric tensor.
type: string
default value: "F2 + Sin(z)"

m23

element 23 of the metric tensor.
type: string
default value: "F2 + Sin(z)"

m33

element 33 of the metric tensor.
type: string
default value: "F2 + Sin(z)"

Max

Take the maximum value of a list of fields.
Options:

FieldsList

Field indices
type: list
default value: {}

MaxEigenHessian

Compute the maximum eigenvalue of the Hessian matrix of Field[IField], with the gradients evaluated by finite differences:

F = max(eig(grad(grad(Field[IField]))))
Options:

Delta

Step used for the finite differences
type: float
default value: 0

IField

Field index
type: integer
default value: 1

Mean

Simple smoother:

F = (G(x+delta,y,z) + G(x-delta,y,z) +
G(x,y+delta,z) + G(x,y-delta,z) +
G(x,y,z+delta) + G(x,y,z-delta) +
G(x,y,z)) / 7,

where G=Field[IField]
Options:

Delta

Distance used to compute the mean value
type: float
default value: 0.0001

IField

Field index
type: integer
default value: 0

Min

Take the minimum value of a list of fields.
Options:

FieldsList

Field indices
type: list
default value: {}

MinAniso

Take the intersection of a list of possibly anisotropic fields.
Options:

FieldsList

Field indices
type: list
default value: {}

Param

Evaluate Field IField in parametric coordinates:

F = Field[IField](FX,FY,FZ)

See the MathEval Field help to get a description of valid FX, FY and FZ expressions.
Options:

FX

X component of parametric function
type: string
default value: ""

FY

Y component of parametric function
type: string
default value: ""

FZ

Z component of parametric function
type: string
default value: ""

IField

Field index
type: integer
default value: 1

PostView

Evaluate the post processing view IView.
Options:

CropNegativeValues

return LC_MAX instead of a negative value (this option is needed for backward compatibility with the BackgroundMesh option
type: boolean
default value: 1

IView

Post-processing view index
type: integer
default value: 0

Restrict

Restrict the application of a field to a given list of geometrical curves, surfaces or volumes.
Options:

EdgesList

Curve indices
type: list
default value: {}

FacesList

Surface indices
type: list
default value: {}

IField

Field index
type: integer
default value: 1

RegionsList

Volume indices
type: list
default value: {}

Structured

Linearly interpolate between data provided on a 3D rectangular structured grid.

The format of the input file is:

Ox Oy Oz
Dx Dy Dz
nx ny nz
v(0,0,0) v(0,0,1) v(0,0,2) ...
v(0,1,0) v(0,1,1) v(0,1,2) ...
v(0,2,0) v(0,2,1) v(0,2,2) ...
... ... ...
v(1,0,0) ... ...

where O are the coordinates of the first node, D are the distances between nodes in each direction, n are the numbers of nodes in each direction, and v are the values on each node.
Options:

FileName

Name of the input file
type: path
default value: ""

OutsideValue

Value of the field outside the grid (only used if the "SetOutsideValue" option is true).
type: float
default value: 0

SetOutsideValue

True to use the "OutsideValue" option. If False, the last values of the grid are used.
type: boolean
default value: 0

TextFormat

True for ASCII input files, false for binary files (4 bite signed integers for n, double precision floating points for v, D and O)
type: boolean
default value: 0

Threshold

F = LCMin if Field[IField] <= DistMin,
F = LCMax if Field[IField] >= DistMax,
F = interpolation between LcMin and LcMax if DistMin < Field[IField] < DistMax
Options:

DistMax

Distance from entity after which element size will be LcMax
type: float
default value: 10

DistMin

Distance from entity up to which element size will be LcMin
type: float
default value: 1

IField

Index of the field to evaluate
type: integer
default value: 0

LcMax

Element size outside DistMax
type: float
default value: 1

LcMin

Element size inside DistMin
type: float
default value: 0.1

Sigmoid

True to interpolate between LcMin and LcMax using a sigmoid, false to interpolate linearly
type: boolean
default value: 0

StopAtDistMax

True to not impose element size outside DistMax (i.e., F = a very big value if Field[IField] > DistMax)
type: boolean
default value: 0


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on February 9, 2014 using texi2html 5.0.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.