GLVis / glvis

Lightweight OpenGL tool for accurate and flexible finite element visualization
http://glvis.org
BSD 3-Clause "New" or "Revised" License
263 stars 53 forks source link

Set maximum and minimum in GLVis for time-dependent problem #277

Open Wayne901 opened 8 months ago

Wayne901 commented 8 months ago

Hello, can I set GLVis options in a mfem's cpp file? I try to set the max and min value for a time dependent problem, but F7 only keep the limit for one frame.

termi-official commented 4 months ago

I handle this case as follows:

  char vishost[] = "localhost";
  int visport = 19916;
  socketstream sol_sock(vishost, visport);
  sol_sock.precision(8);
  sol_sock << "solution\n"
           << mesh << mygf << std::endl
           << "window_title 'my field name'" << std::endl
           << "valuerange -1.0 1.0\n"
           << "autoscale off\n"
           << "plot_caption 't= " << 0.0 << "ms'" << std::flush;
  sol_sock << "pause\n";
v-dobrev commented 4 months ago

There is a separate setting that controls how the "valuerange" is updated when the solution is updated (e.g. in a time-dependent simulation). This setting is the "autoscale" option that can be toggled using ctrl+a in the GLVis window -- to keep the "valuerange" fixed you want "autoscale off" (neither "valuerange" nor mesh bounds are updated) or "autoscale mesh" (only mesh bounds are updated) -- the current state, after ctrl+a is pressed, is printed in the terminal where GLVis was started from.

Of course, the suggestion by @termi-official is generally a better solution since you won't need to press any keys.