Skip to content

Conversation

@najlkin
Copy link
Contributor

@najlkin najlkin commented Jan 15, 2026

This PR adds visualization of complex grid functions, which are represented different ways:

  • magnitude
  • phase
  • real part
  • imaginary part

To switch the representation, you may use Q key (like for quadratures) TODO: find a better one 😄
The functions can be loaded from files as normally (the file reader recognizes the format based on the header) or through a socket stream by the new command csolution (also automatically detected).

imageimage
Magnitude and phase in example 22.

The complex solution can be also animated by varying the complex phase. To increase the phase rate, press ;, and to decrease : 🎞️ .

↪️dependency: #336

najlkin added 30 commits May 2, 2025 13:12
@najlkin najlkin added this to the glvis-4.5 milestone Jan 15, 2026
@najlkin najlkin self-assigned this Jan 15, 2026
@najlkin najlkin added the WIP label Jan 15, 2026
@najlkin najlkin mentioned this pull request Jan 15, 2026
33 tasks
@najlkin najlkin requested a review from mlstowell January 15, 2026 02:09
@najlkin
Copy link
Contributor Author

najlkin commented Jan 15, 2026

@mlstowell , if you are testing it with example 22 in parallel, GLVis crashes quite often, but it is not fault of this PR. I realized the ordering is wrong there and should be fixed eventually. Check other examples, it should be:

  • open socket
  • send data
  • MPI barrier
  • ...

While you batch all operations which causes mismatches in received data as GLVis has no way to know what sockets should be grouped together 🤪 .

@najlkin najlkin requested a review from tzanio January 15, 2026 06:13
@mlstowell
Copy link
Contributor

I'm just starting to look at this but I like it. I can visualize the four fields mentioned in the header but I haven't found the animation option. I can adjust the phase rate as you mention but I'm not seeing an animation so the phase rate doesn't seem to do anything.

Perhaps this feature is not available yet...

@najlkin
Copy link
Contributor Author

najlkin commented Jan 15, 2026

It should be, it works for me 🤔 . Have you switched the representation? Magnitude does not show anything, because it is independent of the phase 😅 .

@mlstowell
Copy link
Contributor

Okay, I see it now. The comment written to screen misled me. When I saw:
Representing complex function by: real part
I thought that was the only thing that would be available in that mode. Perhaps we can add to those comments. Something like:
Representing complex function by: real part (animate with ';')

Another thing I might change is the limits on the color bar. For the phase plot I would suggest a constant range from -pi to pi. For the real and imaginary parts I would suggest a constant range from -max(magnitude) to max(magnitude). I find these constant ranges are more illustrative during animations. What do you think?

@najlkin
Copy link
Contributor Author

najlkin commented Jan 16, 2026

Done, the maximal magnitude is not exact for high-order elements, but should be good enough 😉

@mlstowell
Copy link
Contributor

I have not looked closely at the code but functionally I think this is perfect! Thanks for doing this, @najlkin. It looks great!

@mlstowell
Copy link
Contributor

Incidentally, I looked briefly at the available keys for changing this mode and I don't see a better choice. At some point soon I suspect we'll have to add a GUI control panel of some sort.

@najlkin
Copy link
Contributor Author

najlkin commented Jan 16, 2026

@mlstowell , I fixed ex22p along the lines above ☝️(mfem/mfem#5198) , so it should run fine now. Hopefully, we will be able to remove most of the visualization stuff from there after this PR and the release of GLVis 🙌 .

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants