Finite Element Simulation with FreeFEM and Machine Learning

A free course in which you write the solver first, check it against answers you can work out by hand, and only then train a neural network to imitate it. Because a simulation nobody verified is just an expensive picture.

Create an account to begin

A cantilever beam clamped at its left end and loaded downwards at its right, drawn in
               its deformed shape and shaded by von Mises stress, with the darkest band at the
               fillet where the wide root meets the arm.
The cantilever this course is built around, solved in FreeFEM and shaded by von Mises stress. Deflection exaggerated so it is visible. The dark band at the fillet is the stress concentration that later modules measure.

What you build

Every exercise is graded on a number you compute yourself

Each lesson ends in one value you produce by running code on your own machine: a maximum displacement, an observed convergence order, a drag coefficient, a test error. You type it in and the server checks it against the value measured when the lesson was written.

Nothing here can be passed by reading. There is no multiple-choice final, no participation credit and no video to sit through. The concept checks inside lessons are ungraded practice and gate nothing.

Who this course is for

Engineers and graduate students who can program, have met calculus and linear algebra, and want to know whether a simulation result is right rather than only how to produce one. You need a machine that runs FreeFEM and a browser for the training half, which uses Colab.

It is the wrong course if you want a tour of a commercial GUI, or a machine learning course with the physics left out, or a credential without the work behind it.

The 11 modules

  1. 1. Setup and the FreeFEM language 3 lessons, published

    Installing FreeFEM, building a mesh from parametrised borders, orientation and holes, P1 and P2 elements, integrating over a mesh.

  2. 2. From strong form to weak form 5 lessons, published

    Integration by parts, the Galerkin step, essential and natural boundary conditions, what on() does to the matrix, the weak form of linear elasticity.

  3. 3. Poisson, solved and verified 6 lessons, being written

    The method of manufactured solutions, measuring convergence order, and what mesh refinement does and does not buy you.

  4. 4. Linear elasticity and the cantilever 5 lessons, being written

    Plane stress against plane strain, stress concentration at a fillet, and reading a result you cannot check by hand.

  5. 5. From solver to data generator 5 lessons, being written

    Parameter sweeps, scripting FreeFEM in batch, and the cost of generating a dataset from a solver.

  6. 6. A first surrogate in PyTorch 5 lessons, being written

    Training a network to predict what the solver would have said, and the train and test split that makes that claim mean something.

  7. 7. Making the surrogate honest 4 lessons, being written

    Error metrics that do not flatter, holdout design, and the difference between fitting and predicting.

  8. 8. Where the surrogate stops being trustworthy 5 lessons, being written

    Extrapolation, distribution shift, and finding the boundary of the region where a trained model can be believed.

  9. 9. Flow, against a benchmark you cannot fudge 7 lessons, being written

    Navier-Stokes, the inf-sup condition, and drag on a cylinder measured against a published benchmark.

  10. 10. The surrogate that pays for itself 6 lessons, being written

    Counting the compute a surrogate saves against the compute it cost, and when the trade is worth making.

  11. 11. Capstone: plate with an elliptical hole 6 lessons, being written

    A full study end to end, from geometry and mesh to trained surrogate and a defended conclusion.

A ring-shaped domain between two circles, filled with triangles and shaded by the
               solution of a Poisson problem, darkest at the inner circle and lightest near the
               outer one.
The annulus built in module 1, carrying a solved field. Getting the inner circle’s orientation wrong fills the hole in and every number afterwards is quietly wrong, which is the first lesson of the course.

What exists today

The course is being written in the open. 8 of its 57 lessons are published, covering 2 of 11 modules. The remaining modules, the 20 question final examination and the certificate are not built yet, and there is no date for them.

Every answer key in the published lessons was measured on FreeFEM 4.17 before the lesson was written around it. Where a measurement contradicted the plan, the plan changed.

Questions people ask first

What does it cost?

Nothing. There is no payment page, no card is ever collected, and there is no paid tier that the free one is a sample of.

What software do I need?

FreeFEM 4.17, which is free and open source, on Windows or Linux. macOS has no installer after 4.15, so Mac users run it through Docker. The machine learning half runs in Google Colab, so no local PyTorch install is required.

How long does it take?

An estimated 59 hours. That figure is a notional learning hours estimate built from stated per-lesson assumptions, not a measurement, because nobody has yet walked the course with a clock.

Is the certificate accredited?

No. It is a statement that you completed this course and passed its examination, carrying a serial that anyone can check against the verification page. It is worth what the exercises behind it are worth, which is why they cannot be passed without running the code.

Create an account to begin