Programming project

The programming project is a mandatory exercise which you will have to do in order to take the exam. It will count 35% towards your final grade. The project is split into two parts: The first part consists of 4 tasks, and you are required to do all of them. The second part is released later and will be required to do only one of these.

You are to hand in a written report as well as hold a short (~10min) presentation. Deadlines will be posted later

The teaching assistant will be available on all Fridays in Nullrommet from 10:15 to 12:00. In addition I will be available on Tuesday 10:15-12:00 and Wednesday 08:15-10:00 during the kickstart week (week number 43).


  • 18.10: Programming project handed out. Meet up at F2
  • 18.10: First exercise hour will be Tuesday 25/10, 10:15-12:00. Regular lecture hours are swapped for help with the project in nullrommet
  • 18.10: Wednesday 26/10 08:15-10:00. Lecture hours are swapped for work on the project at nullrommet
  • 21.10: Project Presentation made available in the Problem set section
  • 21.10: All groups should send one e-mail listing the full name and e-mail address of all group members to Kjetil [dot] Johannessen [at] math [dot] ntnu [dot] no. If you know that you are not able to get a group by yourself, then send me an e-mail. I will pair up all unmatched people by random on Friday the 25th.
  • 22.10: Problem set II published. Reading materials on strains and stresses added.
  • 01.11: getEarth geometry file added
  • 05.11: Cheese geometry added
  • 06.11: Beef geometry added
  • 07.11: Heart geometry added, removeUnused2D.m added
  • 07.11: Section on 3D printing added
  • 08.11: Wine glass geometry added.
  • 11.11: Chess board geometry added.
  • 12.11: Star geometry added
  • 15.11: Chess King and Queen geometry added
  • 18.11: Presentation order published

Presentation order

The presentations will be held on the following dates in the following language:

Wednesday 13:30-15:30, Norwegian presentations

Lunchroom 13th floor in Central Building II (room 1329)

  • Trygve Bærland , Geir Amund Svan Hasle & Eirik Ingebrigtsen
  • Lars Magnus Valnes & Kristoffer Kofoed Rødvei
  • Mathilde Skylstad & Silje Irene Hansen
  • Adrian Kirkeby , Odd Eirik Farestveit & Anders Asheim Hennum
  • Bjørn Rustad , Henrik Vikøren & Kine Aurora Hansvold
  • Scott Christian Arvesen & Elisabeth Topnes

Friday 10:00-12:00, English presentations

R9 in Realfagsbygget.

  • Keunsoo Park & Ezequiel Manavela Chiapero
  • Ingrid Pernilla Jonasson & Tatiana Lobkova
  • Erlend Hoff Bernstrøm , Jon Vegard Venås & Fredrik Hildrum
  • Ruben Grønning Spaans , Andreas Amlien Røssland & Johannes Van
  • Axel Byberg Fosse
  • Raymond Toft , Haakon Christopher Bakka & Anette Østbø Sørensen
  • Guro Seternes & Agnes Koi Alexandersen
  • Henrik Sperre Sundklakk , Emil Gautesen & Kristin Solbakken
  • Filippo Remonato


Problem set

Linear Elasticity

You can find more reading material on continuum mechanics in these chapters taken from the book "Continum Mechanics" by George E. Mase

  • Strain - Chapter 3, introduction to strain
  • Stress - Chapter 2, introduction to stresses
  • Linear Elasticity - Chapter 6, introduction to linear elasticity


Compiling and running C++

You may compile the GMSH to Matlab converter (in Linux) by typing

g++ msh2m.cpp -o msh2m

and use this by typing

msh2m myGeometry.msh myMatlab

which will read the file myGeometry.msh and write the following files

  • myMatlab_pts.m
  • myMatlab_lines.m
  • myMatlab_tri.m
  • myMatlab_tetr.m
  • myMatlab_nodes.m

containing respectively all points specified, lines, triangles, tetrahedrons and nodal coordinates. For 2D examples, your elements would be in myMatlab_tri.m, the boundary elements in myMatlab_lines.m and the nodal coordinates in myMatlab_nodes.m


GLview is a post-processing program designed for visualization of finite element results. It is a commercial project, but as a NTNU student you have access to it through progdist. It comes in a lightweight version, GLview Express, and a full version GLview Inova. To view the demo above you will have to install the latter. To get the results shown in the introduction do the following

  • double click "mode shape" on the upper left menu
  • move the "Time" slider on the upper left menu to 8
  • set current displacement to "relative scaling" in the lower left menu
  • in the "animation" tab, click "mode shape animation setup" and just press OK when the pop-up menu comes

Note that the "time" slider in step 2 is a misleading name as it really is the eigenvalues and not related to time whatsoever. The first time is just bogus output followed by 6 zero eigenvalues (10^-7 is assumed to be numerical zero). All eigenvalues above 8 are nonzero ones and display true eigenmodes of the geometry/material choice. Play around with the different ones to get a feeling on how they look like.

If you like, it is entirely possible to write your own GLview result files. It is possible to do this with pure ASCII files as long as you follow a fairly simple structure. More information on this may come if there is any interest in doing this. Note that this is optional and you may choose to use Matlab for all parts of your implementation and visualization if you are more comfortable with this.

3D printing


If you want your final results printed you will have to produce an stl file. This is simply a triangulation of your geometry. It is worth noting that this will be a surface representation, and not a volumetric one, which is used in your finite element code. To get a surface representation take a look at the matlab functions TriRep and freeBoundary. Once you have a surface description, download this matlab stl-writer script. To verify that you have a proper stl file, view this in meshlab which is a free stl-viewer, but unfortunately is not installed on the machines at Nullrommet. Bring the STL file to Kjetil and he will make sure to print the thing.


Here is a handful of sample geometries which you may download and play around with for your project. You may choose to use any of these in your final submission, or create your own.

King & Queen

King and Queen chess pieces.


Christmas is soon coming. You might want to put this at the top of your tree.

Chess Board


With the ongoing chess world championship between Anand and Carlsen, I find it only appropriate to run finite element simulations on chess boards. This is a recreation of a famous exhibition match between Ossip Bernstein and José Raúl Capablanca in 1914.


winemesh_small.jpg wineglass_small.jpg

Is it possible to break a wine class by singing a high C? Possible geometry for task 5.4.


Need something to warm your heart? Why not try the finite element method?

The earth

This is a triangulation of the earth with added adaptivity around the shorelines to describe these as accurate as possible. It is given as a 2D flat geometry as well as a 2D sphere geometry. Global warming simulation anyone?


Geometry for task 5.5: Cooking a piece of steak.


A piece of swiss cheese. More food geometry for those doing heat equations or do you envision doing something else with it?

Solid ball

This is simply the unit ball as in problem set part 1. The difference is that this is created in GMSH, and may be easier to alter for your own creations. Note that the actual triangulation returned will be different from the getSphere.m matlab script.

Bank of Westnoth

This is a geometry of the Bank of Westnoth and the neighbouring hotel.

Princess Cake

This is the geometry of the skirt for the princess cake. The volumetric tetrahedrals are seperated into two parts: those of the cake dough and those for the metal tube in the middle.

Chess Pawn

A personal favorite of mine, this has been extensively used in isogeometric analysis. For some of the eigenmodes corresponding to task 5.3 (eigenvalue analysis), check out


This is the home of the mad desert wizard.

2013-11-21, kjetijo