idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.77k stars 1.05k forks source link

Explore ExprTk as an FParser replacement with AD support #13194

Open dschwen opened 5 years ago

dschwen commented 5 years ago

Reason

FParser is a hot mess. It is not under active development anymore. Uses awkward multistage source generation and is set up to use explicit instantiation without the possibility to template on user defined types after libmesh is built. ExprTk (GitHub) is a fast, versatile, and actively maintained header only library that can be templated on custom types. I have an initial branch that templates ExprTk on DualReal. This requires some minor MetaPhysicL changes that are half merged (roystgnr/MetaPhysicL#46), half pending PR (roystgnr/MetaPhysicL#47). And a very minor change to upstream exprtk (which is being discussed).

Design

Use ExprTk as a parser backend for ParsedFunctions and parsed materials. It looks like the syntax will be mostly compatible with FParser (and in fact a ton more versatile and powerful).

Right now symbolic automatic differentiation - which is desirable for phase field - is missing in ExprTk. We could either do higher order derivatives with MetaPhysicL (pretty straight forward) or investigate differentiating the AST of ExprTk.

Impact

Parsed functions / parsed materials with AD support. (Plong @lindsayad)

lindsayad commented 5 years ago

I always enjoy getting plong'd

andrsd commented 5 years ago

But, it does not even compare to being pling'd...