A Program Family Approach to Developing Mesh Generators a Program Family Approach to Developing Mesh Generators
Total Page:16
File Type:pdf, Size:1020Kb
A PROGRAM FAMILY APPROACH TO DEVELOPING MESH GENERATORS A PROGRAM FAMILY APPROACH TO DEVELOPING MESH GENERATORS By FANGCAO, B.Sc A Thesis Submitted to the School of Graduate Studies in Partial Fulfillment of the Requirements for the Degree Master of Applied Science McMaster University © Fang Cao, April 2006 MASTER OF APPLIED SCIENCE (2006 April) McMaster University (Software Engineering) Hamilton, Ontario TITLE: A Program Family Approach to Developing Mesh Generators AUTHOR: Fang Cao, B.Sc (University of Ottawa) SUPERVISORS: Dr. Spencer Smith NUMBER OF PAGES: vii, 211 Acknowledgement First of all, I would like to thank my supervisor, Dr. Spencer Smith, for his suggestions, guidance, and motivation during my pursuit of the Master degree. Without his encourage ment and support, this work would not have come to an existence. For that I'm eternally grateful for his help. I also want to express my sincere gratitude to my family, especially my parents and my girlfriend Sandy. They have been such a blessing in my life and given me constant support and encouragement. Abstract This thesis presents a systematic approach for rapid development of a program family of special-purpose 2D structured mesh generators, where a mesh is a discretization of a geo metric domain into small simple shapes, such as triangles or quadrilaterals. Mesh gener ators are commonly used to produce the input files for finite element and other numerical analysis programs that solve partial differential equations. Despite the existence of many general-purpose mesh generators, there is a lack of re search attention on the design of special-purpose generators suitable for small and spe cific meshing problems. The program family approach shown in this thesis supports reuse and code customization by identifying the commonalities and variabilities between mesh generators. The program family we developed accommodates variabilities in geometry, topology, material properties, boundary conditions, system parameters and output file for mat. Developing mesh generators using the program family approach results in the quality of special purpose mesh generators being improved in terms of usability, reusability and maintainability. The contribution of this thesis centres on the design documentation and the system im plementation. The complete documentation of our design includes a commonality analysis, requirements specification, and module guide. The contributions with respect to the imple mentation include the use of a domain-specific language (DSL) written in XML (Extensible Mark-up Language) to model the seed specification required to produce a mesh generator family member, as well as applying XSL (Extensible Stylesheet Language) to allow flexible customization of the output file(s). Contents Acknowledgement 3 Abstract 4 Contents 5 List of Tables 11 List of Figures 12 Chapter 1. Introduction 1 1.1 Background on Mesh Generators 2 1.1.1 Mesh Terminology . 2 1.1.2 Physical Mesh Information Used by Finite Element Analysis Pro- grams ........................... 7 1.2 Current Practices for Designing and Developing Mesh Generators 8 1.2.1 A Look at the Design Strategies Used for Existing Mesh Generators 9 1.2.2 Problems with the Current Approach . 12 1.3 A Review of Program Family Methodology and Family-Oriented Software Production . 15 1.3.1 The Appropriateness of a Mesh Generator Family. 15 1.3.2 Current Techniques of Family-Oriented Software Development 17 1.4 Purpose and Scope . 21 Contents 6 1.5 Overview of the Thesis . 22 Chapter 2. Software Requirements and Design 23 2.1 Commonality Analysis 24 2.1.1 Commonality 25 2.1.2 Variabilities . 28 2.1.3 Parameter of Variation 29 2.2 Requirements Specification . 33 2.2.1 What is a Software Requirement . 33 2.2.2 Identifying Our Requirements . 35 2.2.2.1 Understanding the System . 35 2.2.2.2 Modifying Commonality Analysis Document as System Requirements . 37 Chapter 3. System Implementation 42 3.1 Mesh Input Specification with XML 43 3.2 Meshing Algorithm . 48 3.3 Formatting Output Files with XSLT Stylesheets 54 3.3.1 The Structure ofXML Document Containing the Mesh Data 54 3.3.2 Using XSLT Stylesheets to Produce Plain Text Files 58 Chapter 4. System Demonstration 61 4.1 General-purpose Interface for Rectangular Domain Meshing 62 4.1.1 File and Domain Menus 63 4.1.2 Geometry Dialog 64 4.1.3 Material Dialog . 65 4.1.4 Element Dialog . 66 4.1.5 Boundary Condition Dialog 66 4.1.6 System Parameter Dialog . 67 4.1. 7 Generating the Mesh and Visualization 68 7 4.1.8 XSL Stylesheet and Output File Generation . 69 4.2 Special-purpose Interface for a Nonrectangular Domain . 71 4.2.1 Special-purpose vs. General Purpose ... 72 4.2.2 Nonrectangular Domain Mesh Generation . 74 Chapter 5. Conclusions 82 5.1 Conclusions . .... 82 5.2 Contributions of Our Work 84 5.3 Future Work . 85 Bibliography 87 Chapter A. Commonality Analysis for Mesh Generating Systems 93 A.1 Introduction . 93 A.2 Terminology and Definitions 94 A.3 Commonalities . 94 A.3.1 Mesh Generation 96 A.3.2 Input 100 A.3.3 Output 102 A.3.4 Nonfunctional Requirements . 104 A.4 Variabilities . 106 A.4.1 Mesh Generation 107 A.4.2 Input 110 A.4.3 Output 111 A.4.4 System Constraints 113 A.5 Parameters of Variation . 113 A.5.1 Mesh Generation 114 A.5.2 Input . 118 A.5.3 Output 120 A.5.4 System Constraints 122 8 A.6 References ...................... 123 A.7 Appendix: Topology Patterns for Structured Meshes. 123 Chapter B. The Software Requirement Specification for a "Parameterized Mesh Generator" 125 B.1 Introduction •••• 0 ••••• 125 B.l.l Purpose of Document . 125 B.1.2 Terminology and Definitions . 126 B.1.2.1 Software Engineering Related Definitions and Acronyms 127 B.1.2.2 Mesh Generation Related Definitions and Acronyms . 129 B.l.3 References 130 B.1.4 Overview . 131 B.2 General System Description 131 B.2.1 System Purpose . 131 B.2.2 System Scope . 134 B.2.3 System Context . 135 B.2.4 Major System Capabilities 136 B.2.5 User Characteristics ... 139 B.2.6 Assumptions and Dependencies 139 B.3 Specific System Requirements .. 140 B.3.1 Functional Requirements . 141 B.3.1.1 PMG features 141 B.3.1.2 Input ..... 143 B.3.2 Nonfunctional Requirements . 151 B.3.3 System Constraints 153 B.4 Other System Issues . 154 B.4.1 Open Issues . 155 B.4.2 Off-the-Shelf Solutions . 155 B.4.3 Our Program Family .. 156 9 B.4.4 Waiting Room ............................ 156 Chapter C. The Module Guide for "Parameterized Mesh Generator" (PMG) 159 C.1 Introduction . 159 C.2 Module Decomposition . 161 C.2.1 Hardware-Hiding module . 161 C.2.1.1 Input Device module . 161 C.2.1.2 Output Device module . 162 C.2.1.3 File Input/Output module . 163 C.2.2 Behavior-Hiding module . 163 C.2.2.1 Function Drivers module . 163 C.2.2.2 Shared Services module . 166 C.2.2.2.1 Error Handle module . 166 C.2.2.2.2 Mesh Drawing module . 166 C.2.2.2.3 File Customization module . 166 C.2.3 Software Decision module . 167 C.2.3.1 Specification Parsing module . 167 C.2.3.2 Input Data module . 167 C.2.3.3 Mesh Data module . 168 C.2.3.3.1 Geometric Grid module . 168 C.2.3.3.2 Physical Attributes module . 168 C.2.3.3.3 System Parameters module . 168 C.2.3.4 Mesh Generation Algorithm module . 168 C.3 Module Hierarchy . 169 C.4 Use Hierarchy between Modules . 170 Chapter D. Test Plan 177 D.1 General Information. 177 D.l.l Summary .. 178 10 D.1.2 Goals and Objectives 178 D.1.3 State of Scope 178 D.2 Building the Test Plan . 179 D.2.1 Test Factors and Risks . 179 D.2.2 Reference ...... 182 D.2.3 Tested Components . 182 D.2.4 Testing Methods .. 183 D.2.4.1 Code Inspection 184 D.2.4.2 Unit Testing .. 185 D.2.4.3 Integration Testing . 186 D.2.4.4 Validation Testing 186 D.2.4.5 Test Matrix . 186 D.2.5 Testing Cases . 188 D.2.5.1 PMG 188 D.2.5.2 MG Interface . 192 D.2.5.3 Mesh Generation and Output File . 195 D.2.6 Detailed Test Cases . 197 D.2.7 Example Test Case . 208 List of Tables 2.1 An Example Commonality . 26 2.2 Modifications to Commonalities 27 2.3 An Example Variability . 29 2.4 An Example Parameter of Variation 31 2.5 Changes Made to Parameter of Variation Between S&C and the current study 32 2.6 Outline of SRS in Appendix B . 38 2.7 Example ofMGG Requirement. 39 2.8 Another Example of MGG Requirement 40 2.9 Example of a Nonfunctional Requirement 40 2.10 Example of a System Constraint 41 D.1 Test Factor/Test Phase Matrix . 181 D.2 Test Matrix . 188 List of Figures 1.1 A Hexahedral Mesh . 3 1.2 Mesh Entities in a Computational Domain 5 1.3 Unstructured Finite Element Mesh by P. Lafvre 6 1.4 Example of a 2D Quadrilateral Mesh with Boundary Conditions 8 3.1 DSL Fragment for Element Specification. 46 3.2 Natural Coordinate System of a Triangular Element 4 7 3.3 DSL Fragment for Material Specification . 47 3.4 A Parabolic Quadrilateral Mesh Calculated with Eight-node Shape Functions 48 3.5 General Scheme of ZP Algorithm with Key Diagram Mapping 50 3.6 DTD ofXML Document Holding Mesh Data .