700 likes | 993 Views
www. ing.unipi . it. Codename “NanoFEM Platform” - software architecture and components. Marek Gayer , Ph.D. Project TCAD by prof. Giuseppe Iannaccone. Goals of NanoFEM platform. Design and implement open source software for nano-electronics CAD/CAE
E N D
www.ing.unipi.it Codename “NanoFEM Platform” - software architecture and components Marek Gayer, Ph.D. Project TCAD by prof. Giuseppe Iannaccone
Goals 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
Related 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
Finite 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
3D 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
NetGen – 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. OpenGLVisualization • 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
GMsh 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
GMsh – Mesh of transistor + Postprocessing (tutorial dataset)
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
Salome 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
Components 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
MED / 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).
Interactive designer –User Interface –C++ with Qt • Salome Platform • MeshAPI with Dolfin
Fenics / 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
Fenics / 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
Our 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
MeshAPI/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++
MeshAPI/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.
Example of valid XML material database • <?xmlversion="1.0"encoding="UTF-8"?> • <materialDatabasexmlns="materials.xsd"> • <materialname="Si"description="(100)[silicio]"> • <parametername="dielectricConstant"description="CostanteDielettricarelativa"type="double"value="11.8" /> • <parametername="longitudeMassForElectrons"description="MassaLongitudinaleelettrone"type="double"value="0.98" /> • <parametername="transversalMassForElectrons"description="MassaTrasversaleelettrone"type="double"value="0.19" /> • </material> • <materialname="SiO2"description="ossidodisilicio"> • <parametername="dielectricConstant"type="double"value="3.9" /> • </material> • <materialname="Air"description="Aire"> • </material> • </materialDatabase>
Text is transformed to following class • class MaterialData • { • public: • double electroMobility; • double holeMobility; • int reserved; • std::string description doubletrapLevel; • 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(); • };
MeshAPI/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)
MeshAPI 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)
Wrappers 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)
Solving example – linear Poisson • 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
Converting 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
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); • }
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; } };
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; • } };
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; • } };
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; • } };
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; • } };
Solving example – non-linear Poisson • 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
Future 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