[Paraview] Using Value of Variable At Point in Calculator Filter
Jeremias Gonzalez
jgonzalez49 at ucmerced.edu
Mon Jul 3 21:01:47 EDT 2017
Hi, I've been trying to figure out, in Paraview, how to use the value of
a variable at a point in the calculator filter over a geometry. So, for
example, I have 3 vtk files of a cube geometry with a scalar and vector
field (x,y,z components) as data sets. I create a gradient filter for
each one of the vector components, then use the append attributes filter
to combine the gradients into one object, then use the calculator filter
to compute some quantity using the gradients as well as {the value of a
vector field component of each vtk in the middle of the cube} and plot
the result over the cubic geometry, maybe take a slice of that cube at
the end. I have some roadblocks that prevent me from doing this in a
less manual, straightforward fashion:
1. I do not see a command in the calculator filter like
EvaluateAtPoint(myvectorfieldxcomponentvtk1,(x=0,y=0,z=0.5)) to grab the
value of the x component of the vector field from vtk1 at point
(0,0,0.5) in Cartesian coordinates and use it in some quantity like
gradientx*5*EvaluateAtPoint(...) which would be evaluated over the
entire cubic geometry, but always use the value of that point in the
middle. I have used this sort of thing before in a program called
COMSOL, which possesses such a feature in the Scoped Evaluation list
called at3_geometry, among many other variations.
2. Even if there was a command like in #1, the append attributes command
doesn't seem to respect the different sources of the vector field, so I
see only one vector field in the resulting array (by contrast, I can
name the gradients of the vector field components uniquely in each of
the filters that outputs them, and the append attributes filter shows
three distinct batches of gradients from each filter I applied to each vtk).
3. I tried to create a probe at the location I need, but the geometry it
produces is a single point and thus using it either {directly with
append attributes to the other gradient results} or {with a calculator
filter first to get only the quantity I want instead of the scalar field
and the vector fields evaluated at that point and then use the append
attributes command} doesn't work because the append attributes
apparently uses only the overlapping geometry, which of course is only
the one point.
4. I tried to use group datasets instead, thinking maybe it would just
take the value I make in the calculator filter from the probe location
filter and use it in the final calculator filter, but it just throws a
bunch of errors which I assume again stem from the mismatch of geometry.
5. I had an idea to maybe just clone each of the original vtks to get
the geometry I need in a new array, and then somehow set all the
datapoints in each one to the value I get from the probe location
filter, but this would not only again encounter the problem in #2 with
the nonunique naming, but I also do not know how to edit the individual
data points in the file (I see an inkling of this idea in the blog post
here: https://blog.kitware.com/zero-copy-arrays/ but it's quite beyond
my current level of understanding of Paraview).
The current alternative (that definitely works) is to just manually copy
the value I get from {the probe location filter or plot over line filter
or something like that } into the final calculator filter, but I'd have
to do that for every one of the batches of 3 vtk files I get, which is
going to get very large when I start varying my more complicated
geometry with parametric sweeps (I also need to figure out how to
automate the process of outputting the slice I take at the end, but one
problem at a time! I welcome any suggestions on this front).
More information about the ParaView
mailing list