Tools and techniques for building models for isogeometric analysis

Tools and techniques for building models for isogeometric analysis

Advances in Engineering Software 127 (2019) 70–81 Contents lists available at ScienceDirect Advances in Engineering Software journal homepage: www.e...

3MB Sizes 0 Downloads 57 Views

Advances in Engineering Software 127 (2019) 70–81

Contents lists available at ScienceDirect

Advances in Engineering Software journal homepage: www.elsevier.com/locate/advengsoft

Tools and techniques for building models for isogeometric analysis a

⁎,a

Anna Perduta , Roman Putanowicz

T

Institute for Computational Civil Engineering, Cracow University of Technology ul. Warszawska 24, 31–155, Cracow, Poland

ARTICLE INFO

ABSTRACT

Keywords: Isogeometric analysis IGA preprocessing Geometric modelling

Isogeometric Analysis (IGA) is a new computer method that has gained much attention in recent years. Its distinguishing feature is the use of parametric representation of curves, surfaces and solids, based on NonUniform Rational B-Splines, which are also used as shape functions in Galerkin approximation schemes. NURBS are commonly used in CAD modelling packages, thus among other advantages IGA facilitates use of CAD models as geometric domains for solving Boundary Value Problems. IGA is a relatively young method and despite its popularity there still is a small number of tools available, especially in comparison with Finite Element Method. This is notably nagging issue in case of tools for preparing geometric models for IGA. In this paper we discuss several popular tools and tricks that can be used in place of dedicated IGA preprocessor. The presented techniques can be particularly useful for researchers interested in starting work in IGA field, as they can speed up generation of comprehensive models and are incentive for data sharing, an important point from research reproducibility perspective.

1. Introduction

researchers, who start their work in IGA field and do not have access to dedicated IGA preprocessor. Due to the fact that we concentrate on presenting basics of preprocessing, we restrict ourselves only to discussing manifold multipatch NURBS geometries with no trimming applied. This restriction is necessary to keep content concise and yet comprehensive enough to be used in reader’s software implementations. There are few papers treating about scientific tools and this often leaves aspiring scientist struggling with the problems which were already tackled by predecessors, but the ideas have not been shared and documented. Our paper is devoted to tools for IGA preprocessing, however we hope that it will also be helpful to researchers working with other computational methods. The first part of the paper has a form of an overview, we concentrate on available software packages, emphasizing importance of data sharing. In the second part we give detailed presentation of our two approaches to build geometric models for IGA. One is based on Rhino program, the other on Asymptote programming language.

Isogeometric Analysis is a new method proposed by Hughes and coworkers [1]. It was designed to fill the gap between CAD modelling and Finite Element Analysis. The idea is to use the same basis functions for geometry modelling and field approximation and thus use exact geometric model in analysis, which is one of the major advantages of the method. Due to the features of basis functions, treatment of degrees of freedom is quite different comparing to traditional FEM. Thus incorporating new method into existing FEM codes can be a tedious task. Over the years IGA has gained strong interest and is highly developed method. Despite that there still exists a small number of free software packages for IGA, from which greater part are academic projects. In case of commercial tools we are aware on recent addition of facilities for isogeometric analysis in GiD [2]. Lai et al.del.[3]. propose a software framework that plays an interface role between Rhinoceros equiped with T-splines plugin and Abaqus. Besides standard IGA, several methods using CAD models where developed, from which we should mention: IGABEM [4,5] - comibination of IGA and boundary element method, where NURBS were used for geometry representation and field approximation on boundary elements; NEFEM [6] - method that enhances standard FEM with elements able to represent exactly curved boundaries. In this paper we focus on describing the ideas of using available software as IGA preprocessing tool, which may be found useful by



2. IGA-suitable models Before we start discussing available preprocessing tools we need to understand how IGA models are built, what are the difficulties of providing such models and what kind of techniques are used in preprocessors for representing complex geometric models.

Corresponding author. E-mail addresses: [email protected] (A. Perduta), [email protected], [email protected] (R. Putanowicz).

https://doi.org/10.1016/j.advengsoft.2018.10.008 Received 25 May 2018; Received in revised form 7 October 2018; Accepted 24 October 2018 0965-9978/ © 2018 Elsevier Ltd. All rights reserved.

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 1. Boundary Representation - cuboid bounded by topological entities. Fig. 2. Constructive solid geometry - bottom object is crated as the difference between left and right objects.

2.1. Types of geometric models If we want to use geometric modellers as preprocessors, we need to understand how geometric models are represented. We need to keep in mind that the output of CAD software is not only a model containing information on geometric entities but it also contains information on additional model’s properties, like style attributes, and in many cases artificial file settings like view settings. In this part we focus on geometric model representation and discuss two main techniques which are used in majority of geometric modelling software, that is:

NURBS curves are a linear combination of basis functions R of order p and control points B. Curves are defined as follows: n

R i p ( ) Bi

C( ) =

(1)

i=1

where the NURBS basis is built using B-Spline functions with additional weights wi prescribed to each function Ni:

• boundary representation (B-rep), • constructive solid geometry (CSG).

Ri p ( ) =

Boundary representation uses explicit topological and geometric information of solid’s boundaries to describe a model. Bounded topological entities (vertices, edges, faces) create geometric models, a simple B-Rep model is presented in Fig. 1. Many data structures were introduced to efficiently store boundary representation models, for instance winged-edge data structure [7]. B-rep can describe manifold and non-manifold models, offers rich set of operations which can be applied on defined models e.g. extrusion, revolution, chamfer. Explicit representation of model boundary makes B-rep attractive from the point of view of many computational methods, for instance finite element or boundary element methods. In CSG one uses basic geometric objects (e.g. cube, sphere) called primitives to model geometry. Primitives are created from sets of parameters describing an object (surface or solid) e.g. disc can be described using coordinates of its center point and radius. By applying Boolean operators to primitives one can create more complex shapes, this is presented in Fig. 2. Thus using CSG the model is represented as a tree of geometric Boolean operations. CAD software usually uses CSG to represent 3D models. In case of IGA the preferred and most commonly used representation is B-rep, however in recent years some steps have been taken to introduce CSG models [8,9]. Despite the use of the same geometry representation in IGA and CAD models we still need to process exported model before performing an analysis on it. The essential question when choosing a software package as IGA preprocessor is: if we take a software package what sort of representation can we get and what are the necessary steps to transform CAD models into IGA-suitable models?

Ni, p ( ) wi n ^i = 1 N ^i , p ( ) w ^i

(2)

Surfaces are defined in similar fashion: n

m

S( , ) =

Ri,pj, q ( , ) Bi, j

i=1 j=1

(3)

with NURBS functions given by:

Ri,pj, q ( , ) =

Ni, p ( ) Mj, q ( ) wi, j n ^i = 1

m ^j = 1

N ^i , p ( ) M ^j , q ( ) w ^i ,^j

(4)

In Fig. 3 we present a single patch 2D geometry, in Fig. 4 we display basis functions which were used to model this geometry, in both directions we used basis functions of same order, and in Tables 1 and 2 we gathered data used to model this geometry. Single patch geometry in 3D case is shown in Fig. 6. The tensor product nature of NURBS limits local refinement, that is element refinement results in additional control points distributed over the domain. To solve this issue, standard NURBS functions are replaced by functions supporting local refinement e.g. T-Splines [10,11] or their superior set PHT-Splines [12]. To improve use of non-standard functions Atroshchenko et al. in [13] propose to separate geometry and

2.2. Types of IGA models Fig. 3. Single patch geometry - red dots indicate control points. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

Basic geometry used in IGA is a single patch geometry, which consists of control points, basis functions of specified order, knot vector and weights (which are equal to 1 if we use B-Splines for modelling). 71

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 4. Basis functions of order 2 spanned over parametric domain [0,1], defined by knot vector: [0,0,0,1,1,1]. Table 1 Basis functions orders and knot vectors for single patch geometry. Direction

Order

Knot vector

ξ η

p=2 q=2

[0,0,0,1,1,1] [0,0,0,1,1,1]

Table 2 Control vertices and weights for single patch geometry. i

j

Bi,

j

1 1 1 2 2 2 3 3 3

1 2 3 1 2 3 1 2 3

(0, (1, (0, (2, (3, (2, (4, (5, (4,

0, 1, 2, 0, 1, 2, 0, 1, 2,

wi, 0) 0) 0) 0) 0) 0) 0) 0) 0)

Fig. 6. 3 dimensional single patch geometry - patch is divided to four elements, control vertices are not visible.

j

1 1 1 1 1 1 1 1 1

fields approximations, keeping transfer of CAD geometries possible and facilitating the use of advanced approximation schemes for field representation. It is worth to notice that a variety of CAD software supports only curves and surfaces modelling, where each geometric model is composed of multiple patches. Examples of simple multipatch geometries in 2- and 3D are presented in Figs. 5 and 7. If software supports 3D modelling, trivariate models are usually created by extruding, lofting or revolving NURBS surfaces. From IGA perspective limited software

Fig. 7. 3 dimensional multipatch geometry - model built from two patches, control vertices are not visible.

possibilities on generating 3D models are great disadvantage. A lot of work has been committed to introduce trivariate NURBS models for both B-rep [14,15] and CSG [9] representations. The necessity of generating analysis-aware CAD models induced studies on computational domain parameterisation techniques. Interested readers are referred to papers of Xu and coworkers [16–20] in which authors discuss parameterisation methods for single and multipatch two- and three-dimensional geometries and introduce IGA version of r-refinement[21]; where use of harmonic maps for parameterisation purposes is presented and [22] studying the influence of parameterisation on numerical stability. An important technique in computational geometry is trimming – using curves to cut out parts of surfaces from geometric models. Methods to incorporate trimmed geometries into isogeometric analysis were proposed [23–26]. IGA can also pports only curves and surfaces more mixed 2- and 3 dimensional geometries are used. To handle such geometries a sort of coupling on mixed interface needs to be provided, one of the proposals uses Nitsche method to handle this [27]. Keeping simplicity in mind, in this paper we will only focus on classic geometric models, thus excluding trimmed and mixed models from further discussion. Simple NURBS models are often used in IGA, as they are good starting point and can be used as benchmarks for software verification. Techniques proposed in this paper are presented for basic geometries, however they are are applicable in case of more complex geometries (Fig. 8).

Fig. 5. Multipatch geometry - model built from three patches, red dots indicate control points. (For interpretation of the references to colour in this figure legend, the reader is referred to the web version of this article.)

72

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 8. Mixed dimension model - solid connected with planar surface, control vertices are not shown.

3. Data modelling 3.1. Importance of data sharing We should highlight one key aspect of research, that is experiment reproducibility. This problem can be especially visible in experimental science, where it is difficult to restore exactly the same experiment conditions. In numerical simulations this seems to be much easier. The key is to share data used for problem modelling and information on used software and machine, however the problem should not be hardware dependant. Scanning through publications on computational methods one can observe that this is not common practice. A lot of papers lack of information on presented examples, thus in many cases it is cumbersome to reproduce modelled problem and compare the results. In our opinion in IGA it is important to share data used for geometric model preparation, because in general these models are harder to reproduce without given exact data. Scanning through IGA papers one can observe that specific types of examples are common, especially in 2D. From reproducibility point of view it is desirable to gather typical examples in some sort of a database, thus one could easily prepare problem with new geometric model. When developing new IGA software one should consider introducing file formats that will allow for quick data exchange and enable reproducibility of computed examples, even if this examples would only be used in closed environment.

Fig. 9. Annotating geometric model with analysis-suitable information.

once again we stress the importance of proper numbering scheme. In authors’ opinion the crucial aspect in implementing described data structure is to provide fluent pass through components of IGA package that is: preprocessor - parsed file - processor. 3.3. Annotating geometric models Usually what we obtain from CAD software is a to much detailed geometric model, which needs to be processed before performing numerical analysis. Even if IGA allows to use exact geometric models, often it is desirable to remove some details that have minor influence on object’s mechanics. We should highlight that CAD models do not contain information on material properties or boundary conditions, thus one must be aware that using CAD package as IGA preprocessor requires finding a way to incorporate these necessary data. One of the simplest methods is to annotate geometric model with data available in software, for example one can use different layers or different colours to mark material data, different line styles to mark boundary conditions like it is presented in Fig. 9. However it should be noted that provided annotations need to be properly handled in developed software. Additional data structure that supports mapping CAD annotations to boundary conditions should be provided. It is desirable for this mapping to be accessible during the preprocessing stage.

3.2. Storing data in calculation kernels Although this paper is about IGA preprocessing tools, we could not mention storing data in the calculation kernel. A separate paper could be dedicated to discuss this issue thoroughly, thus here we only mention the essential and most nagging issues. Readers interested in our work undertaken in this direction are referred to [28], where we discuss our point of view how data structures for IGA software could be designed. There is no simple way to introduce IGA to FEM codes due to basis function spanning over more than one element and thus handling the degrees of freedom. One way is to perform Bezier extraction as advised in [29], thus basis function would span over only one element, so the treatment of elements and degrees of freedom would be similar as in case of Finite Element Method with addition of exact geometry. While this process breaks NURBS basis functions into piecewise (element) Bezier basis functions the smoothness of the approximation is maintained. Still however the nature of the degrees of freedom may require development of additional data structures for instance to properly handle arbitrary boundary conditions. It is essential that calculation kernels will handle multipatch geometries - implemented data structure should enable storage of multiple patches and contain methods to perform patch gluing using techniques such as static condensation or Nitsche method [8,26,30]. Therefore the developer is responsible for ensuring proper book keeping of control vertices, degrees of freedom and elements. Other important aspect is proper handling of boundary conditions and enabling easy access to boundary facets on which conditions are applied. Similarly to Finite Element Method, data structures for IGA should allow for easy enumeration of elements and DOFs numbers, so

4. Overview of preprocessing software In this section we give very brief overview of some popular software that provide facility to model geometry with NURBS. We list popular file formats used by specific packages and indicate possible enhancements for adapting software as preprocessing tool. 4.1. Rhinoceros Rhinoceros [31] is software especially designed for NURBS modelling. Practically every object modelled in Rhino is a NURBS object even text. Prepared models can be written in default Rhinoceros format - 3DM, or can be exported to multiple frequently used in computational geometry file formats like for example IGES. The developers of Rhino equipped software with a variety of methods for NURBS modelling. Modelled geometry can easily be modified and, what is important in case of IGA, NURBS data are accessible: one can change control points position, modify knot vectors, elevate curve/surface degree. Rhinoceros mainly supports modelling of two dimensional geometries, but is not restricted only to it. 3D objects are generated on the basis of 2D shapes and can be created using such methods as lofting, extrusion, revolution and so on. From the programming point of view it is important to notice, that the developers of Rhino provided the OpenNURBS library for NURBS 73

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

modelling. Using this library one can easily obtain data written in 3DM format. We should highlight that models are represented with B-rep, thus one can save multipatch geometries. Provided support for scripting languages extends possibilities of Rhino. For example one can write code in Python to enable imposition of boundary conditions or introduce postprocessing for IGA.

introduce handling of multipatch geometries. The package does not provide Graphical User Interface, thus the only way of manipulating models is by editing data formatted in text files or stored directly in Octave data structures, so there is no way to quickly prototype geometry. However NURBS data used for modelling can be visualized, so one can write a tool based on the toolbox for simple preprocessing of 2D objects. Additionally data can be exported to IGES format.

4.2. Inkscape

5. File formats for sharing NURBS data

Inkscape [32] is a vector graphic editor. From IGA perspective one can use this editor as a simple preprocessing tool. Resulting Inkscape files - SVG (scalable vector graphics) files, are formatted with XML, thus saved file can easily be parsed to obtain data describing Bezier curves. Surfaces are created with paths, therefore it is not possible to model a Bezier surface and then obtain data describing surface from SVG file. What one can do to accomplish this goal is to describe edges of surface with Bezier curves and then interpolate data to obtain interior control points values. To prescribe boundary conditions or material data one can use different styles prescribed to SVG objects like it was shown in Section 3.3.

A good and common practice when developing numerical software is including support for handling input and output data. Providing such support facilitates data exchange, enables easy data modification without the need to recompile software with every minor change in input data. Implementing such support requires choosing proper file format. We may distinguish two types of file formats: binary and text. In this paper we will discuss most popular text formats, that is: ASCII, XML and JSON. Firstly we need to look at our model - what sort of data we will store. In IGA we mainly use NURBS data, so the following information have to be included:

• groups of data for each patch - knot vectors, basis order, control points coordinates, weights values, • explicit connection information - to allow multipatch analysis,

4.3. Autocad and general CAD software AutoCAD [33] is one of many computer-aided design software used for 2D and 3D modelling. It is equipped with NURBS modelling, thus one can use this software as a preprocessing tool for Isogeometric Analysis. With AutoCAD one can model NURBS curves and surfaces. Models can be saved in a standard binary file format (DWG) or its ASCII counterpart (DXF). DXF is a structured ASCII data file from which one can easily obtain NURBS curve data. NURBS surface data more convoluted are harder handle. As many common CAD software - AutoCAD can export files to widely accepted format IGES (Initial Graphics Exchange Specification), therefore one can easily obtain NURBS data. In AutoCAD curves can be modelled in two ways: by fitting curve to data points or by modelling curves shape with control points. AutoCAD comes with tools for curve rebuilding e.g. adding control points, elevating degree (up to 10), modifying control points position or weights values.

• •

however this information is dependent on computational kernel implementation, material information - material properties and patch information to which material is prescribed, boundary conditions information - type of BCs, prescribed values and boundary information.

The simplest way to deal with NURBS data is to save in plain ASCII file consisting only of numeric data. This however means that the meaning of each data field is implicit what make interpretation of the data difficult and error prone. This problem can be solved with introduction of keywords giving the file more structure, however the price for this is more complex parsing. XML is a language that allows to express arbitrary data structure. XML files are easy to parse and there exist many XML parsers so one can use provided library to easily obtain given data. However XML files are generally less readable than for example ASCII files. JSON or YAML [40] file formats provide structured data representation, are easy to read and parse. These file formats gained interest especially in Web applications but they also become common in scientific software. Like for XML files there exists many JSON/YAML parsers. It is important to notice that XML and JSON formats provide data hierarchy, so it is easy to introduce nested structures like multipatch models with given boundary conditions and material information.

4.4. Blender Blender [34] is an open source, comprehensive environment for modelling, animation, rendering, simulation, generally all things necessary to create 3D content. It is also mature tool for game and movie production. On geometric modelling side Blender provides excellent support for B-Rep modelling with polygonal meshes. Blender provides some NURBS tools, however the model is essentially polygonal with straight edges. Although IGA suitable models cannot be build completely in Blender, it can be one of tools in the preprocessing chain as we show later in the paper.

6. Designing I/O facilities

4.5. Matlab and octave

Research on numerical methods, shall it be IGA, FEM or any other method, is often based on very restricted set of simple geometric models. This is driven by time economy, as such set of models is usually enough to demonstrate the proof of concept. Handling numerous complex cases is left to scientific software industry. However even in research case investment in I/O facilities pays off, as preparation of model data is still most time consuming stage for many projects. Besides, other aspects of research such as sustainability, workflow management, simulation reproducibility require good I/O support. The main motive in providing it is the question how persistent data storage should be organised. This involves geometry, discretisation, material properties and other problem specific data. The answer to this issue is unfortunately to much context dependent to give some firm

It is impossible not to mention Matlab and its free counterpart Octave in this research paper - a popular software package used by scientist at different research levels. One of the first publicly available implementations of IGA were made in Matlab/Octave [35–37]. The structure of .m files is easy to understand, so one can look through available IGA implementations for some sort of inspiration or look what sort of file formatting was used to store model’s data. Matlab is not equipped with predefined NURBS functions, however several NURBS packages are implemented and can be used. One can use NURBS Toolbox implemented by Spink [38] or Octave package [39] based on this toolbox. In Octave package some effort has been taken to 74

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 11. Selected classed to represent project data in memory.

7. Building IGA models This section is the core of our presentation as it gives fairly detailed description how one can deal with building IGA models in the absence of a dedicated preprocessor.

Listing 1. Geometry specification in custom file format based on YAML.

7.1. Modelling starting point: Geometry versus topology

recommendations. As some general guidance we sketch the way we handle project I/O in our IGA simulator. We have decided to base our project file format on YAML [40]. Our initial choice was JSON however we have switched to YAML because of the lack of natural way of handling comments in JSON. File comments plus simple syntax turned out to be important when experimenting and modifying files a lot during research. Other, ”heavy weight” solutions such as the ones based on SILO, HDF5, or Hoops Exchange didn’t fit into our use case. They have either large specs or are proprietary. Our data files are small, the content is very hierarchical, often modified by hand. We have no customers and the minimal team, thus we wanted to build our simulation tools very quickly. Rolling out our own data file format based on some standard modelling language has turned out to be effective approach. To give the feeling of this format Listing 1 shows fragment specifying two patch geometry similar to the one illustrated in Fig. 9. In our C++ code we implement input facilities for YAML files with yaml-cpp library. Regarding the data structures we have organised our I/O facilities around the concept of Project object illustrated in Fig. 10. Project object forms sort of a data buffer between disk storage and simulation kernel. The main purpose of Project is to enable easy transfer of data from disk to memory as well as to give simple API for data access in simulator’s kernel. For this reason there is almost one-toone correspondence between structure of our data file and Project related classes. Some of those classes are shown in Fig. 11. Project and related classes form sort of property tree and one could ask if it is not enough to use more homogeneous storage structures provided by YAML parser and access them directly in kernel. We have decided against such approach because Project provides cleaner, safer and more intuitive API for accessing data in kernel. Project is also the place where validation and some initial transformation of data is done.

In the classical multipatch version of Isogeometric Analysis the computational kernel needs the access to data describing patches connectivity (topology). One should note that the decomposition into patches is generally not needed in modelling the geometric domain. It is the requirement put by specific computational method. Thus one has two choices - either to generate such decomposition after the geometric model is built, or to incorporate generation of the patches straight into the process of building the geometric model. The first approach is very difficult, even touching some open research problems such as generation of hexahedral only decompositions, geometric features recognition, model decimation. While somehow doable it would require on our side much effort and good geometric modelling kernel. Thus we decided to apply the second approach. The problem with it was to find a tool that would allow to specify the geometry in terms of NURBS entities but the same time easily recover patch connectivity information. Tools such as Inkscape allows easily to draw NURBS patches, however recovery of patches connectivity is somehow difficult. In the end, we have developed two solutions - one based on Rhino modelling program and other on Asymptote programing language. We illustrate them for geometric domain shown in Fig. 12. 7.2. Building IGA models with rhino Building IGA models with Rhino consist of two steps: 1. Creating multipatch geometry using Rhino GUI. 2. Exporting created model to our YGA format. The process of creating multipatch geometry for Rhino was the following:

• create boundary of geometric model using arcs and straight lines, • create interior lines for subdividing geometry into patches, • approximate geometry using Rhino’s surface elements (untrimmed NURBS patches), • rebuild created patches – to create consistent mesh we used second order approximation and five control points in each direction; we lowered the order and the number of originally created control vertices, this resulted in slight deviation from the original geometry,

Fig. 10. Parsing file into Project data structure. 75

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 12. Sample geometric model.

• join surfaces to create polysurface – that is a B-rep gathering all patches

This resulted in geometric model shown in Fig. 13. The task of exporting this model from Rhino to our data format was done with the Python script shown in full extent in Listing 2. After that we were able to pass the model to our simulator and handle it in desired way, for instance generate visualization mesh shown in Fig. 14. Rhino provides very versatile Python API to access model data. Combined power of Rhino modelling facilities and simple Python API make this approach very attractive, especially for 3D cases. The only drawback is that this solution is specific to Windows operating system.

Listing 2. Python script for generating YGA file (in YAML format) from Rhino geometry.

7.3. Building IGA models in blender and asymptote As our main development environment is Linux we wanted platform agnostic solution. Additionally we wanted to utilise the knowledge of some tools without the need to learn Rhino. The tools we often use are Blender for dealing with polygonal meshes and Asymptote programming language [41]. Asymptote is vector graphics oriented language that we extensively use in preparation of scientific illustrations. Combination of Blender, Asymptote and Python yields interesting, flexible and transparent solution, especially in 2D case. The output we want from our preprocessing tools is data file in our YGA format, describing patches connectivity, geometry and data associated with patches decomposition (and sometime geometric elements). The key to presented solution is the order of generating the mentioned data. The required steps are:

Fig. 13. Multipatch geometry generated in Rhino. 76

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 15. Mesh representing connectivity of patches constituting geometric domain.

Fig. 14. Visualisation mesh generated from Rhino geometry.

1. With Blender generate polygonal mesh describing topology of decomposition of geometric domain into patches. The nodal coordinates of this mesh are irrelevant, what counts is the connectivity. 2. Export generated mesh from Blender to PLY [42] format and process it further with Python script to make it easily readable from within Asymptote program. 3. Write Asymptote script that reads the mesh of patches and superimposes the true geometry of modeled domain on mesh vertices, edges and faces. 4. Process the data exported from Blender with the above script and export it into our YGA format. 7.3.1. Patches topology in blender As Blender is mature 3D environment it provides all sorts of tools for dealing with polygonal meshes. It is then simple to load an image of modelled domain and cover it with mesh of quad elements representing patches. The node placement is not important, one just have to make sure that the straight mesh edges can later on be turned into curves that will exactly cover modeled domain. For the sample geometry from Fig. 12 one can use patch arrangement shown in Fig. 15. Fig. 16 shows the result of reading such generated patches into our program with the assumption of linear embedding, that is straight edges and nodal coordinates as assigned in Blender. Each patch has its own NURBS parametrisation. Fig. 15 was generated by the Asymptote script shown in Listing 3. In order to make possible reading meshes in Asymptote script it was necessary to implement class Mesh2D. In the simplest form the implementation consists in three classes Vertex, Cell, Mesh2D. Below we show simplified but complete implementation of these classes. Class Vertex stores just vertex coordinates using point type from Asymptote’s geometry package. Class Cell stores the list of integer indices of its nodes and the reference to the array of Vertex object kept in Mesh2D object. Class Mesh2D is consist mainly of arrays of vertices and cells. Class Mesh2D is equipped with methods for populating vertices and cells shown in Listing 7.

Fig. 16. Mesh of IGA patches build directly from patches topology mesh assuming linear embedding. Patches colored with magnitude of parametric coordinates.

Listing 3. Asymptote script draw_mesh.asy to visualize mesh defined in a

Listing 4. Asymptote class representing mesh vertex.

77

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Listing 5. Asymptote class representing mesh polygonal cell.

Fig. 17. Constructions based on tangents between circles and lines. Listing 6. Asymptote class representing 2D mesh.

Listing 9. Asymptote class for representing fillet geometry.

7.3.2. Geometry description in asymptote To complete modelling it is now necessary to describe geometry of each edge of the above topology mesh. While Asymptote is versatile enough to handle all sorts of geometric objects we restrict our presentation to the case where the domain can be described with circular arcs and straight segments. This set of geometric primitives is enough to describe our sample domain shown in Fig. 12, as well as some other domains commonly met in engineering problems. The key point in assigning geometry to edges of is the ability to calculate position of tangent points between circular arcs and lines. Such points will constitute endpoints of segments and arcs. In order to make our Asymptote script concise we provide two utilities to handle most common cases shown in Fig. 17.

• construction of a fillet of given radius between two segments, • construction of a segment tangent to two given circles. For convenience we introduce class Fillet that consist of two segments and a circular arc tangent to the segments. Additionally in Fillet object we store arc center and array of points that include segment endpoints. The Fillet declaration is shown in Listing 9. Fillet objects are constructed from two segments that may or may not

Listing 7. Methods of Mesh2D to populate vertices and cells.

Listing 8. Method to read Mes2D from a file.

The above methods are used in function to read mesh data from a file. Here we provide the simplest solution of reading from raw mesh file that consist just of numerical data: number of nodes, number of cells, node coordinates, cell connectivity.

Listing 10. Fillet class constructor. 78

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

Fig. 18. Two configuration of angle lever obtained by varying fillet radius.

Listing 11. Construction of segment tangent to two circles.

Listing 13. Superimposing angle lever geometry on its topological mesh of NURBS patches.

intersect and radius of connecting arc. The respective constructor implementation is shown in Listing 10. The second utility is function to construct segment tangent to two circles. There are four configuration of line tangent to two circles but here we consider only two configurations, such one where the circles lay on the same side of the tangent line. The function takes as the argument the circles and string indicating on which side of the axis connecting the centres of the circles the tangent line shall be constructed. The implementation follows the classical geometric construction with compass and ruler and is shown in Listing 11. Armed with the utility function we can now present Asymptote script that generates angle lever geometry considered as our main example. The code is shown in Listing 12. The script consist of three parts: declaration of variables representing geometry dimensions, generation

Listing 12. Construction of angle lever geometry. 79

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz

can ease some burden related to preparations of models for Isogeometric Analysis. Acknowledgments This work was financially supported by Polish Ministry of Science and Higher Education within the contract no. L5/130/2017/DS. Supplementary material Supplementary material associated with this article can be found, in the online version, at doi:10.1016/j.advengsoft.2018.10.008. References [1] Hughes TJR, Cottrell JA, Bazilevs Y. Isogeometric analysis: CAD, finite elements, NURBS, exact geometry and mesh refinement. Comput Methods Appl Mech Eng 2005;194(39):4135–95. [2] Gid the personal pre and post processor, web page. 2018. https://www.gidhome. com/category/examples/iga/. [3] Lai Y, Liu L, Zhang YJ, Chen J, Fang E, Lua J. Rhino 3D to abaqus: a T-spline based isogeometric analysis software framework. Advances in computational fluid-structure interaction and flow simulation: new methods and challenging computations. Springer International Publishing; 2016. p. 271–81. [4] Simpson RN, Bordas SPA, Trevelyan J, Rabczuk T. A two-dimensional isogeometric boundary element method for elastostatic analysis. Comput Methods Appl Mech Eng 2012;209–212:87–100. [5] Scott MA, Simpson RN, Evans JA, Lipton S, Bordas SPA, Hughes TJR, Sederberg TW. Isogeometric boundary element analysis using unstructured t-splines. Comput Methods Appl Mech Eng 2013;254:197–221. [6] Sevilla R, Fernández-Méndez S, Huerta A. NURBS-enhanced finite element method (NEFEM). Int J Numer Methods Eng 2008;76(1):56–83. [7] Baumgart BG. Winged edge polyhedron representation. Technical report. Stanford, CA, USA: Stanford University; 1972. [8] Rank E, Ruess M, Kollmannsberger S, Schillinger D, Duster A. Geometric modeling, isogeometric analysis and the finite cell method. Comput Methods Appl Mech Eng 2012;249–252:104–15. [9] Zuo B-Q, Huang Z-D, Wang Y-W, Wu Z-J. Isogeometric analysis for CSG models. Comput Methods Appl Mech Eng 2015;285:102–24. [10] Sederberg T, Zheng J, Bakenov A, Nasri A. T-Splines and T-NURCCs. ACM Trans Graph 2003;22(3):477–84. [11] Scott MA, Li X, Sederberg TW, Hughes TJR. Local refinement of analysis-suitable Tsplines. Comput Methods Appl Mech Eng 2012;213–216:206–22. [12] Nguyen-Thanh N, Nguyen-Xuan H, Bordas SPA, Rabczuk T. Isogeometric analysis using polynomial splines over hierarchical t-meshes for two-dimensional elastic solids. Comput Methods Appl Mech Eng 2011;200(21):1892–908. [13] Atroshchenko E, Tomar S, Xu G, Bordas SPA. Weakening the tight coupling between geometry and simulation in isogeometric analysis: from sub- and super-geometric analysis to geometry-independent field approximation (GIFT). Int J Numer Methods Eng 2018;114(10):1131–59. [14] Akhras HA, Elguedj T, Gravouil A, Rochette M. Isogeometric analysis-suitable trivariate NURBS models from standard b-rep models. Comput Methods Appl Mech Eng 2016;307:256–74. [15] Akhras HA, Elguedj T, Gravouil A, Rochette M. Towards an automatic isogeometric analysis suitable trivariate models generation application to geometric parametric analysis. Comput Methods Appl Mech Eng 2017;316:623–45. [16] Xu G, Mourrain B, Duvigneau R, Galligo A. Optimal analysis-aware parameterization of computational domain in isogeometric analysisn. Advances in geometric modeling and processing. Springer Berlin Heidelberg; 2010. p. 236–54. [17] Xu G, Mourrain B, Duvigneau R, Galligo A. Parameterization of computational domain in isogeometric analysis: methods and comparison. Comput Methods Appl Mech Eng 2011;200(23):2021–31. [18] Xu G, Mourrain B, Duvigneau R, Galligo A. Constructing analysis-suitable parameterization of computational domain from CAD boundary by variational harmonic method. J Comput Phys 2013;252:275–89. [19] Xu G, Mourrain B, Duvigneau R, Galligo A. Analysis-suitable volume parameterization of multi-block computational domain in isogeometric applications. Comput-Aided Des 2013;45(2):395–404. [20] Xu G, Mourrain B, Duvigneau R, Galligo A. Optimal analysis-aware parameterization of computational domain in 3d isogeometric analysis. Comput-Aided Des 2013;45(4):812–21. [21] Nguyen T, Jüttler B. Parameterization of contractible domains using sequences of harmonic maps. Curves and surfaces. Springer Berlin Heidelberg; 2012. p. 501–14. [22] Pilgerstorfer E, Jüttler B. Bounding the influence of domain parameterization and knot spacing on numerical stability in isogeometric analysis. Comput Methods Appl Mech Eng 2014;268:589–613. [23] Kim H-J, Seo Y-D, Youn S-K. Isogeometric analysis for trimmed CAD surfaces. Comput Methods Appl Mech Eng 2009;198:2982–95. [24] Kim H-J, Seo Y-D, Youn S-K. Isogeometric analysis with trimming technique for problems of arbitrary complex topology. Comput Methods Appl Mech Eng 2010;199:2796–812.

Fig. 19. Mesh of patches superimposed on true geometry of the modelled part.

of geometric primitives, drawing of obtained primitives. Fig. 18 shows two configurations of angle lever obtained with different values of the fillet radius. Besides the ability to describe geometry, the Asymptote scripts presented above allow easily to introduce parametrisation of the geometry. This in turn enables automation of parametric study. This is additional advantage compared to Rhino based solution. While parametrisation can also be introduced in Rhino solution, it seems easier to automate the approach based on Asymptote scripts. 7.3.3. Merging the topology and geometry Being able to read mesh of patches and describe true shape of geometric domain it is now relatively easy to merge these two aspects by superimposing geometry on the mesh. This can be done by assigning coordinates of specific points to mesh vertices and indicating which geometric primitives are associated with which edges. Listing 13 shows what it takes to assign coordinates of mesh vertices and Fig. 19 shows the mesh aligned with true domain geometry. This last step is the most tedious but the same time easily controllable. When done we have now in Assymptote data structures the complete description of geometric model with patch decomposition that we can save in our YGA format for further processing. 8. Conclusions In this paper we indicate that there is still not enough easily accessible preprocessors for Isogeometric Analysis. We discuss some specific requirement that should be met by geometric models if they are going to be used in IGA. To mitigate the problem of the lack of dedicated preprocessor for IGA we show two approaches to build a substitute with easily accessible tools. One is based on Rhino, the other is based on Blender and Asymptote language. The solutions we describe are relatively inexpensive and flexible, especially the one based on Asymptote. The presented scripts can be easily tailored to readers’ specific cases. We hope that this presentation 80

Advances in Engineering Software 127 (2019) 70–81

A. Perduta, R. Putanowicz [25] Schmidt R, Wuchner R, Bletzinger K-U. Isogeometric analysis of trimmed NURBS geometries. Comput Methods Appl Mech Eng 2012;241–244:93–111. [26] Ruess M, Schillinger D, Özcan AI, Rank E. Weak coupling for isogeometric analysis of non-matching and trimmed multi-patch geometries. Comput Methods Appl Mech Eng 2014;269:46–71. [27] Nguyen VP, Kerfriden P, Brino M, Bordas SPA, Bonisoli E. Nitsche’S method for two and three dimensional NURBS patch coupling. Comput Mech 2014;53:1163–82. 6 [28] Perduta A., Putanowicz R.. Data structures supporting multi-region adaptive isogeometric analysis. 22nd international conference on computer methods in mechanics CMM2017 - AIP conference proceedings2018;040003-1 - 040003-9. [29] Borden MJ, Scott MA, Evans JA, Hughes TJR. Isogeometric finite element data structures based on bezier extraction of NURBS. Int J Numer Methods Eng 2010;87:15–47. [30] Andreas A, Robert S, Roland W, Kai-Uwe B. A nitsche–type formulation and comparison of the most common domain decomposition methods in isogeometric analysis. Int J Numer Methods Eng 2013;97:473–504. [31] Rhinoceros, web page. 2018. https://www.rhino3d.com/. [32] Inkscape, web page. 2018. https://inkscape.org.

[33] Autodesk autoCAD, web page. 2018. https://www.autodesk.com/products/ autocad/overview. [34] Blender, web page. 2018. https://www.blender.org/. [35] Vuong AV, Heinrich C, Simeon B. ISOGAT: A 2d tutorial MATLAB code for isogeometric analysis. Adv Appl Geometry 2010;27:644–55. [36] Nguyen VP, Anitescu C, Bordas S, Rabczuk T. Isogeometric analysis: an overview and computer implementation aspects. Math Comput Simul 2015;117:89–116. [37] Vázquez R. A new design for the implementation of isogeometric analysis in octave and matlab: geoPDEs 3.0. Comput Math Appl 2016;72:523–54. [38] NURBS toolbox by d. m. spink, web page. 2018a. https://www.mathworks.com/ matlabcentral/fileexchange/26390-nurbs-toolbox-by-d-m-spink. [39] nurbs - octave package,web page. 2018b. https://octave.sourceforge.io/nurbs/ overview.html. [40] YAML: YAML ain’t markup language, web page. 2018. http://yaml.org/. [41] Asymptote: The vector graphic language, web page. 2018. http://asymptote. sourceforge.net/. [42] PLY - Polygon File Format, Web page. 2018. http://paulbourke.net/dataformats/ ply/.

81