• sparselizard

    FAST FINITE ELEMENT C++ LIBRARY

  • sparselizard

    GENERAL NONLINEAR MULTI-PHYSICS

  • sparselizard

    EASY HANDLING OF NON-MATCHING MESHES

  • sparselizard

    TRANSIENT EIGENMODE MULTI-HARMONIC

  • sparselizard

    USER FRIENDLY

  • sparselizard

    OPEN SOURCE

  • sparselizard

    DELAYED REMOTE POST-PROCESSING

  • sparselizard

    DISCRETE MEASURED DATA INPUT

  • sparselizard

    GENERAL PERIODIC CONDITIONS

OVERVIEW

Sparselizard (MIT License, Copyright (C) 2017-2019 Alexandre Halbach) is a fast, general, multiphysics, open source C++ finite element library running on Linux, Mac and Windows. It is used to design next generation microdevices (ultrasound transducers, micromirrors, microvalves, comb drives,...) and it is extensively validated against analytical solutions, third party software and measurements of the fabricated devices. A fast algorithm for mesh-to-mesh interpolation and a general implementation of the mortar finite element method allow to easily work with non-matching meshes and provide general periodic conditions. Sparselizard can handle a general set of problems in 3D, 2D axisymmetric, 2D and 1D such as mechanical (anisotropic elasticity, geometric nonlinearity, buckling, contact, crystal orientation), fluid flow (laminar, creeping, incompressible, compressible), nonlinear acoustic, thermal, thermoacoustic, fluid-structure interaction, electric, magnetic, electromagnetic, piezoelectric, superconductor,... problems with a transient, (multi)harmonic or damped/undamped eigenmode analysis. A massive amount of data can be stored for delayed, remote post-processing thanks to the ultra compact .slz data format. Problems with several millions of unknowns in 3D and several tens of millions of unknowns in 2D have been solved within minutes on up to 32 cores/64 threads. Some built-in geometry definition and meshing tools are also provided. A working example that solves an electrostatic problem on a grounded 3D disk with electric volume charges can be found below:

int vol = 1, sur = 2;             // Disk volume and boundary as set in ’disk.geo’
mesh mymesh("disk.msh");

field v("h1");                    // Nodal shape functions for the electric potential
v.setorder(vol, 2);               // Interpolation order 2 on the whole domain
v.setconstraint(sur, 0);          // Force 0 V on the disk boundary

formulation elec;                 // Electrostatics with 1 nC/m^3 charge density
elec += integral(vol, -8.85e-12 * grad(dof(v)) * grad(tf(v)) + 1e-9 * tf(v));

solve(elec);                      // Generate, solve and save solution to field v

(-grad(v)).write(vol, "E.vtk");   // Write the electric field to ParaView format

The built-in geometry definition and mesher can be used for now for rather simple 2D or extruded 3D geometries. Meshes of complex geometries can be imported from the widely-used open-source GMSH meshing software (.msh format), from Nastran (.nas format) or from various other supported mesh formats (see the mesh object in the documentation). Points, lines, triangles, quadrangles, tetrahedra, hexahedra, prisms or any combination thereof are accepted in the mesh. Element curvature for an accurate representation of the geometry is supported. The result files output by sparselizard are in .vtk / .vtu / .pvd (ParaView) or .pos (GMSH) format. The library comes with hierarchical high order shape functions so that high order interpolations can be used with an interpolation order adapted to every unknown field and geometrical region.

EXAMPLES

UNSTEADY FLUID FLOW PAST AN OBSTACLE


Von Karman vortex street

The fluid flow past an obstacle is simulated in time for an increasing inlet velocity. A von Karman vortex street appears at a high enough inlet velocity. The flow can be visualized in time here in 3D and here in 2D.

SEE EXAMPLE

MAGNETIC INDUCTION, SKIN EFFECT


Fluid flow in a microvalve

An AC voltage is applied to a coil surrounding an aluminium tube in which currents are induced. In the current density image displayed the skin effect in the thick copper wire of the coil is also visible.

SEE EXAMPLE

PIEZORESISTOR, NON MATCHING MESHES


Piezoresistor - non matching mesh

The deflection of a monocrystalline silicon cantilever causes a change in the resistance of the doped (piezoresistive) conducting track in it. The cantilever and track meshes do not match, field interpolation has to be used.

SEE EXAMPLE

NATURAL CONVECTION IN AIR


Natural convection in air

The natural convection created by a human hand in a colder air environment is simulated without major simplifying assumptions: the fully compressible flow is considered and solved in time. Follow this link for a time visualization video.

FLUID-STRUCTURE INTERACTION


FSI

A pair of micropillars placed in a microchannel bend due to a forced inlet water velocity. This strong fluid-structure interaction is solved in a monolithic way and a Laplace formulation is used to smooth the deformed fluid mesh.

SEE EXAMPLE

ELECTROMAGNETIC WAVEGUIDE


Electromagnetic waveguide

A cross shaped perfectly conducting 3D waveguide is excited with an imposed electric field at one end. Follow this link for a transient time resolution video.

SEE EXAMPLE

FLUID COUPLED PIEZO ACTUATED MEMS


MEMS with fluid coupling

A piezoelectric actuated micromembrane (PMUT) outputs ultrasound pressure waves in air. The simulation is performed in 2D using axisymmetry. Follow this link for a time visualization video of a smilar device (CMUT).

SEE EXAMPLE

TOPOLOGY OPTIMIZATION


Topology optimisation

This mechanical steel structure is automatically optimized to withstand a given force with the minimum possible steel volume. This was obtained with a third-party C++ topology optimization code developed using the sparselizard library for all finite element calculations.

THERMOACOUSTICS IN A DEFORMABLE CAVITY


Transient thermoacoustic

The transient thermoacoustic response to a 0.1 us laser pulse in a 500 um deformable cavity with ambient air on top is simulated. The fields displayed are the fluid pressure, velocity, temperature and membrane deformation. Follow this link for a time visualization video.

SEE EXAMPLE

PERMANENT MAGNETS, MAGNETIC FORCE


Permanent magnets

The static magnetic field created by an array of permanent magnets is simulated using the scalar magnetic potential formulation. The Halbach configuration shows as expected a magnetic field strength increase. The potential and the magnetic field lines are illustrated.

SEE EXAMPLE

HALF-WAVE DIPOLE ANTENNA


Half-wave dipole antenna

The 1 GHz electromagnetic wave radiation of a half-wave dipole antenna is simulated. The electric field, magnetic field and Poynting vector are computed and can be visualized in time. The electric field can be visualized here.

SEE EXAMPLE

GENERAL PERIODIC CONDITIONS


Periodic condition

The crosstalk between a central micromembrane and 6 neighbours is analyzed on only 1/6 of the geometry using a periodic condition between two faces with non-matching meshes. The available mortar finite element method allows to implement general periodic conditions.

SEE EXAMPLE

HIGH TEMPERATURE SUPERCONDUCTOR


High temperature superconductor

A thin superconducting tube is subject to an applied magnetic field that increases over time. As the magnetic field is increased it progressively penetrates in the tube until the tube is not able to perfectly shield its interior volume anymore. The time-solution can be visualized here.

SEE 2D EXAMPLE SEE 3D EXAMPLE

INFLUENCE OF SI/PZT CRYSTAL ORIENTATION


Piezoelectric micro-bilayer

A piezoelectric PZT layer grown on a monocrystalline silicon wafer is sandwiched between two electrically actuated electrodes, creating a harmonic deflection of the bilayer. The crystal orientation of both the PZT and the silicon can be changed to any direction. Follow this link for a time visualization video.

SEE EXAMPLE

DAMPED MECHANICAL RESONANCE MODES


Mechanical disk eigenmodes

The damped eigenmodes and eigenfrequencies are obtained for a 3D disk clamped at its side. A proportional damping is used to model losses.

SEE EXAMPLE

CONDUCTOR HEATING DUE TO DC CURRENT


Conductor heating due to DC current

A voltage is applied across a 3D tungsten conductor in vacuum. The (strong) DC current flow as well as the induced thermal heating (displayed) is simulated. The influence of the temperature on the material properties is taken into account with a nonlinear loop.

SEE EXAMPLE

DOUBLE DIFFUSION OF SALT FINGERS


Double diffusion

A coupled thermal-salt concentration advection-diffusion problem is simulated in time in presence of a gravity force. The picture shows the appearing salt fingers as well as the density inversion phenomenon.

RESISTANCE AND CAPACITANCE


RC simulation

The resistance and capacitance is computed for a 3D geometry made of a conducting trace connected to a circular-shaped, parallel-plate air capacitor. The simulated capacitance matches the parallel plate formula. The quadrature electric potential field is displayed on the picture above.

SEE EXAMPLE

WORKING WITH EXPERIMENTAL DATA


Experimental data

The deflection of a steel disk with a non-uniform temperature profile is calculated: the stiffness versus temperature dependence is obtained by interpolating between experimental data samples using natural cubic splines.

SEE EXAMPLE

GEOMETRY DEFINITION AND MESHING


Geometry definition and meshing

The sparselizard geometry builder and mesher are used to create and mesh this simple 3D mechanical structure (top view above). The deformation of the structure subject to a torsion force is then simulated.

SEE EXAMPLE

BUCKLING, GEOMETRIC NONLINEARITY


MEMS with fluid coupling

A prestressed 3D bilayer micromembrane is pushed downwards by the atmospheric pressure. The static deflection and resonance frequency shift is simulated thanks to a small-strain geometric nonlinearity formulation. This example can be adapted to simulate buckling in time, as shown in this video.

SEE EXAMPLE

MAGNETIC SHIELDING OF A DC CURRENT


Magnetic shielding of a DC current

A 3D steel cylinder is placed nearby a wire with a given static current density. The magnetic vector potential formulation is used. A gauge condition is added in combination with a spanning tree to remove the singular matrix problem associated with the formulation.

SEE EXAMPLE

POTENTIAL AIR FLOW AROUND AN AIRFOIL


Potential air flow around an airfoil

A NACA0012 airfoil is put in a subsonic air flow. The problem is nonlinear because the air density is a function of the air speed. The picture shows the Mach number everywhere around the airfoil.

SEE EXAMPLE

INCOMPRESSIBLE LAMINAR FLOW


Laminar flow

The nonlinear Navier-Stokes equations for incompressible laminar flow are solved with a Newton iteration to simulate the water flow past a step in a 1 mm pipe. The top image shows the flow velocity, the bottom image shows the pressure field.

SEE EXAMPLE

FLUID FLOW IN A MICROVALVE


Fluid flow in a microvalve

The flow speed magnitude (top) and the pressure field (bottom, 100 Pa at left inlet and 0 Pa at right outlet) are computed for a low Reynolds (Stokes) flow in a microvalve.

SEE EXAMPLE

CONTACT MECHANICS, COLLAPSED CMUT


Collapsed CMUT

The collapse mode of a CMUT ultrasonic transducer is simulated (in collapse mode the membrane touches the bottom of the cavity). The static deflection as well as the small signal vibration are simulated and illustrated on the image. The collapse mode of a CMUT can be visualized here (vibration in a fluid) and here (static collapse).

SEE EXAMPLE

DOWNLOAD

The easiest way to get the sparselizard C++ finite element library running on Linux and Windows 10 is to use its static library, even though better performances will be obtained when compiled on your computer.
Get sparselizard running with one of the following options:

Windows 10, Mac, Linux - Compiling the source code
  • This option gives the best performance
  • Download the source code here
  • Follow the instructions in the documentation
  • On Windows 10 get first an Ubuntu Linux subsystem as detailed here
  • (more info on how to access files from each side here)
Linux - Static library (TUTORIAL VIDEO)
  • Watch the tutorial video
  • Download the static library here (or here if no AVX support) and open the folder in a terminal.
  • Run 'g++ -O3 -fopenmp -std=c++11 main.cpp -L ./ -l sparselizard -pthread -l dl -I headers -o slexe;'
  • Run './slexe'
  • Visualise the output .vtk file with ParaView
Windows 10 - Static library with Linux subsystem
  • Watch the tutorial video for Linux
  • Install an Ubuntu subsystem on Windows 10 as detailed here
  • (more info on how to access files from each side here)
  • Download the static library here using 'wget' to the Ubuntu subsystem
  • Run 'sudo apt-get install unzip' then unzip the file
  • Run 'sudo apt-get install g++' to install the C++ compiler
  • In the unzipped file run 'g++ -O3 -fopenmp -std=c++11 main.cpp -L ./ -l sparselizard -pthread -l dl -I headers -o slexe;'
  • Run './slexe'
  • Visualise the output .vtk file with ParaView. This has to be done on Windows unless graphics are supported in your subsystem
Windows (others), Mac - Virtual Linux machine
  • A virtual Ubuntu Linux can be easily installed using VirtualBox.

Take a look at the examples in the 'examples' folder and at the documentation for a smooth introduction.

CITE US / DONATE

Because sparselizard is free and open source does not mean lines of code appear magically without effort. This library is mostly developed during after work, unpaid evenings. Even more to that, the web hosting costs and domain name costs are fully supported by myself, Alexandre Halbach. When using sparselizard cite reference:
"Sparselizard - the user friendly finite element C++ library",
Alexandre Halbach, University of Liege, Belgium


CONTACT

It would be a pleasure to answer any of your questions or to get your bug reports.
In the latter case please provide a minimal code including the bug.

ALEXANDRE HALBACH


PhD - Electrical Engineering

alexandre.halbach at gmail.com