Filippo Passerini's codes for technical interview with IIT
How to use the FEM codes: Two types of equations are solved: elliptic and parabolic. For elliptic I used both P1 and P2 polynomials, for parabolics I only used P1 polynomials. I implemented the stabilization techniques SUPG (for the convective term) and mass lumping (for the reactive term) only for the elliptic equations; you can choose to activate these stabilizations in the function "assembla_matrice" (see the instructions in this function". The way to proceed is as follows. In the elliptic case, you can start from the script "calcolo_errore". Choose the number of meshes you want to use (variable "lung"): each mesh will have the maximum triangle area parameter halved compared to the previous one (therefore the maximum triangulation side "h" will be divided by 4) . This script does the calculation a number of times equal to the chosen number of meshes; in this way, you can find the error between exact solution and approximate solution (in norm L^2, L^inf, H^1), related to the maximum side of the mesh "h" (in bilogaritmic scale). In the parabolic case, you can choose to start both from "calcolo_errore" and from "calcolo_errore_temp"; the functioning is identical to what is explained above regarding "calcolo_errore" (n.b. the number of time steps is fixed, so you can see the error related only to spatial discretization), while on "calcolo_errore_temp" case the procedure is similiar: choose a number of time steps (variable "lung") into which you want to divide your interval, and in this way you will be able to see the relationship between the error and the "delta_t", i.e. the length of the sub-intervals (since a Crank-Nicolson method was used , the errors will all have slopes equal to 2) (n.b. the parameter "h" is fixed, so you can see the error related only to temporal discretization). You can choose the the parameters "epsilon", "beta", "gamma" (respectively, diffusion, convection and reaction parameters of the equation) solution you want (in sol_esatta_bis) and then you have to make change in "grad_soluz_esatta_bis", "laplaciano_sol_esatta" and "forzante_bis". In case of constant diffusion parameter, you don't need to make change in "forzante_bis"; instead, if the forcing term is not constant, you have to calculate the forcer by hand by substituting the exact solution and the parameters you want into the equation.
N.B. The functions contained in the branch "triangolatore" are made by Professor Stefano Berrone (DISMA, Politecnico di Torino).