Wrapping modern f90 with f2py

I’ve started wrapping my fortran sph code, with the aim of being able to reuse a lot of code. In particular the second order spatial gradients code is long, and error prone. Python wrapping not only means I can use fast fortran for my real-time 3d fluids code, but it makes testing and verification that much easier. Plotting for fortran was a matter of spitting out ASCII files and writing a script to plot them. Somewhat ad-hoc, and either leading to the code being littered with commented out write statements, or multiple hardly ever used output files being written every run.

I’ve had to remove a lot of the more whizz-bang features, like derived types and assumed shape arrays from the argument lists of the subroutines I’ve ported, but a) this is only a subset of the code and b) it’s not hard to make these changes on neat, tidy, single purpose routines, which are the best candidates for wrapping and reuse in the first place.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: