Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ND_R2D visualization with glvis fails #291

Open
Rickbude opened this issue Jul 17, 2024 · 7 comments
Open

ND_R2D visualization with glvis fails #291

Rickbude opened this issue Jul 17, 2024 · 7 comments
Assignees

Comments

@Rickbude
Copy link

Rickbude commented Jul 17, 2024

This is a companion issue to the identically-named issue in MFEM: mfem/mfem#4403

Loading a solution that is expressed in terms of ND_R1D, ND_R2D, RT_R1D and RT_R2D elements gives an error that looks like:

Verification failed: (dim >= 1 && dim <= 3) is false:
 --> ND_FECollection requires 1 <= dim <= 3.
 ... in function: mfem::ND_FECollection::ND_FECollection(int, int, int, int)
 ... in file: /home/rick/tmp/mfem/fem/fe_coll.cpp:2708

Aborted (core dumped)

This error is caused by missing code in MFEM (see the linked issue for more information). Adding the missing code resolves things on the MFEM side, but now glvis throws a segmentation fault. This is the trace obtained with gdb:

#0  0x00007ffff5e195aa in _XEventsQueued () from /lib64/libX11.so.6
#1  0x00007ffff5df5e87 in XCheckIfEvent () from /lib64/libX11.so.6
#2  0x00007ffff6a0c3a5 in ?? () from /lib64/libSDL2-2.0.so.0
#3  0x00007ffff6951442 in ?? () from /lib64/libSDL2-2.0.so.0
#4  0x00007ffff6951867 in ?? () from /lib64/libSDL2-2.0.so.0
#5  0x000000000044a9ca in SdlMainThread::DispatchSDLEvents (this=this@entry=0x933e00 <GetMainThread()::inst>) at /home/rick/tmp/glvis/lib/sdl_main.cpp:191
#6  0x000000000044aea3 in SdlMainThread::MainLoop (this=0x933e00 <GetMainThread()::inst>, server=<optimized out>) at /home/rick/tmp/glvis/lib/sdl_main.cpp:140
#7  0x0000000000442ab4 in SdlWindow::StartSDL (server_mode=<optimized out>) at /home/rick/tmp/glvis/lib/sdl.cpp:85
#8  0x000000000042fb99 in SDLMainLoop (server_mode=<optimized out>) at /home/rick/tmp/glvis/lib/aux_vis.cpp:55
#9  0x000000000041f3d2 in main (argc=<optimized out>, argv=<optimized out>) at /home/rick/tmp/glvis/glvis.cpp:1400
@Rickbude
Copy link
Author

I noticed that loading an H1^3 space also causes glvis to crash. To be clear, the header of the solution file contains:

FiniteElementSpace
FiniteElementCollection: H1_2D_P2
VDim: 3
Ordering: 0

The errors are different from the ones reported above (no segfault), so this might be different / unrelated issue. But I thought I'd report anyway. I get various errors, like:

Using GLSL 450
VisualizationSceneVector::VisualizationSceneVector
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server "p$"
      after 301 requests (301 known processed) with 0 events remaining.

and

VisualizationSceneVector::VisualizationSceneVector
X Error of failed request:  BadCursor (invalid Cursor parameter)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Resource id in failed request:  0x12dafa50
  Serial number of failed request:  310
  Current serial number in output stream:  317

@tzanio
Copy link
Member

tzanio commented Jul 17, 2024

Can you post the mesh and the grid function you are trying to load?

@Rickbude
Copy link
Author

Of course. Please find attached 1 mesh and 3 grid functions for that mesh. (1x ND_R2D and 2x H1^3)

issue_files.zip

@tzanio
Copy link
Member

tzanio commented Jul 17, 2024

Oh, currently you can't visualize 3D vector field on a 2D mesh.

One way to do that will be to make the 2D mesh into a surface mesh embedded in 3D -- see this version.

That worked for me with the first two examples.

@Rickbude
Copy link
Author

Ahh!! And with the changes in MFEM suggested in mfem/mfem#4403, the ND_R2D vector field also loads on this surface mesh.

What would be the "proper" way of generating such a surface mesh from an existing 2D mesh? I found the following to work, but I am not sure if this is the right way to go:

mfem::Mesh surf_mesh(m_mesh);
surf_mesh.SetCurvature(m_element_order,false,3);
surf_mesh.Save("surf-mesh.mesh");

Sorry for not catching this earlier; the error messages generated by glvis did not really indicate that the mesh being 2D was the problem.

By the way: I noted that the visualization of the results on this surface mesh seems a bit restricted compared to equivalent visualizations of 2D vector fields on 2D meshes:

  • Pressing 'v' multiple times does not rescale the vector quivers (they just disappear)
  • 'F' cycles only through the magnitude and x/y/z components, not the divergence and curl.

Is this by design?

@tzanio
Copy link
Member

tzanio commented Jul 18, 2024

Yep, SetCurvature is the right way to make a 2D into a surface mesh. If you have existing 2D mesh files, you can also manually change the VDim of the nodes to 3 and add a zero at the end of each node coordinate (for the z component).

@tzanio
Copy link
Member

tzanio commented Jul 18, 2024

By the way: I noted that the visualization of the results on this surface mesh seems a bit restricted compared to equivalent visualizations of 2D vector fields on 2D meshes:

  • Pressing 'v' multiple times does not rescale the vector quivers (they just disappear)
  • F' cycles only through the magnitude and x/y/z components, not the divergence and curl.

Is this by design?

Good question, @v-dobrev or @najlkin -- do you know?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants