.\" .de Id .. .de Sp .if n .sp .if t .sp 0.4 .. .TH adapt 4rheolef "rheolef-7.0" "rheolef-7.0" "rheolef-7.0" .\" label: /*Class: .SH NAME \fBadapt\fP - mesh adaptation .\" skip: @findex adapt .\" skip: @clindex field .\" skip: @clindex geo .\" skip: @clindex adapt_option .PP .SH SYNOPSIS geo adapt (const field& phi); geo adapt (const field& phi, const adapt_option& opts); .SH DESCRIPTION .\" skip: @toindex bamg .\" skip: @toindex gmsh The function \fBadapt\fP implements the mesh adaptation procedure, based on the \fBgmsh\fP (isotropic) or \fBbamg\fP (anisotropic) mesh generators. The \fBbamg\fP mesh generator is the default in two dimension. For dimension one or three, \fBgmsh\fP is the only generator supported yet. In the two dimensional case, the \fBgmsh\fP correspond to the \fBopts.generator="gmsh"\fP. .PP The strategy based on a metric determined from the Hessian of a scalar governing field, denoted as \fBphi\fP, and that is supplied by the user. Let us denote by \fBH=Hessian(phi)\fP the Hessian tensor of the field \fBphi\fP. Then, \fB|H|\fP denote the tensor that has the same eigenvector as \fBH\fP, but with absolute value of its eigenvalues: .\" begin_example .Sp .nf |H| = Q*diag(|lambda_i|)*Qt .Sp .fi .\" end_example The metric \fBM\fP is determined from \fB|H|\fP. Recall that an isotropic metric is such that \fBM(x)=hloc(x)^(-2)*Id\fP where \fBhloc(x)\fP is the element size field and \fBId\fP is the identity \fBd*d\fP matrix, and \fBd=1,2,3\fP is the physical space dimension. .PP .SH GMSH ISOTROPIC METRIC .\" begin_example .Sp .nf max_(i=0..d-1)(|lambda_i(x)|)*Id M(x) = ----------------------------------------- err*hcoef^2*(sup_y(phi(y))-inf_y(phi(y))) .Sp .fi .\" end_example Notice that the denominator involves a global (absolute) normalization \fBsup_y(phi(y))-inf_y(phi(y))\fP of the governing field \fBphi\fP and the two parameters \fBopts.err\fP, the target error, and \fBopts.hcoef\fP, a secondary normalization parameter (defaults to 1). .PP .SH BAMG ANISOTROPIC METRIC There are two approach for the normalization of the metric. The first one involves a global (absolute) normalization: .\" begin_example .Sp .nf |H(x))| M(x) = ----------------------------------------- err*hcoef^2*(sup_y(phi(y))-inf_y(phi(y))) .Sp .fi .\" end_example The first one involves a local (relative) normalization: .\" begin_example .Sp .nf |H(x))| M(x) = ----------------------------------------- err*hcoef^2*(|phi(x)|, cutoff*max_y|phi(y)|) .Sp .fi .\" end_example Notice that the denominator involves a local value \fBphi(x)\fP. The parameter is provided by the optional variable \fBopts.cutoff\fP; its default value is \fB1e-7\fP. The default strategy is the local normalization. The global normalization can be enforced by setting \fBopts.additional="-AbsError"\fP. .PP When choosing global or local normalization ? .PP When the governing field \fBphi\fP is bounded, i.e. when \fBerr*hcoef^2*(sup_y(phi(y))-inf_y(phi(y)))\fP will converge versus mesh refinement to a bounded value, the global normalization defines a metric that is mesh-independent and thus the adaptation loop will converge. .PP .\" skip: @cindex corner singularity Otherwise, when \fBphi\fP presents singularities, with unbounded values (such as corner singularity, i.e. presents peacks when represented in elevation view), then the mesh adaptation procedure is more difficult. The global normalization divides by quantities that can be very large and the mesh adaptation can diverges when focusing on the singularities. In that case, the local normalization is preferable. Moreover, the focus on singularities can also be controlled by setting \fBopts.hmin\fP not too small. .PP The local normalization has been chosen as the default since it is more robust. When your field \fBphi\fP does not present singularities, then you can swith to the global numbering that leads to a best equirepartition of the error over the domain. .\" END .SH IMPLEMENTATION .\" begin_example .Sp .nf struct adapt_option { typedef std::vector::size_type size_type; std::string generator; bool isotropic; Float err; Float errg; Float hcoef; Float hmin; Float hmax; Float ratio; Float cutoff; size_type n_vertices_max; size_type n_smooth_metric; bool splitpbedge; Float thetaquad; Float anisomax; bool clean; std::string additional; bool double_precision; Float anglecorner; // angle below which bamg considers 2 consecutive edge to be part of // the same spline adapt_option() : generator(""), isotropic(true), err(1e-2), errg(1e-1), hcoef(1), hmin(0.0001), hmax(0.3), ratio(0), cutoff(1e-7), n_vertices_max(50000), n_smooth_metric(1), splitpbedge(true), thetaquad(std::numeric_limits::max()), anisomax(1e6), clean(false), additional("-RelError"), double_precision(false), anglecorner(0) {} }; template geo_basic adapt ( const field_basic& phi, const adapt_option& options = adapt_option()); .Sp .fi .\" end_example .SH COPYRIGHT Copyright (C) 2000-2018 Pierre Saramito GPLv3+: GNU GPL 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.