Codename “NanoFEM Platform” - software architecture and components Marek Gayer, Ph.D. Project TCAD by prof. Giuseppe Iannaccone www.ing.unipi.it
Dec 22, 2015
Codename “NanoFEM Platform”
- software architecture and components
Codename “NanoFEM Platform”
- software architecture and components
Marek Gayer, Ph.D.
Project TCAD by prof. Giuseppe Iannaccone
www.ing.unipi.it
3MUNICH 2008
www.ing.unipi.it
Goals of NanoFEM platformGoals of NanoFEM platform
Design and implement open source software for nano-electronics CAD/CAE
Should be flexible - for research purposes Interactive features: Geometry, meshing
and visualization Separation of informatics and physics Ability to run on remote servers Able to run on Windows and Linux Extendible; users should be able to develop
for the platform by ability write own modules Performance
4MUNICH 2008
www.ing.unipi.it
Related solutions / approachesRelated solutions / approaches
Commercial codes (Atlas)Fentaurus, Sonos, EMOSFET
MATLAB, FreeFEM Disadvantages: limited
extendibility, changing equations,performance
Existing simulation frameworks- GMSH, Salome Platform, Orcan
Existing Meshers: - Netgen and Tetgen, Lagrit and Cubit
Finite Element Solvers - Fenics/Dolfin, Libmesh, Getfem++, Rheolef, Tahoe (from Sandia), OOFEM.org, OFELI
5MUNICH 2008
www.ing.unipi.it
Finite Element MethodFinite Element Method Finding solution for Partial
Differential equations for evaluation of characteristics (e.g. potential)
Discretizes continuum (i.e. modeled object) into finite number of elements – e.g. triangles, tetrahedron
Characteristics are determined in the nodes of the element
Complex to design and implement, solid mathematical and informatics understanding required for performance
6MUNICH 2008
www.ing.unipi.it
3D Finite Element Mesh3D Finite Element Mesh
Suitable discretization of continuous domain to simple volume cell elements
Partial differential equations (PDE’s) can be replaced by system of non-linear algebraic equations
Very complex to generate FEM mesh on arbitrary structures
To create a quality mesher = topic minimally for a whole PhD study
7MUNICH 2008
www.ing.unipi.it
NetGen – advancing front MesherNetGen – advancing front Mesher
Exchange data in memory or files Supports anisotropic refinement of the mesh Auto detection of places with finer mesh Includes application w. OpenGL Visualization Mesh output format: One file with sections:
nodes, volume elements (tetrahedra) , surface elements (triangles), edges. Format poorly documented.
Mesh export: DiffPack, TecPlot, Tochnog, Fluent, Abaqus, Permas, Feap, Elmer, STL, VRML, GMSH
8MUNICH 2008
www.ing.unipi.it
Transistor modeled in NetGenTransistor modeled in NetGen
9MUNICH 2008
www.ing.unipi.it
GMsh mesher + pre/postprocessorGMsh mesher + pre/postprocessor
Developed 1997 – 2007 Input geometry specified either by own geometry
format or interactively 3D Mesh algorithm uses either Netgen or TetGen
(linked in) Different regions are specified by defining Physical
volumes Output mesh: List of points and tetrahedra facets with
respect to Physical volumes User interface: FLTK, not very nice and intuitive Visualization: OpenGL/VTK Windows version is compiled with Cygwin, with
switch –mno-cygwin
11MUNICH 2008
www.ing.unipi.itGMsh – Mesh of transistor + Postprocessing (tutorial dataset)
GMsh – Mesh of transistor + Postprocessing (tutorial dataset)
12MUNICH 2008
www.ing.unipi.it
Salome platform – more then a mesher!Salome platform – more then a mesher!
SALOME(LGPL) is a free software that provides a generic platform for Pre and Post-Processing for numerical simulation. It is based on an open and flexible architecture made of reusable components available as free software.
Available since 2003, 1 million+ lines Over 975 developer/months (Salome 2) Current release Salome 3.2.6 (May 2007), 3.2.9 on the
way Does not fulfill our initial requirement portability due
to be natively only Linux or Unix
www.salome-platform.org
13MUNICH 2008
www.ing.unipi.it
Salome platform observationsSalome platform observations
Supports interoperability between CAD modeling and computation software (CAD-CAE link)
Very good user interface (Qt4) All functionalities are also accessible through the
programmatic integrated Python console Large package with great number of dependencies Not very easy to start with Very hard, if possible at all to install on new Linux
distributions (3.2.6) with GCC 4.x Much more powerful then any other open source finite
element solution we found
14MUNICH 2008
www.ing.unipi.it
Salome platform modular architectureSalome platform modular architecture
15MUNICH 2008
www.ing.unipi.it
Components of NanoFEM platformComponents of NanoFEM platform
Salome 3.2.6 supports limited number of OS Comes as a VmWare image with:
– Debian Linux 3.1 (codename Sarge)– Salome 3.2.6– Fenics/Dolfin 0.7.1– MeshAPI – library for our FEM module– Our additional codes and Salome component – KDevelop for development– Additional tools (Krusader, …)
Running on VmWare Server 1+ or Workstation 6+ Eventual distribution based on providing this image
16MUNICH 2008
www.ing.unipi.it
MED / HDF data formatMED / HDF data format
Storing and loading data associated to numerical meshes and fields
Exchange between codes and solvers Comes with C++/Python API Data can be exchanged in memory 3. levels – files, memory, CORBA (data on
demand) The persistent data storage is based upon
HDF format (developed by Boeing and NASA in the area of Computational Fluid Dynamic).
17MUNICH 2008
www.ing.unipi.it
Interactive designer –User Interface – C++ with QtInteractive designer –User Interface – C++ with Qt
MeshAPI with Dolfin
Salome Platform
18MUNICH 2008
www.ing.unipi.it
Fenics / Dolfin – (L)GPLFenics / Dolfin – (L)GPL Winner from our evaluation of FEM
libraries, October 2007 Supports both iterative and direct solvers
(LU, Krylov solver) Uses PETSc and uBLAS for systems of
linear/nonlinear equations => high performance linear algebra
Automatic generation of finite elements, evaluation of variational form assembly of matrices for FEM – linear systems
Support for general families of finite elements, including arbitrary order continuous and discontinuous Lagrange finite elements, BDM elements, RT elements, BDFM elements, Nedelec elements and Crouzeix-Raviart
www.fenics.org
19MUNICH 2008
www.ing.unipi.it
Fenics / DolfinFenics / Dolfin
Almost nothing about FEM method is needed to use and develop it
Difficult to install, namely on non-Ubuntu or with PETSc
Eigen value problems with SLEPSc Simple and intuitive C++ object interface Many input / output formats - DOLFIN XML,
VTK, Octave, MATLAB, OpenDX, Diffpack, Exodus
Could be better documented
21MUNICH 2008
www.ing.unipi.it
Our Salome CAE moduleOur Salome CAE module
MeshAPI/Core mesh and fields MeshAPI/XML material database MeshAPI/Linear-Nonlinear PDE MeshAPI/Dolfin |-> inherited MeshAPI based solvers Wrappers for Salome Command line tool(s) for testing or
running from command line
22MUNICH 2008
www.ing.unipi.it
MeshAPI/Core mesh and fieldsMeshAPI/Core mesh and fields
Reading Salome mesh from files .med files (MEDMEM API)
Processing mesh coordinates and connectivities Processing groups of Mesh (can be defined in Salome
editor) Passing this information to Dolfin (to build mesh in
memory) Providing core fields (such as Source, Flux, Potential,
some visual debug fields) Additional methods to work with mesh and fields Control of storing of core and custom fields to .MED files Support of Dirichlet boundary conditions Clean code design in strictly object oriented C++
24MUNICH 2008
www.ing.unipi.it
MeshAPI/XML Material DatabaseMeshAPI/XML Material Database
Transforming of readable .xml file to fast C++ structures
Based on libxml2 via SAX parser approach (fast, consumes few memory even for huge structures) http://en.wikipedia.org/wiki/Simple_API_for_XML
Created XSD schema for database (http://en.wikipedia.org/wiki/XML_Schema ), allows us to easily validate, whether the XML document is correct and contains the allowed tags and attributes
User friendly in good XML editor => Errors are marked just similar to spelling and
grammar errors in word and IntelliSense offers allowed values.
25MUNICH 2008
www.ing.unipi.it
Example of valid XML material databaseExample of valid XML material database
<?xml version="1.0" encoding="UTF-8"?>
<materialDatabase xmlns="materials.xsd"> <material name="Si" description="(100)[silicio]"> <parameter name="dielectricConstant"
description="CostanteDielettricarelativa" type="double" value="11.8" />
<parameter name="longitudeMassForElectrons" description="MassaLongitudinaleelettrone" type="double" value="0.98" />
<parameter name="transversalMassForElectrons" description="MassaTrasversaleelettrone" type="double" value="0.19" />
</material> <material name="SiO2" description="ossidodisilicio"> <parameter name="dielectricConstant" type="double"
value="3.9" /> </material> <material name="Air" description="Aire"> </material> </materialDatabase>
26MUNICH 2008
www.ing.unipi.it
Text is transformed to following classText is transformed to following class
class MaterialData { public: double electroMobility; double holeMobility; int reserved; std::string description
double trapLevel; double acceptorEnergy; double donorsEnergy; double electronAfinity; double electronAfinity1; double dielectricConstant; double dielectricConstant1; double longitudeMassForElectrons; double transversalMassForElectrons; double holeMass; double energyGap; double energyGap1; double alfaParameter; double alfaParameter1; double betaParameter; double betaParameter1;
MaterialData(); };
27MUNICH 2008
www.ing.unipi.it
MeshAPI/Linear-Nonlinear PDEMeshAPI/Linear-Nonlinear PDE
Classes allowing solving nonlinear and nonlinear PDE, using Dolfin, allows to set preconditioners and Krylov methods:
Available Krylov methods:– cg - The conjugate gradient method– gmres - The GMRES method (default)– bicgstab - The stabilized biconjugate gradient squared
method Preconditioners:
– none - No preconditioning– jacobi - Simple Jacobi preconditioning– sor - SOR, successive over-relaxation– ilu - Incomplete LU factorization (default)– icc - Incomplete Cholesky factorization– amg - Algebraic multigrid (through Hypre when available)
28MUNICH 2008
www.ing.unipi.it
MeshAPI based solversMeshAPI based solvers Using MeshAPI, one can easily, in few of lines define
Dolfin solvers as classes inherited from class “Dolfin”. Behaviour that can be generalized and reused is
already defined in Mesh API It can be used in any current and future examples There are 3 example solvers:
– Poisson example from Dolfin manual, but using Salome mesh
– Poisson equation computed on partitioned group– Poisson equation computed on partitioned group
with permittivity (Eps)– Non-linear Poisson equation computed on
partitioned group with permittivity (not 100% done)
29MUNICH 2008
www.ing.unipi.it
Wrappers for Salome moduleWrappers for Salome module
Module can be used in Salome (with/out GUI) Automake based Linked with Dolfin and MEDMEM libraries Selected routines are automatically wrapped Works in Salome supervision module Automatic conversion (using Salome
hxx2salome tool based on mainly configure and automake)
30MUNICH 2008
www.ing.unipi.it
Inserting callable routines through Supervisor moduleInserting callable routines through Supervisor module
31MUNICH 2008
www.ing.unipi.it
Solving linear PDE: Poisson equation:
f(x) – source function (known), can be 0 ε(x) – permittivity of material in given point u(x) – potential, that we are computing g(x) – Neumann boundary condition, can be 0
Solving example – linear PoissonSolving example – linear Poisson
)()]()([ xfxux
32MUNICH 2008
www.ing.unipi.it
Converting equation to variational formConverting equation to variational form
# The bilinear form a(v, U) and linear form L(v) for # Poisson's equation. # Compile this form with FFC: ffc -l dolfin PoissonEps.form
element = FiniteElement("Lagrange", "tetrahedron", 1) v = TestFunction(element) u = TrialFunction(element) f = Function(element) g = Function(element)
a = dot(grad(v), grad(u))*dx L = v*f*dx + v*g*ds
# This generates 5239 lines, 191.359 characters
33MUNICH 2008
www.ing.unipi.it
Solving routine in C++Solving routine in C++ #include "PoissonEps.h“ #include "LinearPDE.hxx"
int SC::PoissonEps::solve () {
– Source f (mesh);– Flux g (mesh);– DirichletFunction u0 (mesh);– DirichletBoundary boundary(mesh);– DirichletBC bc (u0, mesh.dolfinMesh, boundary);– Eps eps (mesh);– PoissonEpsBilinearForm a (eps);– PoissonEpsLinearForm L (f, g, eps);– SC::LinearPDE pde (a, L, mesh.dolfinMesh, bc);– pde.setupKrylov (mesh.krylovMethod, mesh.krylovPc);– Function solution;– pde.solve(solution);
– mesh.nodePotential.init (u); mesh.nodeSource.init (f); mesh.nodeFlux.init (g);– mesh.resetFieldsToWrite();– Field<double> *fields[] = {&mesh.nodePotential, &mesh.nodeSource, &mesh.nodeFlux, NULL};– mesh.addFieldsToWrite (fields);
}
34MUNICH 2008
www.ing.unipi.it
Solving routine in C++Solving routine in C++ class DirichletBoundary : public SubDomain {
– MeshAPI &mesh;public:– DirichletBoundary(MeshAPI & meshInstance) :
mesh(meshInstance)– {– }– bool inside(const dolfin::real* x, bool on_boundary) const– {
int index = mesh.getGroupNumberFromCoordinates(x);MaterialFunction *nodeMaterial = mesh.materialFunctions[index]; return nodeMaterial->materialData == NULL;
}};
35MUNICH 2008
www.ing.unipi.it
Solving routine in C++Solving routine in C++ class DirichletFunction : public Function {
– MeshAPI &mesh;public:– DirichletFunction(MeshAPI& meshInstance) :
mesh(meshInstance), Function(meshInstance.dolfinMesh)– {– }– dolfin::real eval(const dolfin::real* x) const– {– int index = mesh.getGroupNumberFromCoordinates(x);
MaterialFunction *nodeMaterial = mesh.materialFunctions[index];
– return nodeMaterial->dirichlet;– }};
36MUNICH 2008
www.ing.unipi.it
Solving routine in C++Solving routine in C++ class Source : public Function {
– MeshAPI &mesh;public:
– Source(MeshAPI & meshInstance) : mesh(meshInstance), Function(meshInstance.dolfinMesh)
– {– }– dolfin::real eval(const dolfin::real* x) const– {
return 0;– }};
37MUNICH 2008
www.ing.unipi.it
Solving routine in C++Solving routine in C++ class Flux : public Function {
– MeshAPI &mesh;public:
– Flux(MeshAPI & meshInstance) : mesh(meshInstance), Function(meshInstance.dolfinMesh)
– {– }– dolfin::real eval(const dolfin::real* x) const– {
return 0;– }};
38MUNICH 2008
www.ing.unipi.it
Solving routine in C++Solving routine in C++ class Eps : public Function {
– MeshAPI &mesh;public:– Eps (MeshAPI& meshInstance) : mesh(meshInstance),
Function(meshInstance.dolfinMesh)– {– }– dolfin::real eval(const dolfin::real* x) const– {– int index = mesh.getGroupNumberFromCoordinates(x);
MaterialFunction *nodeMaterial = mesh.materialFunctions[index];
– return nodeMaterial->permitivity;– }};
39MUNICH 2008
www.ing.unipi.it
Solving non-linear PDE: Poisson equation:
n(u, r) - is the electron concentration (m-3) p(u, r) - is the hole concentration (m-3) ε(r) – permittivity of material in given point NA(r) - Acceptor concentration ND(r) - Donor concentration q - elementary charge 1.61e-19 C
Solving example – non-linear Poisson Solving example – non-linear Poisson
0)()(),(),()()( rqNrqNruqpruqnrur DA
41MUNICH 2008
www.ing.unipi.it
Future plans for NanoFem PlatformFuture plans for NanoFem Platform
More complex equations (drift, diffusion) Compare performance with commercial More modules with exchange of fields Tests of supervision (with scripting) More complex boundary conditions Run on Debian Lenny and new Salome Get some funding
42MUNICH 2008
www.ing.unipi.it
Mosfet in Salome - ScratchingMosfet in Salome - Scratching
43MUNICH 2008
www.ing.unipi.it
Mosfet in Salome - ScratchingMosfet in Salome - Scratching
44MUNICH 2008
www.ing.unipi.it
Cylindrical structures in SalomeCylindrical structures in Salome
45MUNICH 2008
www.ing.unipi.it
Cylindrical structures in SalomeCylindrical structures in Salome
46MUNICH 2008
www.ing.unipi.it
Cylindrical structures in SalomeCylindrical structures in Salome
47MUNICH 2008
www.ing.unipi.it
Cylindrical structures in SalomeCylindrical structures in Salome
48MUNICH 2008
www.ing.unipi.it
Cylindrical structures in SalomeCylindrical structures in Salome
49MUNICH 2008
www.ing.unipi.it
Boolean operations in SalomeBoolean operations in Salome
50MUNICH 2008
www.ing.unipi.it
Boolean operations in SalomeBoolean operations in Salome
51MUNICH 2008
www.ing.unipi.it
Sub shape extractionSub shape extraction
52MUNICH 2008
www.ing.unipi.it
Shell contructionShell contruction
53MUNICH 2008
www.ing.unipi.it
ExtrusionExtrusion
54MUNICH 2008
www.ing.unipi.it
Scratching surfacesScratching surfaces
55MUNICH 2008
www.ing.unipi.it
Scratching surfacesScratching surfaces
56MUNICH 2008
www.ing.unipi.it
Compounds in SalomeCompounds in Salome
57MUNICH 2008
www.ing.unipi.it
Geometry visualization in SalomeGeometry visualization in Salome
58MUNICH 2008
www.ing.unipi.it
Gluing faces in geometryGluing faces in geometry
59MUNICH 2008
www.ing.unipi.it
Detection of faces to glueDetection of faces to glue
60MUNICH 2008
www.ing.unipi.it
Creating groupsCreating groups
61MUNICH 2008
www.ing.unipi.it
Creating group, inner structuresCreating group, inner structures
62MUNICH 2008
www.ing.unipi.it
Creating group, inner structuresCreating group, inner structures
63MUNICH 2008
www.ing.unipi.it
Mosfet with groups in SalomeMosfet with groups in Salome
64MUNICH 2008
www.ing.unipi.it
NETGEN mesh generationNETGEN mesh generation
65MUNICH 2008
www.ing.unipi.it
Mesh generated for MosfetMesh generated for Mosfet
66MUNICH 2008
www.ing.unipi.it
Creating mesh groupsCreating mesh groups
67MUNICH 2008
www.ing.unipi.it
All groups created, we can exportAll groups created, we can export
68MUNICH 2008
www.ing.unipi.itAfter running our module with linear Poisson equation, we can postprocess
After running our module with linear Poisson equation, we can postprocess
69MUNICH 2008
www.ing.unipi.it
3D cut in postprocessing in Salome3D cut in postprocessing in Salome
70MUNICH 2008
www.ing.unipi.it
3D cut in postprocessing in Salome3D cut in postprocessing in Salome
71MUNICH 2008
www.ing.unipi.it
Development of our module in KDeveloperDevelopment of our module in KDeveloper
72MUNICH 2008
www.ing.unipi.it
Debugging in KDevelopDebugging in KDevelop
73MUNICH 2008
www.ing.unipi.it
Thank you for your attention.Thank you for your attention.
???Do you have any questions ?