Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves

Embed Size (px)

DESCRIPTION

Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves. Csaba Attila Vigh Department of Informatics, TU München JASS 2006, course 2: Numerical Simulation: From Models to Visualizations. Outline. Adaptive Grids Introduction and basic ideas - PowerPoint PPT Presentation

Citation preview

  • Efficient Storage and Processing of Adaptive Triangular Grids using Sierpinski Curves Csaba Attila VighDepartment of Informatics, TU MnchenJASS 2006, course 2:Numerical Simulation: From Models to Visualizations

  • OutlineAdaptive Grids Introduction and basic ideasSpace-Filling curvesGeometric generationHilberts, Peanos, Sierpinskis curveAdaptive Triangular GridsGeneration and Efficient ProcessingExtension to 3D

  • Adaptive Grids BasicsWhy do we need Adaptive grids?Modeling and SimulationPDE mathematical modelDiscretization Solution with Finite Elements or similar methodsDemand for Adaptive Refinement very often

  • Adaptive Grids BasicsAdaptive RefinementTrade-off between Memory Requirements and Computing TimeNeed to obtain Neighbor Relationships between Grid CellsStoring Relationships Explicitly leads to:Arbitrary Unstructured GridsConsiderable Memory Overhead

  • Adaptive Grids BasicsAdaptive Refinement - want to save memory?Use a Strongly Structured GridUse Recursive Splitting of Cells (Triangles)Neighbor Relations must be computedComputing Time should be small

  • Adaptive Grids BasicsProcessing of Recursively Refined (Triangular) GridLinearize Access to the Cells using Space-Filling CurvesFor Triangles Sierpinski CurveUse a Stack System for Cache-EfficiencyParallelization Strategies using Space-Filling Curves are readily available

  • Space-Filling Curves1878, CantorAny two Finite-Dimensional Manifolds have same Cardinality[0, 1] can be Mapped Bijectively onto the Square [0,1]x[0,1], or onto the Cube1879, Netto such a Mapping is necessarily Discontinuous

  • Space-Filling CurvesIs then possible to obtain a Surjective Continuous Mapping?orIs there a Curve that passes through every Point of a Two-Dimensional Region?1890, Peano constructed the first one

  • Hilberts Space-Filling CurveHilberts Geometric Generating ProcessIf Interval I ( ) can be mapped continuously onto the square Q ( )Partition I into Four Congruent SubintervalsPartition Q into Four Congruent SubsquaresThen each Subinterval can be Mapped Continuously onto one of the SubsquaresNext continue the Partitioning Process on the Subintervals and Subsquares

  • Hilberts Space-Filling CurveHilberts Geometric Generating ProcessAfter n Partitioning Steps I and Q are split into Congruent ReplicasSubsquares can be arranged such thatAdjacent Subintervals correspond to Adjacent Subsquares with an Edge in commonInclusion Relationships are preserved

  • Hilberts Space-Filling CurveHilberts Mapping and three Iterations

  • Hilberts Space-Filling CurveSix Iterations

  • Peanos Space-Filling CurvePartitioning in 9 Subintervals and Subsquares Subintervals mapped to SubsquaresPeanos Mapping

    Sheet1

    349

    258

    167

  • Peanos Space-Filling CurveThree Iterations of the Peano Curve

  • Sierpinskis Space-Filling CurveFour Iterations of the Sierpinski Curve Slicing the Square into half by its Diagonal Half of the Curve lies on one Triangle Other half lies on the other Triangle

  • Sierpinskis Space-Filling CurveCurve may be viewed as a Map from Unit Interval I onto a Right Isosceles Triangle TT with Vertices at (0,0), (2,0), (1,1)Hilberts Generating PrinciplePartition I into two Congruent SubintervalsPartition T into two Congruent SubtrianglesOrder of Subtriangles shown in the next picture

  • Sierpinskis Space-Filling Curve

  • Sierpinskis Space-Filling CurveCurve starts from (0,0), ends at (2,0)Exit Point from each Subtriangle coincides with Entry Point of the next oneRequirement on Orientation in Subtriangles shown in picture below

  • Recursively Structured Triangular Grids and Sierpinski Curves

    Computational DomainRight Isosceles Triangle Starting CellGrid constructed recursivelySplit each Triangle Cell into 2 Congruent SubcellsSplitting Repeated until Desired Resolution is ReachedGrid may be Adaptive Local Splitting

  • Recursively Structured Triangular Grids and Sierpinski CurvesRecursive Construction of the Grid on a Triangular Domain

  • Recursively Structured Triangular Grids and Sierpinski CurvesCells are in Linear Order on the Sierpinski CurveCorresponds to Depth-First Traversal of the Substructuring TreeAdditional Memory 1 bit per Cell indicating whetherCell is a Leave, orCell is Adaptively Refined

  • Recursively Structured Triangular Grids and Sierpinski CurvesExtensions for FlexibilitySeveral Initial Triangles may be usedArbitrary Triangles may be used ifStructure of Recursive Subdivision preservedOne Leg is defined as Tagged Edge and will take the role of the HypotenuseTagged Edge can be replaced by a Linear Interpolation of the Boundary (see next picture)

  • Recursively Structured Triangular Grids and Sierpinski CurvesSubdividing Triangles at Boundaries

  • Discretization of the PDEA Discretization with Linear FEGeneratesElement Stiffness MatricesRight Hand SidesAccumulates them into Global System of Equations for the Unknowns on the NodesWe consider it to be too Memory Consuming

  • Discretization of the PDEAssumptionStiffness Matrix Computation possible on the fly, orHardcode it into the SoftwareTypical for Iterative SolversContain Matrix-Vector Product between Stiffness Matrix and UnknownsMemory used only for storing Grid Structure

  • Discretization of the PDEClassical Node-Oriented ProcessingLoop over Unknowns (Nodes on Grid)Requires Access to all neighbor NodesDifficult in a Recursively Structured GridNeighbor could be on a Different SubtreeOur Approach: Cell-Oriented Processing

  • Cache Efficient Processing of the Computational GridCell-Oriented ProcessingNeed Access to Unknowns for each CellProcess Elements along the Sierpinski CurveSierpinski Curve Divides Unknowns into two halvesLeft of the Curve: Red NodesRight of the Curve: Green NodesSee picture next

  • Cache Efficient Processing of the Computational GridRed (Circles), Green (Boxes)

  • Cache Efficient Processing of the Computational GridAccess to Unknowns is like Access to a StackConsider Unknowns 5 to 10During Processing Cells to the Left Access in Ascending OrderDuring Processing Cells to the Right Access in Descending OrderNodes 8, 9, 10 Placed in turn on Top of the Stack

  • Cache Efficient Processing of the Computational GridSystem of Four Stacks to Organize Access to UnknownsRead Stack holds Initial Value of UnknownsTwo Helper Stacks Red and Green hold Intermediate Values of Unknowns of respective ColorWrite Stack stores Updated Values of Unknowns

  • Cache Efficient Processing of the Computational GridWhen Moving from one Cell to the other2 Unknowns Adjacent to Common Edge can always be reused2 Unknowns opposite to Common Edge must be processed:One from Exited Cell One in the New Cell

  • Cache Efficient Processing of the Computational GridUnknown from Exited CellPut onto Write Stack if processing completePut onto Helper Stack of respective Color if needed by other CellsUnknown in the New CellTake from Read Stack if never used it beforeTake from Helper Stack of respective Color if already used it before

  • Cache Efficient Processing of the Computational GridUnknown from Exited CellCount number of Accesses Determine whether Processing is Complete or notDetermine the Color Left or Right side of the Sierpinski Curve ?Curve Enters and Exits at the 2 Nodes adjacent to the HypotenuseOnly 3 possible Scenarios

  • Cache Efficient Processing of the Computational GridDetermining Color of the NodesCurve Enters through Hypotenuse Exits across Opposite LegCurve Enters through Adjacent Leg Exits through HypotenuseCurve Enters and Exits across the Opposite LegsRed (circles), Green (boxes)

  • Cache Efficient Processing of the Computational GridUnknown in the New CellDetermine Color as aboveDetermine whether New or OldConsider the 3 Triangle Cells adjacent to This CellOne is Old where the Curve enteredOne is New where the Curve exitsThird Cell may be Old or New check Adjacent EdgesBoth New Third Cell is New Unknown is NewUnknown is Old otherwise

  • Cache Efficient Processing of the Computational GridRecursive Propagation of Edge ParametersKnowing Scenario for the Cell also know Scenarios for Subcells

  • Cache Efficient Processing of the Computational GridProcessing of the Grid is managed by a set of 6 Recursive ProceduresOn the Leaves the Discretization-Level Operations are performedExample from Maple worksheet is next

  • Step 1

  • Step 2

  • Step 3

  • Step 4

  • Step 5

  • Step 6

  • Step 7

  • Step 8

  • Step 9

  • Step 10

  • Step 11

  • Step 12

  • Step 13

  • Step 14

  • Step 15

  • Step 16

  • Step 17

  • Step 18

  • Step 19

  • Step 20

  • Step 21

  • Step 22

  • Step 23

  • Step 24

  • Step 25

  • Step 26

  • Step 27

  • Step 28

  • Step 29

  • Step 30

  • Step 31

  • Step 32

  • Parallelization 5 Equal parts

  • Conformity of Locally Refined GridsNo hanging NodesMaintaining Conformity in any Locally Refined GridConsider Triangles, Tetrahedrons or N-Simplices Refined with Recursive BisectionsNeed only Finite Number of Additional Bisections for CompletionLocality of Refinement is preservedGrid will not become Globally Uniformly Refined

  • 3D Sierpinski Curves2D Sierpinski Curve fills a Triangle3D Curve expected to fill a TetrahedronHow to subdivide a Tetrahedron?Tetrahedron with a Tagged Edge:4-Tuple withEdge isDirectedTaggedTakes the role of the Hypotenuse

  • 3D Sierpinski CurvesBisection of Tetrahedron along Tagged Edge ,Sierpinski Curve Approximated by Polygonal Line of the Tagged Edges

  • 3D Sierpinski CurvesBisection of a Tagged Tetrahedron. Red Arrows approximate the Sierpinski Curve.

  • ConclusionAlgorithm Efficiently generates and processes Adaptive Triangular GridsMemory Requirement is minimalHope to achieve Computational Speed competitive with Algorithms based on Regular GridsExtension to 3D is currently subject to research

  • Questions????Thank You!