[Gmsh] gmsh/bamg - use of bgm posfiles???

trophime christophe.trophime at lncmi.cnrs.fr
Mon Jan 30 16:58:48 CET 2012


On Mon, 2012-01-30 at 14:20 +0100, trophime wrote:
> On Mon, 2012-01-30 at 11:53 +0100, trophime wrote:
> > On Fri, 2012-01-27 at 17:53 +0100, Christophe Geuzaine wrote:
> > > On 27 Jan 2012, at 17:46, trophime wrote:
> > > 
> > > > On Fri, 2012-01-27 at 17:28 +0100, Cécile CD. DAVERSIN wrote:
> > > >>        Hi
> > > >>        I would like tu use bamg algo to get an anisotropic mesh.
> > > >>        I wish to use a metric as a background mesh and generate the
> > > >>        anistropic mesh from it :
> > > >> 
> > > >>        gmsh -2 geofile  -algo bamg -bgm metrics.pos
> > > >> 
> > > >> 
> > > > 
> > > > Using a bgm in this context does not work.
> > > > 
> > > > *) The bgm file is always treated as "isotropic" :
> > > > 
> > > > in void PostViewField::operator() (double x, double y, double z,
> > > > SMetric3 &metr, GEntity *ge=0) :
> > > > virtual bool PostViewField::isotropic () const always return true
> > > > as v is null!
> > > > 
> > > > *) the bgm is not taken into account. In fact it tries to 
> > > > get a metric from some """formula""" (see BGM_MeshMetric) 
> > > > just like in  http://www.geuz.org/pipermail/gmsh/2012/006970.html
> > > > 
> > > > It would be really great if we can use bgm metrics...
> > > > 
> > > 
> > > Hi Christophe - I coded this in a hurry and did not have time to test it... I've committed a small patch: can you try again?
> > 
> > Ok now PostViewField::isotropic () returns the "right" value in case of
> > anisotropic metric bgm. Thanks
> > 
> > However my metrics seems not not to be read properly.
> > I don't know why yet.

gmsh fails to read tensor from bgm file for a number of points, ex:
Info    : No tensor element found containing point (0.707107,0.707107,0)

The problem comes from :
int triangle::isInside(double u, double v, double w)

see for instance the output : 

triInEle virtual void xyz2uvw : 
uvw[]=[-1.67675e-06 -5.3921e-08 0 ] iter=3, error=0

triangle::isInside (-1.67675e-06,-5.3921e-08,0) : 
u < ZERO : 1, 
v < ZERO : 0, ????? 
u > (ONE - v) : 0

so tri.isInside=0

If a tolerance is considered in the isInside functions defined in
"Post/ShapeFunctions.h" (just like in MTriangle.h) I think there will be
no more problem...

> > 
> > Moreover I have question :
> > when using metrics you adapt the mesh using the intersection of the
> > metric M1 read from the bgm and a "default" isotropic metric M2 derived
> > from lc mesh characteristics. 
> > * Why do you use the max eigenvalues of M1 and M2 instead of the
> > eigenvalues of M1^{-1} M2?
> 
> see :
> SMetric3 intersection (const SMetric3 &m1, const SMetric3 &m2)
> {
>   SMetric3 im1 = m1.invert();
>   fullMatrix<double> V(3,3);
>   fullVector<double> S(3);
>   im1 *= m2;
>   im1.eig(V,S,true);
>   SVector3 v0(V(0,0),V(1,0),V(2,0));
>   SVector3 v1(V(0,1),V(1,1),V(2,1));
>   SVector3 v2(V(0,2),V(1,2),V(2,2));
>   double l0 = std::max(dot(v0,m1,v0),dot(v0,m2,v0)); ??
>   double l1 = std::max(dot(v1,m1,v1),dot(v1,m2,v1)); ??
>   double l2 = std::max(dot(v2,m1,v2),dot(v2,m2,v2)); ??
>   SMetric3 iv(l0,l1,l2,v0,v1,v2);
>   return iv;
> }
> 
> 
> > * Is it possible to just use M1?
> 
> I just try using M1 (ie the one I provide in the bgm file)
> I end-up with the following mesh (see the attached picture : right mesh
> is the initial mesh, left mesh is the adapted mesh). It seems that gmsh
> has trouble "reading" ("interpolating") some values in
> 
> bool OctreePost::_getValue(void *in, int dim, int nbNod, int nbComp, 
>                            double P[3], int step, double *values,
>                            double *elementSize)
> 
> 
> C.
> 
> > 
> > C. 
> > 
> > > 
> > > > Best
> > > > C
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > _______________________________________________
> > > > gmsh mailing list
> > > > gmsh at geuz.org
> > > > http://www.geuz.org/mailman/listinfo/gmsh
> > > 
> > 
> > 
> > 
> > _______________________________________________
> > gmsh mailing list
> > gmsh at geuz.org
> > http://www.geuz.org/mailman/listinfo/gmsh
> 
> _______________________________________________
> gmsh mailing list
> gmsh at geuz.org
> http://www.geuz.org/mailman/listinfo/gmsh