This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Is it possible to import a .csv data file to FEniCS

0 votes

I need to import an initial condition for a vector-valued solution of a PDE in 2 dimensions that is defined as a table in a .csv text file. The file has four columns representing x- and y- coordinates of a point and the components of a vector function at that point, respectively. Is it possible to import this data into a FEniCS code and interpolate it over an already defined mesh? Thanks in advance,

Dmitry

asked Oct 16, 2016 by golovaty FEniCS Novice (140 points)

1 Answer

+1 vote

If you are using Python, there is a csv reader module. Interpolating to points is possible, but something you would need to implement yourself, e.g by writing an eval() method for an Expression.

answered Oct 16, 2016 by chris_richardson FEniCS Expert (31,740 points)
...