.TH "bamg" 1rheolef "Mon Sep 19 2022" "Version 7.2" "rheolef" \" -*- nroff -*- .ad l .nh .SH NAME bamg \- bidimensional anisotropic mesh generator (rheolef-7\&.2) .PP .SH "SYNOPSIS" .PP .PP .nf bamg [options] -g file[\&.bamgcad] -o ouput\&.bamg .fi .PP .SH "EXAMPLE" .PP .PP .nf bamg -g toto\&.bamgcad -o toto\&.bamg .fi .PP This command generates the mesh of a square ]1,1[^2 with a mesh size h=0\&.666 at all vertices\&. The geometry in defined in the following \fCsquare\&.bamgcad\fP file: .PP .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 .fi .PP The file starts with vertices, coordinates and identifier\&. Then come the boundary edges, using vertices identifiers and defining a boundary edge identifier\&. .SH "OUTLINE" .PP This software present five modes of action: .PP .IP "1." 4 \fBcreate\fP a mesh from a geometry .IP "2." 4 \fBadapt\fP a mesh from an existing background mesh using a metric or a solution file\&. .IP "3." 4 \fBbuild a metric\fP file, e\&.g\&. if you have another mesh generator\&. .IP "4." 4 \fBimprove the quality\fP of an existing mesh, by generating a new mesh\&. .IP "5." 4 \fBinterpolate\fP a field defined on one mesh to another one\&. .PP .SH "1) CREATE" .PP Create a mesh from a geometry\&. For instance: .PP .nf bamg -g toto\&.bamgcad -o toto\&.bamg .fi .PP The create mode supports the following options: .PP \fC-g\fP \fIfilename\fP .PP .RS 4 The input file, specifying the geometry boundaries of the domain to mesh (\fCbamg\fP file format \fCDB mesh\fP)\&. .RE .PP \fC-o\fP \fIfilename\fP .PP .RS 4 The output mesh file (\fCbamg\fP file format \fCDB mesh\fP)\&. Some alternatives output file formats are supported with some \fC-oXY\fP options where \fCXY\fP is one of the supported output file formats (see below)\&. .PP .RE .PP In addition, optional parameter can be added to specify a metric or the quality improvement\&. All these options are described below\&. .SH "2) ADAPT" .PP Adapt a mesh from a background mesh using a metric or solution file\&. For instance: .PP .nf bamg -b toto_bgd\&.bamg -Mbb toto_bgd_sol\&.bb -o toto_new\&.bamg .fi .PP The adapt mode supports the following options: .PP \fC-b\fP \fIfilename\fP .PP .RS 4 The input background mesh, where the file suffixe defines the format of the file: \fC\&.amdba\fP, \fC\&.am_fmt\fP, \fC\&.am\fP, \fC\&.ftq\fP, \fC\&.nopo\fP\&. Otherwise the file is the bamg default \fCBD mesh\fP file format\&. .RE .PP \fC-Mbb\fP \fIfilename\fP .br \fC-MBB\fP \fIfilename\fP .br \fC-M\fP \fIfilename\fP .PP .RS 4 The input metric file\&. The \fC-Mbb\fP or \fC-MBB\fP specifies the solution file from which the metric is automatically computed, where the file is of type \fCbb\fP or \fCBB\fP (see file format below)\&. An alternative is to specify directly the metric with the \fC-M\fP option (file format \fCMetric\fP)\&. .RE .PP \fC-o\fP \fIfilename\fP .PP .RS 4 The output mesh file (bamg file format \fCDB mesh\fP)\&. Some alternatives output file formats are supported with some \fC-oXY\fP options where \fCXY\fP is one of the supported output file formats (see below)\&. .RE .PP In addition, optional parameter can be added to control the metric generation and the quality improvement\&. All these options are described below\&. .SH "3) METRIC BUILD" .PP 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 mesh generator\&. For instance: .PP .nf bamg -r toto_bgd\&.bamg -Mbb toto_bgd_sol\&.bb -oM toto_bgd\&.metric .fi .PP The metric build mode supports the following options: .PP \fC-r\fP \fIfilename\fP .PP .RS 4 The input mesh file (bamg format \fCDB mesh\fP)\&. .RE .PP \fC--Mbb\fP \fIfilename\fP .br \fC--MBB\fP *filename .PP .RS 4 The input provided solution, where the file is of type \fC\&.bb\fP or \fC\&.BB\fP (see file format below)\&. .RE .PP \fC-oM\fP \fIfilename\fP .PP .RS 4 The output metric file, in file format \fCMetric\fP (see file format below)\&. .RE .PP In addition, optional parameter can be added to control the metric generation\&. All these options are described below\&. .SH "4) IMPROVE QUALITY" .PP Improve quality for an existing mesh and generate a new mesh\&. For instance: .PP .nf bamg -r toto_bgd\&.bamg -M toto_bgd\&.metric -o toto_new\&.bamg .fi .PP The quality improvement mode supports the following options: .PP \fC-r\fP \fIfilename\fP .PP .RS 4 The input mesh file (bamg format \fCDB mesh\fP)\&. .RE .PP \fC-M\fP \fIfilename\fP .PP .RS 4 The input metric file, in file format \fCMetric\fP (see file format below)\&. .RE .PP \fC-o\fP \fIfilename\fP .PP .RS 4 The output mesh file (bamg file format \fCDB mesh\fP)\&. Some alternatives output file formats are supported with some \fC-oXY\fP options where \fCXY\fP is one of the supported output file formats (see below)\&. .RE .PP .SH "5) INTERPOLATE" .PP 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 transferred solution may be a good initial guess for the solution on the new mesh\&. This interpolation is carried out in a P1 Lagrange context\&. .PP .nf bamg -b toto_old\&.bamg -rbb toto_old\&.bb -r toto_new\&.bamg -obb toto_new\&.bb .fi .PP The interpolation mode supports the following options: .PP \fC-b\fP \fIfilename\fP .PP .RS 4 The destination input mesh file (bamg format \fCDB mesh\fP)\&. .RE .PP \fC-rbb\fP \fIfilename\fP .br \fC-rBB\fP *filename .PP .RS 4 The origin input solution, where the file is of type \fC\&.bb\fP or \fC\&.BB\fP (see file format below)\&. .RE .PP \fC-r\fP \fIfilename\fP .PP .RS 4 The origin input mesh file (bamg format \fCDB mesh\fP)\&. .RE .PP \fC-wbb\fP \fIfilename\fP .br \fC-wBB\fP \fIfilename\fP .PP .RS 4 The output solution, as reinterpolated on the destination mesh\&. .RE .PP .SH "CREATION OPTIONS" .PP \fC-hmax\fP \fIfloat\fP .PP .RS 4 Set the value of the maximal edge size\&. Default value is the diameter of the domain to be meshed\&. .RE .PP \fC-hmin\fP \fIfloat\fP .PP .RS 4 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)\&. .RE .PP \fC-errg\fP \fIfloat\fP .PP .RS 4 Set the value of the relative error on geometry of the boundary\&. Default value is 0\&.1\&. In any case this value is greater than 1/sqrt(2)\&. Remark that mesh size created by this option can be smaller than the \fChmin\fP argument due to geometrical constraint\&. .RE .PP \fC-nbv\fP \fIint\fP .PP .RS 4 Set the maximal number of vertices of the generated mesh\&. Default value is 50000\&. .RE .PP .SH "ADAPTATION OPTIONS" .PP 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\&. .PP \fC-RelError\fP .PP .RS 4 Compute the metric with a relative error\&. This is the default\&. In this case, the metric field is defined by .PP .nf 1 |H(x)| M(x) = ---------- -------------------- err*coef^2 max(CutOff,|eta(x)|) .fi .PP .RE .PP .PP .RS 4 where \fCerr\fP, \fCcoef\fP, \fCCutOff\fP are adjustable parameters defined below, \fCeta\fP is the solution field read in the input file and \fCH\fP is its Hessian\&. Here \fC|eta|\fP denotes the absolute value of the field \fCeta\fP and \fC|H|\fP is the tensor field composed of the absolute values of the Hessian eigenvalues and with the same eigenbasis as \fCH\fP\&. .PP .RE .PP \fC-AbsError\fP .PP .RS 4 Compute the metric with an absolute error\&. In this case, the metric is defined by .PP .nf 1 |H(x)| M(x) = ---------- --------------------- err*coef^2 (sup(eta) - inf(eta)) .fi .PP .RE .PP .RS 4 where \fCsup(eta)\fP and \fCinf(eta)\fP denotes the two extremal values of the input solution field \fCeta\fP\&. .RE .PP .PP \fC-coef\fP \fIfloat\fP .PP .RS 4 The multiplicative coefficient on the mesh size\&. Default value is 1\&.0\&. .RE .PP \fC-err\fP \fIfloat\fP .PP .RS 4 The level of the \fCP1\fP interpolation error\&. Default value is 0\&.01\&. Recall that this error behaves as \fCO(h^2)\fP locally, where \fCh\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 \fCcoef\fP} or \fCerr\fP are specified in order to generate a convergent mesh family\&. .RE .PP \fC-CutOff\fP \fIfloat\fP .PP .RS 4 The cut-off value used for the relative error criteria\&. Default value is 1e-5\&. .RE .PP \fC-power\fP \fIfloat\fP .PP .RS 4 Set the power parameter of hessian to construct the metric\&. Default value is 1\&. .RE .PP \fC-NbJacobi\fP \fIint\fP .PP .RS 4 Set the number of iterations in a smoothing procedure during the metric construction\&. The 0 value implies no smoothing\&. Default value is 1\&. .PP .RE .PP \fC-ratio\fP \fIfloat\fP .PP .RS 4 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\&. .PP .RE .PP \fC-aniso\fP .br \fC-iso\fP The \fC-anio\fP enforces the metric to be anisotropic\&. This is the default\&. Conversely, the metric may be of isotropic type with the \fC-iso\fP flag\&. .PP \fC-anisomax\fP \fIfloat\fP .PP .RS 4 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 \fCanisomax\fP\&. The default value is 1e6\&. Remark that when \fCanisomax\fP=1, the generated mesh is isotropic\&. .PP .RE .PP \fC-hminaniso\fP \fIfloat\fP .PP .RS 4 Set the value of \fIhmin\fP the minimal edge size and set the aniso mode\&. .RE .PP \fC-maxsubdiv\fP \fIfloat\fP .PP .RS 4 Change the metric such that the maximal subdivision of a background's edge is bound by the \fImaxsubdiv\fP number\&. The \fImaxsubdiv\fP number is alway limited by 10 and this is the default value\&. .RE .PP \fC-KeepBackVertices\fP .br \fC-noKeepBackVertices\fP .PP .RS 4 Try to Keep old vertices (default)\&. Otherwise, all vertices are created from scratch\&. .RE .PP \fC-NoRescaling\fP .br \fC-Rescaling\fP .PP .RS 4 Don't rescale the solution between [0,1] before metric computation Default is to rescale\&. .RE .PP .SH "QUALITY IMPROVEMENT OPTIONS" .PP \fC-NbSmooth\fP \fIint\fP .PP .RS 4 Set the number of iterations of the mesh smoothing procedure\&. Default value is 3\&. .RE .PP \fC-omega\fP \fIfloat\fP .PP .RS 4 Set the relaxation parameter of the smoothing procedure, Default value is 1\&.8\&. .RE .PP \fC-splitpbedge\fP .br \fC-nosplitpbedge\fP .PP .RS 4 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 \fC-splitpbedge\fP option, this edge is splited in two, and this situation is avoided\&. By default, don't split\&. .RE .PP \fC-thetaquad\fP \fIfloat\fP .PP .RS 4 To create quad with 2 triangles Merge two triangles into a quadrilateral when the four angles of the quadrilateral are in the range [thetaquad, 180-thetaquad]\&. .RE .PP \fC-2\fP .PP .RS 4 To create the mesh with a mesh size divided by two\&. .PP .RE .PP \fC-2q\fP .PP .RS 4 To split all triangles in three quadrilaterals, and to split all quadrilaterals in four\&. .PP .RE .PP .SH "OUTPUT MESH FORMAT OPTIONS" .PP \fC-o\fP \fIfilename\fP .PP .RS 4 bamg DB mesh file format (default)\&. .RE .PP \fC-oamdba\fP *filename .PP .RS 4 amdba format\&. .RE .PP \fC-oftq\fP *filename .PP .RS 4 ftq format\&. .RE .PP \fC-omsh\fP *filename .PP .RS 4 msh format (freefem3 format)\&. .RE .PP \fC-oam_fmt\fP *filename .PP .RS 4 am_fmt format\&. .RE .PP \fC-oam\fP *filename .PP .RS 4 am format\&. .RE .PP \fC-onopo\fP *filename .PP .RS 4 nopo format\&. .PP .RE .PP .SH "OTHERS OPTIONS" .PP \fC-thetamax\fP \fIfloat\fP .PP .RS 4 Set the angular limit for a corner in degre to be curved\&. The angle is defined from two normals of two consecutives 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 (\fCam_fmt\fP, \fCamdba\fP, \fCnopo\fP, etc)\&. This parameter is normally specified in the geometry boundaries file (in BD file format) by the \fCAngleOfCornerBound\fP optional section: when this file format is used, this option has no effet\&. .RE .PP \fC-v\fP \fIint\fP .PP .RS 4 Set the level of printing (verbosity), which can be chosen between 0 and 10\&. Default value is 1\&. .RE .PP .SH "GEOMETRY FILE FORMAT (BAMGCAD)" .PP 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: .PP .nf MeshVersionFormatted 0 Dimension 2 Vertices nv {x_k y_k i_k} k=1:nv Edges ne {i_l j_l k_l} l=1:ne .fi .PP Next, the optional sections: .PP .nf SubDomain nd {2 ie_k orient id_k} k=1:nd .fi .PP A sub-domain, i\&.e\&. a bounded connex components of the plan is defined using one edge identifier \fCie\fP along with an orientation information \fCorient\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 \fCid\fP\&. If no sub-domain are defined, then we suppose to mesh all the bounded connex component of the plan\&. Remark: \fCSubDomainFromGeom\fP is equivalent to \fCSubDomain\fP\&. .PP .nf AngleOfCornerBound angle .fi .PP The \fCAngleOfCornerBound\fP specifies the angular limit for a corner in degree to be curved\&. The angle is defined from two normals of two consecutives 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 the following list: .PP .nf Corners nc {i_k} k=1:nc .fi .PP 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: .PP .IP "\(bu" 2 an edge whose endpoints are corners and if no additional information are provided will be represented by a straight segment, .IP "\(bu" 2 an edge whose endpoints are corners but whose tangent is provided at one endpoint will be represented by a curve of degree two, .IP "\(bu" 2 an edge whose endpoints are corners but whose tangents are provided at these corners will be represented by a curve of degree three, .IP "\(bu" 2 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\&. .PP .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: .PP .nf TangentAtEdges nt {ie_k ive_k xt yt} k=1:nt .fi .PP For the edge identifier \fCie\fP, the tangent at its \fCive\fP vertex (\fCive\fP takes value 1 or 2) is specified by its components \fCxt\fP and \fCyt\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: .PP .nf RequiredVertices nrv {iv_k} k=1:nrv RequiredEdges nre {ie_k} k=1:nre .fi .PP .SH "FUTURE OPTIONS" .PP The following features are planed for future work\&. For periodic boundary conditions, the section \fCEquivalencedEdges\fP indicates that two edges must be meshed the same way: .PP .nf EquivalencedEdges nee {ie1_k ie2_k} k=1:nee .fi .PP Crack definition is the purpose of the \fCCrackedEdges\fP section\&. We specify then that an edge is identical in terms of geometry to another edge: .PP .nf CrackedEdges nce {ie1_k ie2_k} k=1:nce .fi .PP .SH "MORE READING" .PP The original site of the bamg mesh generator is http://www.ann.jussieu.fr/hecht/ftp/bamg \&. Please read http://www.ann.jussieu.fr/hecht/ftp/bamg/bamg.pdf for the detailed file formats and more advanced examples, e\&.g\&. a mesh adaptation loop to minimize the P1 Lagrange interpolation error\&. .SH "AUTHORS" .PP Frederic Hecht Frederic.Hecht@inria.fr is the author of bamg\&. .br Pierre Saramito Pierre.Saramito@imag.fr writes this unix man page\&. .SH "COPYRIGHT" .PP Copyright (C) 1998-2018 Frederic Hecht LGPLv3+: GNU LGPL version 3 or later http://gnu.org/licenses/lgpl.html\&. This is free software: you are free to change and redistribute it\&. There is NO WARRANTY, to the extent permitted by law\&. .SH AUTHOR Pierre Saramito