.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH bamg 1rheolef "rheolef-7.0" "rheolef-7.0" "rheolef-7.0" .\" label: Prog:bamg .SH NAME \fBbamg\fP - bidimensional anisotropic mesh generator .\" skip: @cindex mesh .\" skip: @fiindex @file{.bamg} bamg mesh .\" skip: @toindex @code{bamg} .SH SYNOPSIS .\" begin_example .Sp .nf bamg \fIoptions\fP -g \fIinput\fP[.bamgcad] -o \fIouput\fP[.bamg] .Sp .fi .\" end_example .SH EXAMPLE Generate the mesh of a square \fB]1,1[^2\fP with a mesh size \fBh=0.666\fP at all vertices. Enter the unix command: .\" begin_example .Sp .nf bamg -g toto.bamgcad -o toto.bamg .Sp .fi .\" end_example The geometry in defined in the \fBsquare.bamgcad\fP file: .\" begin_example .Sp .nf MeshVersionFormatted 0 Dimension 2 Vertices 4 -1 -1 1 1 -1 2 1 1 3 -1 1 4 Edges 4 1 2 1 2 3 2 3 4 3 4 1 4 hVertices 0.666 0.666 0.666 0.666 .Sp .fi .\" end_example The file starts with vertices, coordinates and identifier. Then come the boundary edges, using vertices identifiers and defining a boundary edge identifier. .SH OUTLINE This software can .\" begin table .\" start item .TP .B 1) create a mesh from a geometry .\" start item .TP .B 2) adapt a mesh from an existing background mesh using a metric or a solution file. .\" start item .TP .B 3) metric build just build a metric file, e.g. if you have another mesher . .\" start item .TP .B 3) quality improve of an existing mesh, by generating a new mesh. .\" start item .TP .B 5) interpolate a field from one mesh to another. .\" end table .PP .SH 1) CREATE Create a mesh from a geometry. Example: .\" begin_example .Sp .nf bamg -g toto.bamgcad -o toto.bamg .Sp .fi .\" end_example .\" begin table .\" start item .TP .B -g \fIfilename\fP the input file, specifying the geometry boundaries of the domain to mesh (bamg file format \fBDB mesh\fP). .\" start item .TP .B -o \fIfilename\fP the output mesh file (bamg file format \fBDB mesh\fP). Some alternatives output file formats are supported with some \fB-oXY\fP options where \fBXY\fP is one of the supported output file formats (see below). .\" end table In addition, optional parameter can be added to specify a metric or the quality improvement. All the options are described below. .SH 2) ADAPT Adapt a mesh from a background mesh using a metric or solution file. Example: .\" begin_example .Sp .nf bamg -b toto_bgd.bamg -Mbb toto_bgd_sol.bb -o toto_new.bamg .Sp .fi .\" end_example .\" begin table .\" start item .TP .B -b \fIfilename\fP the input background mesh, where the file suffixe defines the format of the file: \fB.amdba\fP, \fB.am_fmt\fP, \fB.am\fP, \fB.ftq\fP, \fB.nopo\fP. Otherwise the file is the bamg default \fBBD mesh\fP file format. .\" start item .TP .B -Mbb \fIfilename\fP .\" start item .TP .B -MBB \fIfilename\fP .\" start item .TP .B -M \fIfilename\fP The input metric file. The \fB-Mbb\fP or \fB-MBB\fP specifies the solution file from which the metric is automatically computed, where the file is of type \fBbb\fP or \fBBB\fP (see file format below). An alternative is to specify directly the metric with the \fB-M\fP option (file format \fBMetric\fP). .\" start item .TP .B -o \fIfilename\fP the output mesh file (bamg file format \fBDB mesh\fP). Some alternatives output file formats are supported with some \fB-oXY\fP options where \fBXY\fP is one of the supported output file formats (see below). .\" end table In addition, optional parameter can be added to control the metric generation and the quality improvement. All the options are described below. .SH 3) METRIC BUILD Construct a metric file for an existing mesh and with a provided solution. This option can be used without generating a new mesh, e.g. if you have another mesher. .\" begin_example .Sp .nf bamg -r toto_bgd.bamg -Mbb toto_bgd_sol.bb -oM toto_bgd.metric .Sp .fi .\" end_example .\" begin table .\" start item .TP .B -r \fIfilename\fP The input mesh file (bamg format \fBDB mesh\fP). .\" start item .TP .B --Mbb \fIfilename\fP .\" start item .TP .B --MBB \fIfilename\fP The input provided solution, where the file is of type \fBbb\fP or \fBBB\fP (see file format below). .\" start item .TP .B -oM \fIfilename\fP The output metric file, in file format \fBMetric\fP (see file format below). .\" end table In addition, optional parameter can be added to control the metric generation. All the options are described below. .SH 4) QUALITY IMPROVE Improve quality for an existing mesh and generate a new mesh. .\" begin_example .Sp .nf bamg -r toto_bgd.bamg -M toto_bgd.metric -o toto_new.bamg .Sp .fi .\" end_example .\" begin table .\" start item .TP .B -r \fIfilename\fP The input mesh file (bamg format \fBDB mesh\fP). .\" start item .TP .B -M \fIfilename\fP The input metric file, in file format \fBMetric\fP (see file format below). .\" start item .TP .B -o \fIfilename\fP the output mesh file (bamg file format \fBDB mesh\fP). Some alternatives output file formats are supported with some \fB-oXY\fP options where \fBXY\fP is one of the supported output file formats (see below). .\" end table In addition, optional parameter can be added to control the quality improvement. All the options are described below. .SH 5) INTERPOLATE In the adaption process, a solution has been computed with the background mesh. In order to transfer the solution of the problem under consideration on the new generated mesh, an interpolation of old solution is necessary. This tranferred solution may be a good initial guess for the solution on the new mesh. This interpolation is carried out in a P1 Lagrange context. .\" begin_example .Sp .nf bamg -b toto_old.bamg -rbb toto_old.bb -r toto_new.bamg -obb toto_new.bb .Sp .fi .\" end_example .\" begin table .\" start item .TP .B -b \fIfilename\fP The destination input mesh file (bamg format \fBDB mesh\fP). .\" start item .TP .B -rbb \fIfilename\fP .\" start item .TP .B -rBB \fIfilename\fP The origin input solution, where the file is of type \fBbb\fP or \fBBB\fP (see file format below). .\" start item .TP .B -r \fIfilename\fP The origin input mesh file (bamg format \fBDB mesh\fP). .\" start item .TP .B -wbb \fIfilename\fP .\" start item .TP .B -wBB \fIfilename\fP The output solution,as reinterpolated on the destination mesh. .\" end table .SH CREATION OPTIONS .\" begin table .\" start item .TP .B -hmax \fIfloat\fP Set the value of the maximal edge size. Default value is the diameter of the domain to be meshed. .\" start item .TP .B -hmin \fIfloat\fP Set the value of the minimal edge size. Default value is related to the size of the domain to be meshed and the grid resolution used by the mesh generator (machine dependent). .\" start item .TP .B -errg \fIfloat\fP Set the value of the relative error on geometry of the boundary. Default value is 0.1. In any case this value is geater than 1/sqrt(2). Remark that mesh size created by this option can be smaller than the \fBhmin\fP argument due to geometrical constraint. .\" start item .TP .B -nbv \fIint\fP Set the maximal number of vertices of the generated mesh. Default value is 50000. .\" end table .SH ADAPTATION OPTIONS These options are relevant when computing a metric from a scalar field provided in a .bb file. Notice that, when providing a tensor metric in the .bb file, the metric computation is not performed and these options are not relevant. .\" begin table .\" start item .TP .B -RelError compute the metric with a relative error. This is the default. In this case, the metric field is defined by .\" end table .\" begin_example .Sp .nf 1 |H(x)| M(x) = ---------- -------------------- err*coef^2 max(CutOff,|eta(x)|) .Sp .fi .\" end_example .\" begin table where \fBerr\fP, \fBcoef\fP, \fBCutOff\fP are adjustable parameters defined below, \fBeta\fP is the solution field read in the input file and \fBH\fP is its Hessian. Here \fB|eta|\fP denotes the absolute value of the field \fBeta\fP and \fB|H|\fP is the tensor field composed of the absolute values of the Hessian eigenvalues and with the same eigenbasis as \fBH\fP. .\" start item .TP .B -AbsError compute the metric with an absolute error. In this case, the metric is defined by .\" end table .\" begin_example .Sp .nf \fB\fP 1 |H(x)| M(x) = ---------- --------------------- \fB\fP err*coef^2 (sup(eta) - inf(eta)) .Sp .fi .\" end_example where \fBsup(eta)\fP and \fBinf(eta)\fP denotes the two extremal values of the input solution field \fBeta\fP. .\" begin table .\" start item .TP .B -coef \fIfloat\fP the multiplicative coefficient on the mesh size. Default value is 1.0. .\" start item .TP .B -err \fIfloat\fP the level of the \fBP1\fP interpolation error. Default value is 0.01. Recall that this error behaves as \fBO(h^2)\fP locally, where \fBh\fP is the local mesh size. Remark on the two previous formulae that a change by a factor 1/4 is equivalent to a change by a factor 1/2 on the mesh size. So, either \fBcoef\fP or \fBerr\fP are specified in order to generate a convergent mesh family. .\" start item .TP .B -CutOff \fIfloat\fP the cut-off value used for the relative error criteria. Default value is 1e-5. .\" start item .TP .B -power \fIfloat\fP Set the power parameter of hessien to construct the metric. Default value is 1. .\" start item .TP .B -NbJacobi \fIint\fP Set the number of iterations in a smoothing procedure during the metric construction. The 0 value implies no smoothing. Default value is 1. .\" start item .TP .B -ratio \fIfloat\fP Set the ratio for a prescribed smoothing on the metric. If ratio is 0 (default value) or less than 1.1, no smoothing on the metric is done. If ratio > 1.1 the speed of mesh size variation is bounded by log(ratio). Remark tht, as val is closer to 1, the number of vertices generated increases. This may be useful to control the thickness of refined regions near shocks or boundary layers. .\" start item .TP .B -aniso .\" start item .TP .B -iso The \fB-anio\fP enforces the metric to be anisotropic. This is the default. Conversely, the metric may be of isotropic type with the \fB-iso\fP flag. .\" start item .TP .B -anisomax \fIfloat\fP Set the bound of mesh anisotropy with respect to minimal mesh size in all direction so the maximal mesh size in all direction is bounded by the ratio \fBanisomax\fP. The default value is 1e6. Remark that when \fBanisomax\fP=1, the generated mesh is isotropic. .\" start item .TP .B -hminaniso \fIfloat\fP Set the value of \fBhmin\fP the minimal edge size and set the aniso mode. .\" start item .TP .B -maxsubdiv \fIfloat\fP Change the metric such that the maximal subdivision of a background's edge is bound by the \fBmaxsubdiv\fP number. The \fBmaxsubdiv\fP number is alway limited by 10 and this is the default value. .\" start item .TP .B -KeepBackVertices .\" start item .TP .B -noKeepBackVertices Try to Keep old vertices (default). Otherwise, all vertices are created from scratch. .\" start item .TP .B -NoRescaling .\" start item .TP .B -Rescaling Don't rescale the solution between \fB[0,1]\fP before metric computation Default is to rescale. .\" end table .SH QUALITY IMPROVEMENT OPTIONS .\" begin table .\" start item .TP .B -NbSmooth \fIint\fP Set the number of iterations of the mesh smoothing procedure. Default value is 3. .\" start item .TP .B -omega \fIfloat\fP Set the relaxation parameter of the smoothing procedure, Default value is 1.8. .\" start item .TP .B -splitpbedge .\" start item .TP .B -nosplitpbedge Sometimes, an internal edge can have its two vertices on the boundary. This causes a triangle to have all its vertices on the boundary. With the \fB-splitpbedge\fP option, this edge is splited in two, and this situation is avoided. By default, don't split. .\" start item .TP .B -thetaquad \fIfloat\fP to create quad with 2 triangles Merge two triangles into a quadrilateral when the four angles of the quadrilateral are in the range \fB[thetaquad, 180-thetaquad]\fP. .\" start item .TP .B -2 to create the mesh with a mesh size divided by two. .\" start item .TP .B -2q to split all triangles in three quadrilaterls, and to split all quadrilaterals in four. .\" end table .SH OUTPUT MESH FORMAT OPTIONS .\" begin table .\" start item .TP .B -o \fIfilename\fP bamg DB mesh file format (default). .\" start item .TP .B -oamdba \fIfilename\fP amdba format. .\" start item .TP .B -oftq \fIfilename\fP ftq format. .\" start item .TP .B -omsh \fIfilename\fP msh format (freefem3 format). .\" start item .TP .B -oam_fmt \fIfilename\fP am_fmt format. .\" start item .TP .B -oam \fIfilename\fP am format. .\" start item .TP .B -onopo \fIfilename\fP nopo format. .\" end table .SH OTHERS OPTIONS .\" begin table .\" start item .TP .B -thetamax \fIfloat\fP Set the angular limit for a corner in degre to be curved. The angle is defined from two normals of two concecutives edges. The default is 180 degree, i.e. no corners are curved. This option is useful when no geometry are provided, e.g. remeshing from an other mesh file format (\fBam_fmt\fP, \fBamdba\fP, \fBnopo\fP, etc). This parameter is normally specified in the geometry boundaries file (in BD file format) by the \fBAngleOfCornerBound\fP optional section: when this file format is used, this option has no effet. .\" start item .TP .B -v \fIint\fP Set the level of printing (verbosity), which can be chosen between 0 and 10. Default value is 1. .\" end table .SH GEOMETRY FILE FORMAT (BAMGCAD) The general structure allows one to specify a mesh describing the geometry of the given domain. The identification of the boundaries are used to define boundary conditions for a partial derivative equation problem. In this case, some of the above sections are not relevant. First the required sections are: .\" begin_example .Sp .nf MeshVersionFormatted 0 Dimension 2 Vertices \fInv\fP {\fIx_k\fP \fIy_k\fP \fIi_k\fP} \fIk\fP=1:\fInv\fP Edges \fIne\fP {\fIi_l\fP \fIj_l\fP \fIk_l\fP} \fIl\fP=1:\fIne\fP .Sp .fi .\" end_example Next, the optional sections: .\" begin_example .Sp .nf SubDomain \fInd\fP {2 \fIie_k\fP \fIorient_k\fP \fIid_k\fP} \fIk=1:nd\fP .Sp .fi .\" end_example A sub-domain, i.e. a bounded connex components of the plan is defined using one edge identifier \fIie\fP along with an orientation information \fIorient\fP, indicating on which side of this entity the sub-domain lies. This feature is useful, e.g. when dealing with a domain with holes. The sub-domain number is \fIid\fP. If no sub-domain are defined, then we suppose to mesh all the bounded connex component of the plan. Remark: \fBSubDomainFromGeom\fP is equivalent to \fBSubDomain\fP. .\" begin_example .Sp .nf AngleOfCornerBound \fIangle\fP .Sp .fi .\" end_example The \fBAngleOfCornerBound\fP specifies the angular limit for a corner in degre to be curved. The angle is defined from two normals of two concecutives edges. The default is 180 degree, i.e. no corners are curved. When this angle is defined, some corners could be specified not to be curved by .\" begin_example .Sp .nf Corners \fInc\fP {\fIi_k\fP} \fIk\fP=1:\fInc\fP .Sp .fi .\" end_example The curved geometric representation of a boundary in two dimensions uses the edges provided in the data structure so as to define some curves of order three in the following way: .\" begin table .\" start item .TP .B * an edge whose endpoints are corners and if no additional information are provided will be represented by a straight segment, .\" start item .TP .B * an edge whose endpoints are corners but whose tangent is provided at one endpoint will be represented by a curve of degree two, .\" start item .TP .B * an edge whose endpoints are corners but whose tangents are provided at these corners will be represented by a curve of degree three, .\" start item .TP .B * an edge whose endpoints are not corners and with no additional information will be represented by a curve of degree three. Indeed, we use in this case the adjacent edges so as to evaluate the tangents at the edge endpoints. .\" end table .PP In short, an edge defined by two information will be approached by a straight line, three information allow one to obtain a curve of degree two and four data, a curve of degree three. The tangents are optionally specified by: .\" begin_example .Sp .nf TangentAtEdges \fInt\fP {\fIie\fP_k \fIive_k\fP \fIxt\fP \fIyt\fP} \fIk\fP=1:\fInt\fP .Sp .fi .\" end_example For the edge identifier \fIie\fP, the tangent at its \fIive\fP vertex (\fIive\fP takes value 1 or 2) is specified by its components \fIxt\fP and \fIyt\fP. Giving the tangent vector of an edge by means of the tangent vector at a point enables us to deal with the case where several edges (boundary lines) are emanating from a point. .PP The required vertices, are the vertices of the support that must be present in the mesh as element vertices. Similarly, some edges can be required: .\" begin_example .Sp .nf RequiredVertices \fInrv\fP {\fIiv_k\fP} \fIk\fP=1:\fInrv\fP RequiredEdges (\fInre\fP {\fIie_k\fP} \fIk\fP=1:\fInre\fP .Sp .fi .\" end_example The following features are planed for future work. For periodic boundary conditions, the section \fBEquivalencedEdges\fP indicates that two edges must be meshed the same way: .\" begin_example .Sp .nf EquivalencedEdges \fInee\fP {\fIie1_k\fP \fIie2_k\fP} \fIk\fP=1:\fInee\fP .Sp .fi .\" end_example Crack definition is the purpose of the \fBCrackedEdges\fP section. We specify then that an edge is identical in terms of geometry to another edge: .\" begin_example .Sp .nf CrackedEdges \fInce\fP {\fIie1_k\fP \fIie2_k\fP} \fIk\fP=1:\fInce\fP .Sp .fi .\" end_example .SH MORE READING The original site of the bamg mesh generator is \fBhttp://www.ann.jussieu.fr/hecht/ftp/bamg\fP. Please read \fBhttp://www.ann.jussieu.fr/hecht/ftp/bamg/bamg.pdf\fP for the detailed file formats and more advanced examples, e.g. a mesh adaptation loop to minimize the P1 Lagrange interpolation error. .SH CREDITS Frederic Hecht is the author of bamg. Pierre Saramito writes this unix man page. .SH COPYRIGHT Copyright (C) 1998-2018 Frederic Hecht LGPLv3+: GNU LGPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. .\" END