[Gmsh] anisotropic 2D mesh at face boundary
walter steffe
steffe at tiscali.it
Fri Jan 14 17:31:45 CET 2011
> Have you tryed gmsh -algo bamg ?
Yes I am using bamg.
The choice in done in the following lines
int argc=3;
char *argv[argc];
char str1[]="-algo"; argv[1]=str1;
char str2[]="bamg"; argv[2]=str2;
GmshInitialize(argc, argv);
then I have:
GModel *gm=new GModel();
gm->importOCCShape(&theFaces);
mesher_setTags(gm, ocaf->indexedFaces, ocaf->indexedEdges);
for(GModel::fiter fit = gm->firstFace(); fit != gm->lastFace(); ++fit){
GFace *gf=*fit;
gf->meshAttributes.Method=MESH_UNSTRUCTURED;
}
CTX::instance()->mesh.lcFromPoints=0;
CTX::instance()->mesh.lcFromCurvature=1;
CTX::instance()->mesh.minCircPoints=6;
CTX::instance()->mesh.anisoMax=2;
CTX::instance()->mesh.smoothRatio=1.05;
CTX::instance()->mesh.lcMax=meshsize;
gm->mesh(1);
mesher_setModelBLayer_(gm, meshsize);
gm->mesh(2);
where mesher_setModelBLayer is:
void mesher_setModelBLayer_(GModel *gm, double meshsize){
FieldManager *fields = gm->getFields();
Field *attractor=fields->newField(0, "Attractor");
for(GModel::eiter it = gm->firstEdge(); it != gm->lastEdge(); it++){
GEdge *ge=(*it);
attractor->options["EdgesList"]->list().push_back(ge->tag());
}
Field *blayer=fields->newField(1, "BoundaryLayer");
blayer->options["IField"]->numericalValue(0);
blayer->options["hwall_t"]->numericalValue(meshsize);
blayer->options["hwall_n"]->numericalValue(meshsize/1.5);
blayer->options["hfar"]->numericalValue(meshsize);
blayer->options["ratio"]->numericalValue(1.0);
fields->background_field=1;
}
Walter