Computing expensive forms efficiently

Asked by Jason Hicken

Hello,

General question. What is the best way (i.e. most efficient) to compute forms involving expensive computations? For example, suppose I am forming the semilinear form for the DG discretization of the compressible Euler equations. This will involve complicated flux functions (I am using the Roe flux function) along interior and exterior facets.

Presently, I am implementing the flux function as a function in python, which takes the finite-element (mixed-space) function on either side of the facet, and yields the flux. However, if I use this flux in the semilinear form, the execution time is extremely slow for the problem size.

I tried using cpp code in an Expression, but expressions do not seem to accept finite-element functions as parameters.

Any insights would be appreciated.

Best regards,
Jason

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Johan Hake (johan-hake) said :
#1

On 08/31/2012 11:35 PM, Jason Hicken wrote:
> New question #207398 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/207398
>
> Hello,
>
> General question. What is the best way (i.e. most efficient) to
> compute forms involving expensive computations? For example, suppose
> I am forming the semilinear form for the DG discretization of the
> compressible Euler equations. This will involve complicated flux
> functions (I am using the Roe flux function) along interior and
> exterior facets.
>
> Presently, I am implementing the flux function as a function in
> python, which takes the finite-element (mixed-space) function on
> either side of the facet, and yields the flux. However, if I use
> this flux in the semilinear form, the execution time is extremely
> slow for the problem size.
>
> I tried using cpp code in an Expression, but expressions do not seem
> to accept finite-element functions as parameters.

It is difficult to know what worked and what did not work when you do
not show any runnable code. I suggest you present a minimal code using
Python Expression and then one which you have tried C++ JIT compiled
Expression. Have in mind that you can built pretty complicated
Expression, evaluating other Expressions or Functions. You just need to
use the complex version of compiled expressions. Have a look in the
docstring of Expression.

Johan

> Any insights would be appreciated.
>
> Best regards, Jason
>

Can you help with this problem?

Provide an answer of your own, or ask Jason Hicken for more information if necessary.

To post a message you must log in.