Functions::Parsed<dim> flexibility and Functions<dim> performance

27 views
Skip to first unread message

Abbas Ballout

unread,
Nov 20, 2025, 5:45:36 AM (6 days ago) Nov 20
to deal.II User Group
Hi all, 

I want to have the flexibility of Functions::Parsed<dim>, i.e., allowing the user to pass a string expression for a function at runtime, but with the performance of Functions<dim>.

I understand that Functions::Parsed is slow because a) muParser overhead and string parsing b) neither I nor the compiler can make optimisations at compile time.
I have complicated time dependent vector valued expressions that are slowing the overall assembly at boundaries by a factor of 2x. Even for simple expressions, error calculations between an exact Functions::Parsed and a numerical solution can be 6x slower than if I were to use a Functions<dim> but that doesn't take a big chunk of the code runtime anyway so it's okay.  

Wondering if there is something else in the library or if there is a workaround to this? Was thinking about caching the Functions::Parsed values in a table maybe? 

thanks and best, 
Abbas

Luca Heltai

unread,
Nov 20, 2025, 8:37:26 AM (6 days ago) Nov 20
to dea...@googlegroups.com, deal.II User Group
You could use symbolic functions (based on symengine) and optimize the function with LLVM (you have to have symengine installed with LLVM optimizer). 

Luca

Il giorno 20 nov 2025, alle ore 11:45, Abbas Ballout <abbas.b...@gmail.com> ha scritto:

Hi all, 
--
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 dealii+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/dealii/b39f8227-dd5b-4b13-b366-188988dfe983n%40googlegroups.com.

Abbas Ballout

unread,
Nov 22, 2025, 2:39:19 AM (4 days ago) Nov 22
to deal.II User Group
Dear Luca, 

I ll give this a try. (there goes my weekend ) 
Thanks for the hint. 
Abbas
Reply all
Reply to author
Forward
0 new messages