Graph grammar and algorithmic transformations Lecture topics: Review of 1D solver 2D Finite Element Method Generalization of the multi-frontal solver algortihm to 2D problems GENERALIZATION TO 1D FINITE ELEMENT METHOD Strong formulation Find u C 2 0 , l such that a ( x ) u ' ( x ) ' b ( x ) u ' ( x ) c ( x ) u ( x ) f ( x ) u (0) 0 a (l ) u ' (l ) u (l ) Weak formulation Find u V such that l l au ' v ' bu ' v cuv dx u ( l ) v ( l ) f v dx v ( l ) 0 0 b u , v v V v H 1 0 , l : v ( 0 ) 0 l v GENERALIZATION TO 1D FINITE ELEMENT METHOD Finite element method disretization N u a i N a b e , e l e v ej ei i i 1 i j j j 1,..., N i 1 l ae i ' e j ' be i ' e j ce i e j dx e i ( l ) e j ( l ) b ei , e j 0 l l ej f e j dx e j ( l ) 0 ae i ' e j ' be i ' e j ce i e j dx ae i ' e j ' be i ' e j ce i e j dx e i ( l ) e j ( l ) b ei , e j K1 ae K1 i K2 ' e j ' be i ' e j ce i e j dx ae K2 i ' e j ' be i ' e j ce i e j dx e i ( l ) e j ( l ) EIGHT FINITE ELEMENTS EXAMPLES Element matrices: Eight finite elements mesh each matrix contains degrees of freedom (unknowns) associated with two vertex shape functions, and two interior shape functions with vertex shape functions and two interior shape functions on each element EIGHT FINITE ELEMENTS EXAMPLES Elimination of the two interior shape functions over each element (meaning: elimination of rows with unknowns – called degrees of freedom – associated with the interior shape functions) EIGHT FINITE ELEMENTS EXAMPLES Merging of the two Schur complements, for pairs of two adjacent elements EIGHT FINITE ELEMENTS EXAMPLES Elimination of the one common vertex shape functions, in each pair of adjacent elements EIGHT FINITE ELEMENTS EXAMPLES Merging of the two Schur complements, for sets of four adjacent elements EIGHT FINITE ELEMENTS EXAMPLES Elimination of the one common vertex shape functions, in each set of four adjacent elements EIGHT FINITE ELEMENTS EXAMPLES Merging of the resulting Schur complements – all elements are involved EIGHT FINITE ELEMENTS EXAMPLES Elimination of the one common vertex shape functions EIGHT FINITE ELEMENTS EXAMPLES Recursive backward substitutions EIGHT FINITE ELEMENTS EXAMPLES Recursive backward substitutions EIGHT FINITE ELEMENTS EXAMPLES Recursive backward substitutions 1D Hp Finite Element 1D hierarchical shape functions: 2D Hp Finite Element 4 vertices 4 mid-edge nodes 1mid-face nodes The reference element shape functions are created as tensor products of 1D hierarchical shape functions 2D Hp Finite Element Vertex shape functions and second order edge and interior shape functions 1 e hp 3 e hp 5 e hp 2 e hp 4 e hp 8 e hp 7 9 e hp e hp 14 e hp 16 e hp 17 e hp 2D Hp Finite Element One bilinear shape function for each of 8 vertices (order of approximation equal to 1 in each vertex) 2D Hp Finite Element shape functions for each of 4 mid-edge nodes (various orders of approximation) 2D Hp Finite Element face bubble shape functions for interior node 2D hp FINITE ELEMENT METHOD 15 u i i u hp e hp i 1 We seek the solution u of some weak form of PDE as a linear i combination of shape functions e hp spread over finite element mesh 1 3 e hp 2 e hp 8 e hp 4 e hp 7 e hp e hp 5 e hp 9 e hp 2D hp FINITE ELEMENT METHOD 1 3 e hp 2 e hp 5 e hp e hp 4 e hp 7 e hp 9 e hp 8 e hp i hp b e ,e i The coefficients u hp (called „degrees of freedom” d.o.f.) are obtained by solving system of linear equations – finite element disecretization of a weak (variational) form of PDE 15 j hp i j i j and l e u hp b e hp , e hp l e hp i j 1,..., 15 j i 1 where b e hp , e hp j hp i j are some integrals of shape functions e hp , e hp ORDERING ISSUES Full forward elimination O(15^3) ORDERING ISSUES Partial forward elimination O(6*9^2) ORDERING ISSUES Partial forward elimination O(6*9^2) ORDERING ISSUES Full forward elimination of the interface problem matrix O(3^3) ORDERING ISSUES Backward substitutions ORDERING ISSUES ”Naive” ordering: (order of elimination of rows) 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 One frontal matrix Computational cost O(15^3) ”Smart” ordering: (order of elimination of rows) 1,2,6,7,11,12; 4,5,9,10,14,15; 3,8,13 Two frontal matrices Computational cost O(6*9^2)+O(3^3) Parallel multi-frontal solver PARALLEL VERSION FOR FOUR ELEMENTS EXAMPLE PARALLEL VERSION FOR FOUR ELEMENTS EXAMPLE PARALLEL VERSION FOR FOUR ELEMENTS EXAMPLE Mesh refinements CONSTRUCTION OF THE REFINEMENT TREES CONSTRUCTION OF THE REFINEMENT TREES CONSTRUCTION OF THE REFINEMENT TREES CONSTRUCTION OF THE REFINEMENT TREES CONSTRUCTION OF THE ELIMINATION TREE BASED ON THE HISTORY OF MESH REFINEMENTS For any initial mesh, the elimination tree can be created based on nested dissection algorithm. CONSTRUCTION OF THE ELIMINATION TREE BASED ON THE HISTORY OF MESH REFINEMENTS The elimination tree created for the initial mesh is updated when the mesh is refined (elimination tree is constructed dynamically, during mesh refinements) CONSTRUCTION OF THE ELIMINATION TREE BASED ON THE HISTORY OF MESH REFINEMENTS The elimination tree created for the initial mesh is updated when the mesh is refined (elimination tree is constructed dynamically, during mesh refinements) Ordering ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Local matrices for active elements – leaves of the elimination tree – are created ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Interior degrees of freedom are eliminated at every leaf ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Schur complement contributions are merged at parent level ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Fully assembled degrees of freedom are eliminated at parent nodes level (degrees of freedom related to common edges shared by both son elements can be eliminated now) ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Contributions to Schur complement are merged again at the next level ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Fully assembled degrees of freedom are eliminated ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • Finally, Schur complement contributions are merged at the tree root node ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • The common interface problem is solved at the tree root node (The size of the common interface problem corresponds to the size of crossection of the entire domain) ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • The solution obtained at root node is utilized at son nodes. • The backward substitution is executed ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • The solution utilized at the second level nodes is utilizes at their sone nodes. • The backward substitution is executed ELIMINATIONS BASED ON REFINEMENT TREES Level of initial mesh elements Level of refinement trees • The solution obtained at the third level nodes is utilized at leaf nodes. • The backward substitution is executed on the level of leaf nodes CLASSICAL MULTIFRONTAL SOLVER ALGORITHM • In case of mesh with multiple different adaptation levels, the multifrontal solver algorithm scans the mesh elements and eliminates degrees of freedom starting from leaves to the root of the adaptation tree, on each coarse mesh element independently. CLASSICAL MULTIFRONTAL SOLVER ALGORITHM • Interface size: green nodes Interface size: blue nodes CLASSICAL MULTIFRONTAL SOLVER ALGORITHM • Interface size: green nodes Interface size: blue nodes The matrix size is growing !!! The matrix size is growing !!! PROPOSED MODIFICATION TO MULTIFRONTAL SOLVER ALGORITHM • Interface size: green nodes Constant matrix size !!! PROPOSED MODIFICATION TO MULTIFRONTAL SOLVER ALGORITHM • Interface size: green nodes Constant matrix size !!!