On 2/11/19 1:52 PM, Doug wrote:
> 
> Just to clarify, the Jacobian, its transpose inverse and its determinant will 
> be re-computed every time reinit() is called? Even if the mesh has not 
> changed 
> from the previous time step?

Yes. We don't store this information for all cells -- in fact, FEValues 
doesn't actually know anything about the mesh as a whole, all it knows is 
about the current cell. So there is no place to look this information up: if 
the current cell is different from the previous cell, then this information 
needs to be recomputed by FEValues. Of course, that doesn't prevent you from 
making a run through all cells, storing this information for each cell, and in 
all following loops over all cells use what you cached rather than utilizing 
FEValues. That's the classic memory-vs-compute trade-off.

(I will note that FEValues has optimizations that make some of this cheaper. 
For example, if the cell for which you call reinit() is simply a translation 
of the previous cell, then it is not necessary to recompute the Jacobian, 
transpose, inverse, and determinant because it will be the same as for the 
previous cell. There is some trickery involved in this when using multiple 
threads that might defeat the optimization, but it can be enabled.)


> If so, I might end up pre-computing and storing the Jacobian transpose 
> inverse 
> and the Jacobian determinant to avoid re-computation. However, its effect on 
> the total time should be relatively small compared to flux computations. 
> "Premature optimization is the root of all evil".

Well said. Implement the simplest version of the code first and optimize once 
you have hard evidence that something is an actual problem.

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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to