hpfem / agros2d

vf
http://www.agros2d.org/
GNU General Public License v2.0
65 stars 29 forks source link

Obtaining solution for user-defined set of points #138

Open cissic opened 6 years ago

cissic commented 6 years ago

Could anybody tell me if there is possibility in Agros of obtaining (and exporting) the values of solution in some user-defined set of points or mesh nodes. Currently, using graphical interface, I can see the value of the function by clicking point-by-point on the solution plot. This is very inconvenient. I tried to use python console but I couldn't find any documentation on which function/structure could be used for this. Any help appreciated...

stevennoyce commented 2 years ago

I have the same question.

I'll share what I have been able to do so far. I have used two methods and am looking for a third.

  1. You can use the "Chart" tab, define a line, and either graph or export to a CSV any number of values along that line. This is a way to obtain and export user defined points, but not arbitrary located points necessarily.
  2. If using python as I prefer to do, you can use the provided PythonLab interface to create a script from your model, then you can call the local_values() method on the field of interest, for example magnetic.local_values(x,y)['Brx']. You can run a for loop over your points of interest to grab the corresponding values.
  3. My related question is if the local_values() method which only takes one point is the only approach. It turns out that running a for loop over a modest number of points to pull out a matrix representation of a solution field is a fairly slow operation. Given that the interface shows a fairly high resolution image of the solution, I'm curious if there is a way for python scripts to get access to this data more efficiently. For instance, is there a method similar to local_values() that can take a matrix of points instead of a single point, and return matrices of values at those points?

I know this question is fairly old, but since people can find it via searches I wanted to provide what I have found. I would also love if anyone has more details of a better approach or thoughts on my third point.