[firedrake] Regarding using UFL in meshfree code

Florian Rathgeber f.rathgeber10 at imperial.ac.uk
Mon Feb 17 20:01:31 GMT 2014


Dear Sarosh,

Apologies for the slow response. Find some answers inline.

On 12/02/14 10:44, quraishi at math.tu-berlin.de wrote:
> Dear Florian
> I saw your PyOP2 library and so I got motivated to interface my meshfree
> code with high level interfaces like UFL.

Glad to hear PyOP2 motivated you to look at UFL and high-level
interfaces! I should add that PyOP2 is not "my" library but the effort
of our entire research group.

> Currently my code is in Matlab, and everything is hardcoded. I wish that
> by using UFL I could also generate variational forms using highlevel code.

By "everything" I'm assuming you mean the finite-element basis
functions, derivatives etc.? You're absolutely right that UFL allows you
to generate implementations of variational forms via a form compiler
such as the FEniCS form compiler FFC.

> Please suggest me how could I use UFL in this context? Is it possible to
> generate python code (in addition to C++ code) by using UFL as well?

FFC by default generates code conforming to the UFC interface
specification. I'm not very familiar with MATLAB and even less with its
interfacing capabilities to 3rd party code, but in theory you might be
able to compile FFC generated forms into a library and call them from
MATLAB. Depending on how invested you are into your MATLAB code base you
might find it easier to port it over to Python and use FFC's ability to
generate and compile code just-in-time.

I'm not sure what exactly you mean by "generate python code": the
implementation of the variational form? FFC currently only has a C++
backend and I don't think you would want tight loops and heavy
arithmetic in Python for performance reasons. However since UFL is an
embedded DSL in Python you can do pretty much whatever you want with the
UFL form. UFL comes with a number of transformation algorithms.

I'm copying in our mailing list, so maybe others have things to add.

Best,
Florian

> Thanks
> Best Regards
> Sarosh Quraishi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2980 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mailman.ic.ac.uk/pipermail/firedrake/attachments/20140217/a1a79cae/attachment.p7s>


More information about the firedrake mailing list