halbux / sparselizard

C++ FEM library | user-friendly | multi-physics | hp-adaptive | HPC
http://www.sparselizard.org
Other
332 stars 62 forks source link

Physical region number is not defined #45

Closed mikeseese closed 2 years ago

mikeseese commented 3 years ago

I'm receiving the error

Error in 'physicalregions' object: physical region number 7 is not defined

When calling Field::setconstraint(physregion). The physical region was created with gmsh::model::addPhysicalGroup(...) function before the mesh was loaded in using the GMSH api, and the return value was used later in setconstraint(). Thoughts on how to debug this further to figure out where it's getting removed and/or if there's an issue with GMSH, Sparselizard, or my code?

It strangely happens when certain gmsh things are added or removed, and not otherwise. It seems like it's an issue with my code not synchronizing something properly, but I'm drawing a blank on how to debug this.

Thanks!

halbux commented 3 years ago

Hi Mike,

Most likely it was removed in gmsh: you can check this by saving the mesh with gmsh::write and mymesh.write in sparselizard to see the state of the mesh physical regions in both situations (my bet is you won t see the physical region in any of the two). You can check the physical regions in the mesh via gmsh gui click when opening the .msh: click on (tools?) --> visibility. You might have to also select to make the lines in the mesh visible (don t know why but gmsh hides them by default in 2d) by double click on the mesh -> one of the tab, probably visibility --> lines.

In sparselizard you can also set the mesh loading verbosity to 2 to get the list of apl physicap regions found:

mesh mymesh("yourmesh.msh", 2);

Hope this helps,

Alex

On Wed, 11 Aug 2021, 07:54 Mike Seese, @.***> wrote:

I'm receiving the error

Error in 'physicalregions' object: physical region number 7 is not defined

When calling Field::setconstraint(physregion). The physical region was created with gmsh::model::addPhysicalGroup(...) function before the mesh was loaded in using the GMSH api, and the return value was used later in setconstraint(). Thoughts on how to debug this further to figure out where it's getting removed and/or if there's an issue with GMSH, Sparselizard, or my code?

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/halbux/sparselizard/issues/45, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJBHACCHDVHIBI7BQLJX43T4H7B5ANCNFSM5B5POFCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

halbux commented 3 years ago

Also: sparselizard allows to define regions at runtime and also when loading the mesh. Thinks about that option to avoid in some cases the need to do that in gmsh. Example:

int bnd = selectintersection...

or at mesh loading time:

mesh mymesh; mymesh.selectskin(skin); ... mymesh.load("mesh.msh");