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:                 [email protected]
                            www: http://www.math.colostate.edu/~bangerth/

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/612dcbda-4150-9aad-5734-065b6b82be9f%40colostate.edu.

Reply via email to