FreeFEM Documentation on GitHub

stars - forks

New features

The notable changes of each FreeFEM release are listed below.

Version 4.13 (30 June 2023)

  • Added

    • Composite FE spaces and variational forms for coupled problems (see Composite finite element spaces ):

      • can now define composite FE spaces with different meshes/mesh types as

        1fespace Uh(Th1,[P2,P2]);
        2fespace Ph(Th2,P1);
        3fespace Vh=Uh*Ph;
      • can define coupled problems using composite FE spaces, or directly with < > syntax:

        1fespace Uh(Th1,[P2,P2]);
        2fespace Ph(Th2,P1);
        3Uh [u1,u2],[v1,v2];
        4Ph p,q;
        6solve Pb (<[u1,u2],[p]>, <[v1,v2],[q]>) = ...

        see examples/examples/stokes_composite.edp and examples/examples/stokes_periodic_composite.edp

      • this new type of composite problem can be used for FEM-BEM coupling and also benefits from automatic parallel assembly (in test) and can be easily solved using the distributed solver MUMPS, see examples/bem/Helmholtz-2d-FEM-BEM-coupling-MUMPS-composite.edp

      • composite problems can also be solved using PETSc (in test), see examples/hpddm/Helmholtz-2d-FEM-BEM-coupling-PETSc-composite.edp

    • remove spurious cout in Curve/Line DG definition.

    • add New Finite element 2d on mesh : RT0dc (discontinuous RT0 ) in plugin Element_Mixte
      see example plugin/RT0dc.edp
      and P1nc (Crouziex-Raviat) + bulle : name P1bnc in plugin Element_P1ncdc
      and P1nc totally discontinous + bulle ; name P1bdcnc in plugin Element_P1ncdc
      see example plugin/example testp1dcnc.edp
    • add New finite element: P4S P4 on meshS , P3pnc3d in Element_P3pnc_3d (Couziex-Raviart with P3 )
      see for more information.
    • add new interface for metis (see examples/plugin/metis.edp)
    • Correct jump, mean, otherside of finite element function on mesh3, meshS, meshL
      (add missing code in method: MeshPoint::SetAdj() thanks to
    • try to build dmg install mac version

    • add file script to build meshS from boundary meshL TL if the boundary is the graph of function from mean plane.
      see example in examples/3dSurf/buildmeshS.edp
      1meshS Ts=buildmeshSminsurf(TL,1);// minimal surface
      2meshS Tsl=buildmeshSLap(TL,1);//  Laplace Surface ..
      3meshS Tsl=buildmesh(TL,1,op);// op = 0 Lap and op =1 => minsurf.
    • add sparse block to sparse matrix

      1matrix A = va(Vh,Vh);
      2matrix B(A.n*5,A.n*5);
      3int i=2;
  • Changed

    • change isoline to do the job for meshS, see example plugin/isoline.edp

    • change Curve function to be with 3 components to use the isoline data.

    • change Curvature plugin to compatible with new isoline data for 3 d case.

    • change some sprintf in snprint to remove warning

  • Fixed

    • bug in all P0face, P0edge, P0VF on mesh3,meshS, MeshL and also discontinous version (missing initialisation)

    • bug in plot function and ffglut with parameter pdf=”file.pdf” , because shift in plot named parameter not change in ffglut.

    • genere a bug if zero size element in read MeshL from file.

    • remove mistake when the border is badly defined , remove empty element in buildmeshL function.

    • bug in array quadrature FE.

Version 4.12

  • Added

    • add new finite Element P2pnc3d of Stokes problem like Crouzeix-Raviard in 3d of P2 pylynome
      see G. Allaire or for details
    • usage: plot( ..., pdf="filename.pdf", svg="filename.svg" );
    • add missing code for Discontinous Galerkin in 3d for RHS
    • add in examples/mpi/chamonix.edp : radiative transfer
      uses new plugin plugin/mpi/RadiativeTransfer_htool.cpp, illustrates the use of htool for compression of user defined matrix operator
    • transform a surface meshS in 2d mesh (warning with overlapping, no test) with movemesh:

      1meshS Ths = square3(10,10,[x,y,square(2*x-1)+square(2*y-1)]);
      2real[int] gzz;
      3mesh Th2 = movemesh(Ths,transfo=[x,y,z],getZ=gzz);//  get flat 2d mesh form meshS
    • New 1d finite element P3 hermite (C1) finite element in plugin Element_P3

      1meshL Th=segment(1,[x*L,0,0]); fespace Vh(Th,P3HL);

      see example end of example plugin/testFE-P3

    • missing new 1d finite element P4 in plugin Element_P4

    • plugin plugin/seq/MatrixMarket.cpp to read and save matrix in MatrixMarket and add also a binary form
      see examples/plugin/MatrixMarket.edp test
    • add ILU on complex matrix in plugin IncompleteCholesky
      remark : the IncompleteCholesky is written but not tested
    • add test of functional interface of complex eigen value problem in examples/eigen/LapEigenValueFuncComplex.edp

  • Changed

    • correct some old code with old version of K.facePermutation() function in plugin/seq/Element_Mixte3d.cpp and plugin/seq/Element_P2bulle3.cpp (not tested)

  • Fixed

    • fix in A.RemoveHalf (alway return a new matrix)

Version 4.11

  • Added

    • add computation scalar product of R3 example : ( N’*Tl)

    • add tools to do compution with R3 vector see tutorial/calculus.edp

    • add an example tutorial/tgv-test.edp see see what tgv do on matrix build.

    • add R3 to get the normal of boundary element (in all mesh type)

    • add R3[i].P to get the point (R3) of boundary vertices

    • add R3 to get the measure of the boundary elment

    • add projection function to a mesh , meshL, MeshS or mesh3 with return a R3 point

    • see new example dist-projection.edp example in exemples

    • add dxx, dyy, dzz, dxy, .. on P2L finite element

    • add tools to compute solid anglelet R3 O; a given point, Th3 a mesh3 and ThS a meshS.
      • solidangle(O, // triangular face is the boundary face

      • solidangle(O,Th3[k],nuface) // triangular face is face nuface of tet Th3[k]

      • solidangle(O,ThS[k]) // triangular face is ThS[k]

      • solidangle(O,A,B,C) // triangular face i (A,B,C)

      • Volume(O, // O, triangular face is the boundary face

      • Volume(O,Th3[k],nuface) // O, triangular face is face nuface of tet Th3[k]

      • Volume(O,ThS[k]) // O, triangular face is ThS[k]

      • Volume(O,A,B,C) // (O,A,B,C) tet ..

    • in bem pluging add array of HMatrix

    • examples/3d/Connectivite-3d.edp or /3dSurf/Connectivite-S.edp of test.

    • 3 function mapk, mapkk, mapkk to set a function in fourier space with k parametre

      1R3 K; // le fourier variable allway 3d (sorry)
      2int n1=16,n2=8, n3=4;
      3real[int] tab1(nx,tab2(nx*ny),tab3(nx*ny*nz);
      7//  Remark you can change K by P (current point)
    • in SurfaceMesh.ipd fonction to build a Isocaedron and a Sphere from this Isocaedron

    • new finite element on MeshS this finite element is the ortogonal of RT0 on surface, or Nelelec Finite Element on triangle with one DoF per mesh edge and where the DoF is the current on Edge in orientate edge by number of vertices.

    • plugin Element_P3pnc for new 2d finite element P3pnc (P3 + 2 bulles) noncoforming (continuite of P2 mod)

      and add 2 examples with this new finite element examples/plugin/cavityNewtowP3pnc.edp examples/plugin/testFE-P3pnc.edp

    • function to set dirichlet Boundary conditon on matrix A (real ou compex) trought an real[int]

      (if none zero => set BC )

      setBC(A,au1[],-2); and the example


  • Changed

    • the beaviour of linear solver UMFPACK, CHOLMOD in case of error , now FreeFEm exit on ExecError like in MUMPS

    • PETSc 3.17.0

  • Removed

    -map function in plugin dfft

  • Fixed

    • pow(int,int) now call int version not complex version..

    • correct the normal the N implicite variable on meshL case

    • correct version dump in banner FreeFem++ - version 4.10 (V …

    • correct in CPU time on big mesh due to do bad HCode in HashTable.hpp

    • bug in array of finite element on meshhS, meshL (ie. fespace Vh(ThS,[P1,P1]); )

Version 4.10

  • Added

    • ridgeangle named parameter in ExtractMeshL in msh3 plugin

    • DG formulation in 1d : add integral of all border of element : intallBE(ThL) and unified the notation by adding intallBE(ThS) , intallBE(Th2), intallBE(Th3) nuVertex of now the vertex number of element in intallBE0d integral BoundaryBE, InternalBE to know if border element (BE) is on true boundary of not. update nElementonB in case on no manifold data (value greater > 2) in meshL, MeshS case .. add code to use jump, mean of test functuon on MeshL case. ( not in mesh3 ) to compute RHS.

    • add getcwd() function in shell plugin to get the current working dir

    • add nuVertex to get the vextex on element in some int?

  • Changed

    • PETSc 3.16.1

  • Deprecated

    • SLEPc and SLEPc-complex have been part of PETSc and PETSc-complex for multiple releases and are now deprecated

  • Fixed

    • examples/potential.edp correct problem in times loops and BC

    • tutorial/mortar-DN-4.edp correct problem of region number in meshL

    • fix problem in Curve mesh and intallBE , vertex number is wrong

    • portability issue on arm64-apple with make petsc-slepc

    • fix assertion failure with transfer and transferMat with some finite elements

Version 4.9

  • Added

    • add P3 lagrange finite element on meshS and meshS

    • add new plugin meshtool to add tool to compute the number of connected components of a all kind of mesh (mesh,mesh3,meshS,meshL) with 2 kind of connected components ones on interior part of the mesh (default) ans secondly on the closure of the mesh (see examples/hpddm/bConnectedComponents.edp ) add functions int[int] In=iminP1K(Th,u) or int[int] Ix=imaxP1K(Th,u) get the array min/max of value u[i] where i is vertex number on each element k, so we have u[Im[k]] = min u[i]/ i in k;

    • add in plugin bfstream to to read binary int (4 bytes) to read fortran file and try to pull tools to share the endiannes in progress

    • add gluemesh of array of MeshL and MeshS type

    • interface to PC_MG_GALERKIN_BOTH

    • Kronecker product of two sparse matrices matrix C = kron(A, B)

    • add lot of finite element on Mesh3, MeshS, MeshL of Discontinous Galerling Element in 3d : P1dc3d, P2dc3d, P3dc3d, P4dc3d , P0edge3d ,P0edgedc3d , P0face3d ,P0facedc3d , P0VF3d ,P0VFdc3d , on Surface : P1dcS, P2dcS, P3dcS, P4dcS , P0edgeS ,P0edgedcS , P0VFS ,P0VFdcS, on Curve : P1dcL, P2dcL, P3dcL, P4dcL , P0VFL ,P0VFdcL remark; the associated generic name existe of P1dc, P2dc, P0edge, P0VF and all dc finite element corresponding to no continuity across element.

    • add code of intallfaces to do Discontinous Galerkin formulation in 3d (in test FH.)

    • add dist function to a mesh , meshL, MeshS or mesh3

    • signeddistfunction to a meshL or meshS

    • add buildmesh functon to build a 2d mesh from a meshL (same as buildmesh see examples/3dCurve/border.edp)

  • Changed

    • Now the order to find MPI in configure is first if you have PETSC then take MPI from PETSc otherwise use previous method

    • on MeshL defined with buildmeshL now the default label are 2*k-1 (resp. 2*k) for the begin (resp. end) of curve where k is the order of curve use in buildmeshL. So if you have one curve the labels are 1 and 2. And new the element label are te region number not the label. This element are not really test so be carfull.

    • PETSc 3.15.0

  • Fixed

    • bug in Find triangle contening point in 2d (border case), int Mesh::DataFindBoundary::Find(R2 PP,R *l,int & outside) const the parameter l not correclty return due to local variable.

    • set CFLAGS=-Wno-implicit-function-declaration to complie with Apple clang version 12.0.0 (clang-1200.0.32.29) to remove following error: implicit declaration of function correct :freefem:`3dCurve/basicGlue.edp`and add missing test

    • bugs in SLEPc SVDSolve() with a rectangular Mat

    • bugs in nElementonB for DG 3d formulation.

Version 4.8

  • Added

    • Bilaplacian example using Morley FE with PETSc, see examples/hpddm/bilaplacian-2d-PETSc.edp

    • Oseen problem preconditioned by PCD, see examples/hpddm/oseen-2d-PETSc.edp

    • SLEPc polynomial eigenvalue solver PEPSolve()

    • add trivial example to check periodic boundary condition on meshS , meshL , mesh3 examples/3d/periodic3.edp examples/3dSurf/periodicS.edp examples/3dCurve/periodicL.edp

  • Changed

    • PETSc version 3.14.2

    • Mmg version 5.5.2

    • link of ffglut so change in and LIBS -> FF_LIBS and LIBS become empty to remove default libs

    • change number of save plot in ffglut from 10 to 20 for O. Pironneau

  • Fixed

    • some memory leaks

    • the periodic boundary condition have wrong before first a sementic level of MeshS and MeshL case.

      the new syntexe is for example: meshL Tl=segment(10); fespace Vl(Tl,P1,periodic=[[1],[2]]); meshS Th=square3(10,10,[x*2*pi,y*2*pi]); fespace Vh2(Th,P1,periodic=[[1,x],[3,x],[2,y],[4,y]]);

    • fixed ‘*’ keyboard trick, to keep the viewpoint in ffglut or not.

Version 4.7-1

  • Changed

    • change the language definition to use type as a construction function with named arguments for bem plugin

    • PETSc version 3.14.0

    • ARPACK compiled by SLEPc

    • Mmg version 5.5.0

    • -std=c++14 instead of -std=c++11 when possible

  • Removed

    • plugins thresholdings, symmetrizeCSR, and fflapack and associed example

  • Fixed

    • problem compilation with gfortran-10 of arpack and mumps (add -fallow-argument-mismatch flags)

Version 4.7

  • Added

    • new way to build matrix between 2d Finite element 2d and Curve finite element to do mortar (Thank to Axel ) , see first example examples/tutorial/mortar-DN-4-v4.5.edp

    • add Ns normal vector in R^3 on meshS (normal of the surface) of current point (to day Ns of [x,y,0] plan is [0,0,-1]) no be compatible to exterior normal.

    • add Tl tangent vector in R^3 on meshL (tangent vector of the line/curve) of current point

    • compile ffmaster / ffslave example under windows (thanks to

    • Boolean parameter spiltpbedge in buildmesh to split in to edge with two boundary vertices

    • interface to PETSc DMPlex, see examples/hpddm/DMPlex-PETSc.edp

    • function MatDestroy

    • function MatPtAP and transferMat for parallel interpolation between non-matching grids, see examples/hpddm/PtAP-2d-PETSc.edp or examples/hpddm/diffusion-mg-2d-PETSc.edp

    • preliminary interface to SVDSolve from SLEPc to compute singular value decompositions, see examples/hpddm/mf-2d-SLEPc.edp or examples/hpddm/helmholtz-2d-SLEPc-complex.edp

    • preliminary interface to NEPSolve from SLEPc to solve nonlinear eigenvalue problems, see examples/hpddm/nonlinear-2d-SLEPc-complex.edp

    • transpose parameter when constructing a Mat for defining a matrix-free transposed operation

    • interface to PetscMemoryGetCurrentUsage

    • add P2b, RT0, RT1 surface FE (P2bS, RT0S, RT1S))

    • add operator interpolate (2d->3d surface)

    • add operator x = A’*b; where x, b are array and A 2 dim array (full matrix) and generate an error in case of b’*A or b’*A expression

    • function MatLoad to load a PETSc Mat from disk, see examples/hpddm/MatLoad-PETSc.edp

    • possibility to assemble a symmetric HMatrix<complex> and to densify a HMatrix<complex> into a Mat<complex>

  • Changed

  • Deprecated

    • rename changeNumbering, globalNumbering, originalNumbering, changeOperator, destroyRecycling, and attachCoarseOperator to respectively ChangeNumbering, GlobalNumbering, OriginalNumbering, ChangeOperator, DestroyRecycling, and AttachCoarseOperator

    • Nt the normal vector of the current (wrong on meshL) use Ns or Tl

  • Removed

    • augmentation routine from the PETSc plugin

    • MPIF77 variable

  • Fixed

    • lot of mistake in MeshL element add a example o check lot of thing tutomesh1d.edp

    • fixed problem of change of mesh when rebuild 2d mesh with buildmesh, …. (Thank to P. Jovilet to points this problem)

    • missing METIS library when using SuiteSparse compiled by PETSc

    • missing -fno-stack-protector when building PETSc on Windows, see

    • fixed ffglut for the plotting of FE array solution

    • fixed ffglut bug on MacOS Catalina , draw inn only half windows screen (Apple Bug ???)

    • correct P0VF finite element

    • abs function of array

Version 4.6

  • Added

    • new search algorithm for the element containing a point (more safe) in mesh of type mesh3, meshS, or meshL.

    • new function hasType to know if a PETSc component has been installed, e.g., hasType("PC", "hypre")

    • eigenvalue problems on linear elements, cf. examples/eigen/LapEigen1DBeltrami.edp or examples/hpddm/laplace-beltrami-3d-line-SLEPc.edp

    • –download-cmake in PETSc configure if there is no CMake available

    • flags –with-[slepc|slepccomplex]-include and –with-[slepc|slepccomplex]-ldflags for when SLEPc has been built outside of FreeFEM or PETSc

    • interface to KSPSetResidualHistory and KSPGetIterationNumber

    • interface to mpiWaitAll

    • new function extract, allows to build a curve mesh from a 2d mesh (can extract a labeled boundary, apply a geometric transformation)

    • ffglut can plot a vectorial FE function in surface 3d

    • distributed ParMmg interface, cf. examples/hpddm/distributed-parmmg.edp or examples/hpddm/laplace-adapt-dist-3d-PETSc.edp

    • new parallel interpolator on non-matching meshes, cf. examples/hpddm/transfer.edp

    • ability to solve problems in single precision or with 64 bit integers

    • tool to read data form vtk file only in 3d (cf. plugin iovtk a first example examples/plugin/iovtk.edp)

    • tool to read/wrile ply file of meshL, mesh3, MeshSPolygon File Format / Stanford Triangle Format do load “ioply”

      see examples//3dSurf/operatorsOnMeshS.edp

  • Changed

    • new tgv values: -10 => zero row, -20 => zero row/column

    • Windows binary now shipped with PETSc/SLEPc

    • BEM examples are now in examples/mpi

    • plot border type is now in 3d (border 2d and 3d)

    • PETSc version 3.13.0

  • Fixed

    • –enable-download_package may now be used to download a single package, e.g., –enable-download_metis

    • compilation of PETSc under Windows

    • compilation of plugins when using static libraries

    • correct detection problem in FE type when use a vectorial FE

    • macro concatenation with spaces in arguments

    • correct bug in plugin/seq/Schur-Complement.cpp

    • correct ambiguity bug in plugin/seq/bfstream.cpp (reading real or integer)

    • compilation of plugin libff-mmap-semaphore.c under windows

Version 4.5

Release, binaries packages

  • Since the version 4.5, the FreeFEM binary packages provides with a compiled PETSc library.

  • FreeFEM is now interfaced with ParMmg.

New meshes and FEM border

After Surface FEM, Line FEM is possible with a new mesh type meshL, P0 P1 P2 P1dc FE, basic FEM, mesh generation. This new development allows to treat a 1d problem, such as a problem described on a 3d curve.

Abstract about Line FEM in FreeFEM.

  • new meshL type, refer to the section The type meshL in 3 dimension

    • new type of surface mesh: meshL

    • the functionalities on the meshL type, it is necessary to load the plugin ”msh3”.

    • generator of meshL segment, define multi border and buildmesh function.

    • basic transformation are avalaible: movemesh, trunc, extract, checkmesh, change, AddLayers, glue of meshL.

      It is possible to build the underlying meshL from a meshS with the function buildBdMesh: ThS=buildBdMesh(ThS) builds the boundary domain associated to the meshS ThS and extract it by the command meshL ThL=ThS. Gamma.

  • new finite element space with curve finite element type

  • FESpace P0 P1, P2, P1dc Lagrange finite elements and possible to add a custumed finite element with the classical method (like a plugin).

  • as in the standard 2d, 3d, surface 3d case, the variational problem associated to surface PDE can be defined by using the keywords

    • problem

    • varf to access to matrix and RHS vector

    • available operators are int1d, on and the operator int0d to define a Neumann boundary condition

  • visualisation tools

    • plot with plot of ffglut, medit meshes meshL and solutions

    • 2d or 3d view, with in 3d the option to visualize the elememt Normals at element (touch ‘T’) and the deformed domain according to it (touch ‘2’).

    • loading, saving of meshes and solution at FreeFEM’s format

      • “.mesh” mesh format file of Medit (P. Frey LJLL)

      • “.msh” for mesh and “.sol” data solution at freefem format

      • “.msh” data file of Gmsh (Mesh generator) (load “gmsh”)

      • vtk format for meshes and solutions (load “iovtk” and use the “.vtu” extension)

Boundary Element Method

Allows to define and solve a 2d/3d BEM formulation and rebuild the associated potential. The document is in construction.

Table of content