Midterm evaluation
As the midterm evaluation has passed, it’s now the time to write about the things I have done during these weeks. In order to give a complete overview, this post will be more like a list-of-things than a developed write-up.
Week of June 6:
- simplify the finite volume scheme’s Python code, using lambda functions, thanks to my mentor Andreas Dedner (see [1], [2] and [3])
- complete and write other bindings for the following types:
Entity
,Intersection
,GridView
andIndexSet
(see [1], [2], [3], [4], [5] and [6]) - clean some code (indentation, CamelCase convention (used in the C++ codebase of DUNE, I chose to follow it for the Python bindings even though the
PEP8
recommends using underscore), refactoring) - talk with my mentors about my code (reviews, improvements, etc.) (see [1] and [2], [3], [4] for the commits of my mentor Martin Nolte, thanks to him too)
Week of June 13:
- improve the finite volume scheme’s Python code: remove a non-consistent import (see [1]), add the
dimension
,dimensionworld
, andconforming
constants to gridViews (see [2]), manage dot products between Pythonlist
andFieldVector
because of Python reverse operators (see [3]), addNone
return type to some functions (see [4] and [5]) - simplify the export of Python iterators (see [1], [2], [3] and [4])
- manage the export of Python iterators to iterate over entities of any codimension (see [1] and [2]). That was a challenge (it took me a day of work) since the codimension is a (int) template parameter fixed at compile time… My idea was to generate a compile-time array
(thus, a static array) that contains
N=dimgrid+1
lambda functions, where each lambda manages the creation of iterators for a set of entities of the same codimension (0
todim
), read the code for more details. - read the finite element scheme example of dune-grid-howto (part “A FEM example: the Poisson equation”) and think about how implement it in Python
- complete bindings for
FieldVector
(see [1]) and add bindings to exportFieldMatrix
,DynamicVector
andDynamicMatrix
(see [2], [3] and [4]), used in the finite element example
Week of June 20:
- manage linking to AlbertaGrid (used for the finite element example), it took me some hours to find and understand the CMake files related to that and modify the right things… (see [1])
- write bindings to export
ReferenceElement
,ReferenceElements
,QuadraturePoint
,QuadratureRule
,QuadratureRules
andMultiLinearGeometry
(see [1], [2], [3] and [4]) - implement Python iterators for the previous types ; I spent twelve hours on that since I had segfaults. It turned out that I was exporting several types (with variadic templates) with the same pybind11 name without any compile-time error but a nice segfault at runtime (see [1])
- play with
Numpy
to usendarray
in the Python implementation of the finite element scheme, I especially exported the buffer protocol ofFieldMatrix
(see [1]) to avoid expensive copies (for example when computing the Jacobian Inverse Transposed, seeLine 69
of [2]) - play with
Scipy
to solve the problem, using thescipy.sparse.linalg.bicgstab
solver (Biconjugate Gradient Stabilized iteration solver), see [1] - manage the VTK output of the solution and that wasn’t easy since I hadn’t compile time error but my VTU files were empty… (see [1])
But finally, after some hours of debugging (see the bugfixes of June 24 and 27), I managed to have a working implementation of the finite element scheme, see the results here for a 2d solution and there for a projection of the 3d solution. :-)
On an other subject, I just learned that I passed midterm evaluation! So the adventure is still ongoing, I keep you in touch!
blog comments powered by Disqus