On 1/22/20 11:17 AM, 'Maxi Miller' via deal.II User Group wrote:
> As source term for calculations I am using data which is written in an
> external matrix (because it has been calculated by an external
> function), together with the x- and y-values for each matrix entry. My
> current approach for using this data is to use an interpolation function
> from GSL, and call it for each cell while looping over them. This gives
> me the value at that position, interpolated.
You might also want to look at the InterpolatedTensorProductGridData and
InterpolatedUniformGridData classes. Since these are derived from
Function<dim>, you can send them into VectorTools::project if you want.
> Now, though, I would like to improve that approach. I was thinking about
> using the project-function and interpolating the matrix onto a component
> in my FESystem, but as far as I can see the project-function does not
> allow me to only change one component in my solution while leaving the
> other components untouched. Of course, I also could loop once over all
> cells before starting the main loop and solve the equation u = f, with f
> the value at each position, but I am not sure how efficient that is,
> especially when I can use the matrix-free vectorized approach for
> solving for the other components.
Why would you want to project when you can interpolate? That seems
unnecessarily expensive :-)
But regardless, if you can't find a way to deal with just component,
embed your data into a vector-valued function where the other components
are all zero, and then project/interpolate the whole vector-valued
function onto your FE space. You might be interested in the
VectorFunctionFromScalarFunctionObject class for this purpose.
Best
W.
--
------------------------------------------------------------------------
Wolfgang Bangerth email:
bang...@colostate.edu
www:
http://www.math.colostate.edu/~bangerth/