← Back to team overview

dolfin team mailing list archive

Re: [Question #158285]: grad f evaluation with C++

 

Question #158285 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/158285

Anders Logg proposed the following answer:
B0;268;0cOn Fri, May 20, 2011 at 07:11:05AM -0000, James Avery wrote:
> Question #158285 on DOLFIN changed:
> https://answers.launchpad.net/dolfin/+question/158285
>
> James Avery posted a new comment:
> Hi Anders,
>
> Thanks a lot! That works. However, a quick follow-up question: It seems
> to me that it should be possible to compute the derivatives of a finite-
> element function f in a more efficient manner, since we have f's
> expansion in terms of basis functions that can be differentiated,
> although I have not been able to find out how these are accessed in
> DOLFIN.
>
> Is it strictly necessary to assemble and solve a new linear system to
> obtain a gradient? The reason I'm asking is, that the bottleneck in my
> application is due to the matrices describing the linear systems (with
> mesh size of up to a couple million cells). Thus assembling a matrix (or
> storing a precalculated one) and solving a linear system is a fairly
> large operation. Is there perhaps a shortcut for just computing the
> function derivatives with DOLFIN?
>
> Thank you again for your help!

Yes, it's possible. But consider this: If you differentiate a
continuous piecewise linear function, you get a discontinuous constant
function. If that is what you want, then use Kristian's
suggestion. But sometimes it's an advantage to represent the gradient
field as a continuous field and then you need the projection. Another
advantage is that you get the gradient as a DOLFIN Function, not just
the values at specific points.

--
Anders

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.