12
Computer Aided Geometric Design 27 (2010) 644–655 Contents lists available at ScienceDirect Computer Aided Geometric Design www.elsevier.com/locate/cagd ISOGAT: A 2D tutorial MATLAB code for Isogeometric Analysis A.-V. Vuong, Ch. Heinrich , B. Simeon Technische Universität München, Centre for Mathematical Sciences, Boltzmannstraße 3, 85748 Garching, Germany article info abstract Article history: Available online 18 June 2010 Keywords: Isogeometric Analysis MATLAB NURBS Exact geometry Tutorial code A tutorial 2D MATLAB code for solving elliptic diffusion-type problems, including Poisson’s equation on single patch geometries, is presented. The basic steps of Isogeometric Analysis are explained and two examples are given. The code has a very lean structure and has been kept as simple as possible, such that the analogy but also the differences to traditional finite element analysis become apparent. It is not intended for large-scale problems. © 2010 Elsevier B.V. All rights reserved. 1. Introduction Over the last years, the new field of Isogeometric Analysis (Hughes et al., 2005) has demonstrated its potential to bridge the gap between Computer Aided Design (CAD) and the Finite Element Method (FEM). The main feature of Isogeometric Analysis is the usage of one common geometry representation for creating CAD models, for meshing, and for numerical simulation. In this way, a seamless integration of all computational tools within a single design loop comes into reach. However, the numerical analysts are typically not familiar with the elegant and powerful algorithms of computational geometry, and on the other hand in the CAD community there is still little awareness of the specific requirements in numerical methods. In order to further broaden the common platform of Isogeometric Analysis, we present here a tutorial 2D MATLAB code for solving diffusion-type problems on single patch geometries. The basic steps are explained and two examples given. The code has a very lean structure and has been kept as simple as possible. It is not intended for large- scale problems but for serving as illustration and also for teaching. As basic reference for Isogeometric Analysis and the usage of Non-Uniform Rational B-Splines (NURBS) as basis functions in the FEM, we recommend the recent monograph (Cottrell et al., 2009). Standard references on splines and CAD are Farin (2002) and Piegl and Tiller (1997). Additionally, more advanced techniques like T-spline refinement are discussed in Dörfel et al. (2010) and Bazilevs et al. (2010). An analysis of specific quadrature rules can be found in Hughes et al. (2010) while swept volume techniques and a study of corresponding parameterizations are presented in Aigner et al. (2009). We finally also mention the work on isogeometric fluid-structure interaction (Bazilevs et al., 2008), stress calculation (Vuong and Simeon, submitted for publication) and electromagnetics (Buffa et al., 2010). The paper is organized as follows: Section 2 introduces the model problem of Poisson’s equation, which serves as basis for the whole paper. How the infinite-dimensional problem is discretized by means of the Galerkin projection can be found in Section 3. After having presented the necessary fundamentals of Isogeometric Analysis in Section 4, we show how the occurring integrals are transformed to the parametric domain in Section 5. The subsequent sections demonstrate algorithmic details based on pieces of code, beginning with the representation of the data in Section 6 and the assembly of the stiffness matrix and the right-hand side vector in Section 7. After the solution of the resulting linear equation system in Section 8, * Corresponding author. E-mail addresses: [email protected] (A.-V. Vuong), [email protected] (Ch. Heinrich), [email protected] (B. Simeon). 0167-8396/$ – see front matter © 2010 Elsevier B.V. All rights reserved. doi:10.1016/j.cagd.2010.06.006

ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

Embed Size (px)

Citation preview

Page 1: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

Computer Aided Geometric Design 27 (2010) 644–655

Contents lists available at ScienceDirect

Computer Aided Geometric Design

www.elsevier.com/locate/cagd

ISOGAT: A 2D tutorial MATLAB code for Isogeometric Analysis

A.-V. Vuong, Ch. Heinrich ∗, B. Simeon

Technische Universität München, Centre for Mathematical Sciences, Boltzmannstraße 3, 85748 Garching, Germany

a r t i c l e i n f o a b s t r a c t

Article history:Available online 18 June 2010

Keywords:Isogeometric AnalysisMATLABNURBSExact geometryTutorial code

A tutorial 2D MATLAB code for solving elliptic diffusion-type problems, including Poisson’sequation on single patch geometries, is presented. The basic steps of Isogeometric Analysisare explained and two examples are given. The code has a very lean structure and has beenkept as simple as possible, such that the analogy but also the differences to traditionalfinite element analysis become apparent. It is not intended for large-scale problems.

© 2010 Elsevier B.V. All rights reserved.

1. Introduction

Over the last years, the new field of Isogeometric Analysis (Hughes et al., 2005) has demonstrated its potential to bridgethe gap between Computer Aided Design (CAD) and the Finite Element Method (FEM). The main feature of IsogeometricAnalysis is the usage of one common geometry representation for creating CAD models, for meshing, and for numericalsimulation. In this way, a seamless integration of all computational tools within a single design loop comes into reach.

However, the numerical analysts are typically not familiar with the elegant and powerful algorithms of computationalgeometry, and on the other hand in the CAD community there is still little awareness of the specific requirements innumerical methods. In order to further broaden the common platform of Isogeometric Analysis, we present here a tutorial2D MATLAB code for solving diffusion-type problems on single patch geometries. The basic steps are explained and twoexamples given. The code has a very lean structure and has been kept as simple as possible. It is not intended for large-scale problems but for serving as illustration and also for teaching.

As basic reference for Isogeometric Analysis and the usage of Non-Uniform Rational B-Splines (NURBS) as basis functionsin the FEM, we recommend the recent monograph (Cottrell et al., 2009). Standard references on splines and CAD are Farin(2002) and Piegl and Tiller (1997). Additionally, more advanced techniques like T-spline refinement are discussed in Dörfelet al. (2010) and Bazilevs et al. (2010). An analysis of specific quadrature rules can be found in Hughes et al. (2010) whileswept volume techniques and a study of corresponding parameterizations are presented in Aigner et al. (2009). We finallyalso mention the work on isogeometric fluid-structure interaction (Bazilevs et al., 2008), stress calculation (Vuong andSimeon, submitted for publication) and electromagnetics (Buffa et al., 2010).

The paper is organized as follows: Section 2 introduces the model problem of Poisson’s equation, which serves as basisfor the whole paper. How the infinite-dimensional problem is discretized by means of the Galerkin projection can be foundin Section 3. After having presented the necessary fundamentals of Isogeometric Analysis in Section 4, we show how theoccurring integrals are transformed to the parametric domain in Section 5. The subsequent sections demonstrate algorithmicdetails based on pieces of code, beginning with the representation of the data in Section 6 and the assembly of the stiffnessmatrix and the right-hand side vector in Section 7. After the solution of the resulting linear equation system in Section 8,

* Corresponding author.E-mail addresses: [email protected] (A.-V. Vuong), [email protected] (Ch. Heinrich), [email protected] (B. Simeon).

0167-8396/$ – see front matter © 2010 Elsevier B.V. All rights reserved.doi:10.1016/j.cagd.2010.06.006

Page 2: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655 645

we present numerical results for an L-shape and a disk geometry in Section 9. Conclusions and an outlook are given inSection 10.

2. Model problem

Both the FEM and Isogeometric Analysis have the same theoretical foundation, namely the weak form of a partial dif-ferential equation (PDE). The basis of this tutorial and also of the MATLAB implementation is the elliptic partial differentialequation

−∇ · (K∇T ) = f in Ω (1)

where Ω ⊂ R2 is a Lipschitz domain with boundary ∂Ω , f :Ω → R is a given source term, and K ∈ R

2×2 a symmetricpositive definite matrix. The diffusion type problem (1) arises in a variety of applications such as the temperature equationin heat conduction, the pressure equation in flow problems, and also mesh smoothing algorithms. For K being the identitymatrix, (1) simplifies to Poisson’s equation

−�T = f in Ω. (2)

In the following, we restrict our discussion for simplicity to Poisson’s equation (2) with Dirichlet boundary condition

T = 0 on ∂Ω. (3)

The tutorial code, however, covers the more general formulation (1) and includes also a combination of zero Dirichlet andNeumann boundary conditions.

The weak form of the PDE (2) is obtained by multiplication with test functions V and integration over Ω . More specifi-cally, one defines the function space

V := {V ∈ H1(Ω), V = 0 on ∂Ω

}, (4)

which consists of all functions V ∈ L2(Ω) that possess weak and square-integrable first derivatives and that vanish on theboundary. For functions T , V ∈ H1(Ω), the bilinear form

a(T , V ) :=∫Ω

∇T · ∇V dx dy (5)

is well-defined, and even more, it is symmetric and coercive. Setting

〈l, V 〉 :=∫Ω

f V dx dy (6)

as linear form for the integration of the right-hand side, the weak formulation of the boundary value problem reads: FindT ∈ V, such that

a(T , V ) = 〈l, V 〉 for all V ∈ V. (7)

This problem formulation is now projected onto a finite-dimensional subspace of V.

3. Galerkin projection

The Galerkin projection replaces the infinite-dimensional space V by a finite-dimensional subspace Vh ⊂ V, with thesubscript h indicating the relation to a spatial grid. Then the discretized problem reads: Find Th ∈ Vh , such that

a(Th, Vh) = 〈l, Vh〉 for all Vh ∈ Vh. (8)

Let φ1, . . . , φn be a basis of Vh . The numerical approximation Th is constructed as linear combination

Th =n∑

i=1

qiφi (9)

with unknown real coefficients qi ∈ R.Upon inserting Th into the weak form (8) and testing with Vh = φi for i = 1, . . . ,n, one obtains the linear system

Aq = b (10)

with stiffness matrix A = (a(φi, φ j))i, j=1,...,n , right-hand side vector b = (〈l, φi〉)i=1,...,n and vector of unknowns q =(qi)i=1,...,n . Since the matrix A inherits the properties of the bilinear form a, it is straightforward to show that A is symmetricpositive definite, and thus the numerical solution q or Th , respectively, is well-defined.

Page 3: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

646 A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655

Fig. 1. Parameterization of Ω by a geometry function F . The parametric domain is denoted by Ω0.

4. Basics of Isogeometric Analysis

Suppose now that the physical domain Ω is parameterized by a global geometry function

F :Ω0 → Ω, F(u, v) =(

xy

), (11)

see Fig. 1. In Isogeometric Analysis we apply NURBS to define F.NURBS are piecewise rational functions of degree p that are connected in so-called knots ui . If a knot is not repeated,

then the spline has p − 1 continuous derivatives in this knot. This differs from the classical finite element spaces wheremostly C0 elements dominate. Let Ξ = (u0, . . . , ul) ∈ R

l+1 be the knot vector, consisting of nondecreasing real numbers. Weassume that the first and the last knots have multiplicity p +1, that means that their values are repeated p times. Thereforethe endpoints are interpolatory, which is important for representing the computational domain exactly.

The ith B-spline basis function of p-degree Ni,p is defined recursively as

Ni,0(u) ={

1 if ui � u < ui+1,

0 otherwise; (12)

Ni,p(u) = u − ui

ui+p − uiNi,p−1(u) + ui+p+1 − u

ui+p+1 − ui+1Ni+1,p−1(u). (13)

Note that the quotient 0/0 is assumed to be zero.In one dimension, an NURBS of degree p is given by

Ri,p(u) = wi Ni,p(u)∑j∈J w j N j,p(u)

(14)

with B-splines Ni,p , weights wi ∈ R and an index set J = {0, . . . , l − p − 1}.A knot with multiplicity p reduces the smoothness to C 0. More specifically, the multiplicity mi � 1 of a knot ui decreases

the smoothness of the spline to C p−mi in this knot. By specifying single or multiple knots, one may thus change thesmoothness.

Bivariate NURBS are constituted by (suppressing the degrees pu and pv )

Rk�(u, v) = wk�Nk(u)N�(v)∑i∈I

∑j∈J wij Ni(u)N j(v)

. (15)

Though this representation requires a knot vector for each parameter direction, Ξu = (u0, . . . , ul1 ) and Ξv = (v0, . . . , vl2 ), itdoes not exactly have a tensor product structure due to the weights wij , which can be altered separately. The index sets areI = {0, . . . , l1 − pu − 1} and J = {0, . . . l2 − pv − 1}. The continuity in each parameter direction is determined by the knotmultiplicities of the corresponding knot vectors. It should be noted that the weights do not have any influence on this, andtherefore the tensor-product-like structure results in isoparametric lines sharing the same continuity in the other parameterdirection.

Now the geometry function F can be defined for a single patch via

F(u, v) =∑i∈I

∑j∈J

Rij(u, v)ci j (16)

with bivariate NURBS Rij on the patch Ω0 = [0,1]2 and control points ci j ∈ R2.

In Isogeometric Analysis we use the same functions Rij as basis functions, cf. Hughes et al., 2005, and employing the“push forward” operator from Ω0 onto Ω , we get

Vh = {φk | φk = 0 on ∂Ω} ⊂ span{

Rij ◦ F−1} . (17)

i∈I, j∈J
Page 4: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655 647

Note that the boundary condition T = 0 has also to be taken into account, and for this reason we write Vh as a subsetof the span. Fig. 5 in Section 9 depicts the basis functions for the L-shape domain, which will be introduced below.

Accordingly, the numerical solution is given by

Th(x, y) =∑i∈I

∑j∈J

Rij(F−1(x, y)

)qij (18)

where some of the coefficients qij are determined from the boundary condition. Using a lexicographical numbering, theunknown coefficients are written as vector

q = (q0,0, . . . ,ql1−pu−1,0, . . . ,q0,l2−pv−1, . . . ,ql1−pu−1,l2−pv−1). (19)

The same numbering is used for the assembly of the stiffness matrix and the right-hand side vector in Eq. (10).

5. Transformation to the parametric domain

With the help of F integrals over Ω can be transformed into integrals over Ω0 by means of the well-known integrationrule ∫

Ω

f (x, y)dx dy =∫Ω0

f(F(u, v)

)∣∣det DF(u, v)∣∣ du dv (20)

with 2 × 2 Jacobian matrix

DF(u, v) =(

∂ F1/∂u ∂ F1/∂v∂ F2/∂u ∂ F2/∂v

). (21)

For the differentiation, the chain rule applied to T (x, y) = T (F(u, v)) yields

∇(x,y)T (x, y) = DF(u, v)−T · ∇(u,v)T (u, v). (22)

Summarizing, the integrals in the weak form (7) satisfy the transformation rules∫Ω

∇T · ∇V dx dy =∫Ω0

(DF(u, v)−T ∇T

) · (DF(u, v)−T ∇V)∣∣det DF(u, v)

∣∣ du dv (23)

and ∫Ω

f V dx dy =∫Ω0

( f V )(F(u, v)

)∣∣det DF(u, v)∣∣ du dv. (24)

Eq. (23) can be split up into∫Ω

∇T · ∇V dx dy =∑

k

∫Q k

(DF(u, v)−T ∇T

) · (DF(u, v)−T ∇V)∣∣det DF(u, v)

∣∣ du dv

=∑

k

vk2∫

vk1

uk2∫

uk1

(DF(u, v)−T ∇T

) · (DF(u, v)−T ∇V)∣∣det DF(u, v)

∣∣ du dv (25)

and Eq. (24) into∫Ω

f V dx dy =∑

k

∫Q k

( f V )(F(u, v)

)∣∣det DF(u, v)∣∣ du dv

=∑

k

vk2∫

vk1

uk2∫

uk1

( f V )(F(u, v)

)∣∣det DF(u, v)∣∣ du dv, (26)

where Q k = [uk1, uk

2] × [vk1, vk

2] represents a quadrilateral in the parametric domain (cf. Fig. 1).We remark that the Jacobian DF may become singular for certain parameterizations. Numerical experience shows that

such singularities do not seem to affect the overall solution, see Section 9.2.

Page 5: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

648 A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655

Fig. 2. Initial geometry description of the L-shape: control point grid (left), computational domain with image of the knot lines (right).

6. Data representation and refinement

After having explained the main ingredients of Isogeometric Analysis, we start now with the discussion of the tutorialMatlab implementation. The main object in Isogeometric Analysis is the two-dimensional parameterization of the computa-tional domain Ω . As already discussed in the previous sections the parameterization is a spline function and can thereforebe represented with the aid of NURBS as given in Eq. (16). An appropriate data structure consists of two spline functionswith individual degrees pU, pV and corresponding knot vectors. The control points are stored in an ((l1 − pu) · (l2 − pv )× 2)

matrix, where the ordering runs first along the u parameter direction and second along the v parameter direction, thesame way as already described in Section 4 for the solution vector (Eq. (19)). The following MATLAB statements define thegeometry of the L-shape domain in Fig. 2:

pU= 2;pV= 2;knotVectorU= [0 0 0 0.5 0.5 1 1 1];knotVectorV= [0 0 0 1 1 1];weights= [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]’;controlPoints= [ -1 1; -1 0; -1 -1; 0 -1; 1 -1; -0.6 1; -0.55 0;

-0.5 -0.5; 0 -0.55; 1 -0.6; 0 1; 0 0.5; 0 0; 0.5 0; 1 0];

The first knot vector contains a double knot, which leads to a C0 connection. Due to the choosen degrees and knot vectors,we have 15 basis functions and consequently the same number of control points and weights.

This data is sufficient to create an instance of a MATLAB class with the call

G= isogat(pU,pV,knotVectorU,knotVectorV,controlPoints,weights);

Now the class routines can be called either directly from the command prompt or from an additionally supplied graphicaluser interface (GUI) (command G.menu).

Refinement is performed by using the knot refinement procedures and is restricted to global h-refinement. In the middleof each nonempty knot span a knot is inserted and the new control points and weights are calculated. For example, thecommand G2= G.refine() creates a refined object.

The main routines of the code dealing with splines are based on the algorithms described in Piegl and Tiller (1997).

7. Assembling the stiffness matrix and the right-hand side vector

The assembly of the stiffness matrix is the core part of the whole code. It consists mainly of three loops that correspondto Eq. (25): one over the (nonempty) knot intervals (for this purpose the variables uKnotVectorU and uKnotVectorVare used that do not contain the multiplicity of the knot vectors), one loop over the first basis functions and the last loopover the second basis functions with nonzero support within the current knot interval. Due to the tensor product structureeach of these main loops separates into two minor loops for each dimension. In these six loops the global index of thecurrent degree of freedom is calculated.

for intU = 1:size(uKnotVectorU,2)-1for intV=1:size(uKnotVectorV,2)-1quadarg={uKnotVectorU(intU),uKnotVectorU(intU+1),...

uKnotVectorV(intV),uKnotVectorV(intV+1)};

Page 6: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655 649

for i1=1:1+obj.pUfor j1=1:1+obj.pVfor i2 = 1:1+obj.pUfor j2 = 1:1+obj.pVindexU=uSpanU(intU)-obj.pU;indexV=uSpanV(intV)-obj.pV;row(index) = indexU+i1 + (indexV+j1-1)*obj.nobU;col(index)= indexU+i2 + (indexV+j2-1)*obj.nobU;indexarg={indexU,indexV,i1,j1,i2,j2};entry(index)= dgquad(@(x,y)quad_a(obj,x,y,indexarg{:}),quadarg{:},5);index=index+1;

endend

endendend

endA=sparse(row,col,entry,obj.nobU*obj.nobV,obj.nobU*obj.nobV,index);

Furthermore to evaluate the integral in Eq. (25) the Gaussian quadrature routine dgquad is called, which employs auser-defined number of quadrature points. There are several different expressions within this term. The gradients are onlycalculated from the B-spline basis functions, whereas the transformation matrices (DF)−T and the determinant |det DF(u, v)|are based on the geometry function.

After the gradients gradR1 and gradR2 with respect to the parameter directions have been obtained and the JacobianDF has been calculated, the last line of the following piece of code just evaluates the integrand in Eq. (25).

gradR1 = [DRU(basis1U,basis1V); DRV(basis1U,basis1V)];gradR2 = [DRU(basis2U,basis2V); DRV(basis2U,basis2V)];DF = zeros(2,2);for iU = 1:obj.pU+1for iV = 1:obj.pV+1CP = obj.controlPoints(indexU+iU + obj.nobU*(indexV+iV -1),:)’;DF(:,1) = DF(:,1) + DRU(iU,iV) * CP;DF(:,2) = DF(:,2) + DRV(iU,iV) * CP;end

enderg(i)= ((DF’)\gradR2)’*((DF’)\gradR1)*abs(det(DF));

The right-hand side is assembled analogously, with the only difference that the loops over the knot intervals and the basisfunctions, cf. Eq. (26), have to be taken into account.

The assembly of the stiffness matrix requires no preprocessing of geometry data and works directly with the knot vectors.As alternative, one could also extract a mesh structure with global numbering of the unknowns in the very beginning.Moreover, the quadrature evaluation can be accelerated by using MATLAB’s vectorization features. See Koko (2007) for adiscussion of this topic for traditional FEM.

After the stiffness matrix and the right-hand side have been assembled, the boundary conditions still need to be enforced.For enforcing zero Dirichlet boundary conditions, non-diagonal entries in the row and column of the corresponding degreeof freedom are eliminated and the entry on the right-hand side is nullified.

8. Solving the linear equation and plotting the solution

The resulting system of linear equations is solved by the built-in MATLAB backslash operator. The following piece of codesummarizes the whole solution process for the instance G.

[A,b]=G.assemble;[A,b]=G.bc(A,b);x=A\b;G.plotField(x);

Finally, for applying the plot facilities of MATLAB, the numerical approximation needs to be reconstructed from thecoefficients.

Page 7: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

650 A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655

Fig. 3. Refined L-shape: control point grid (left), computational domain with image of the knot lines (right).

[sU,sV,C] = getPlotMatrix(obj,resol);SU = zeros(sU,sV);SV = zeros(sU,sV);SOL= zeros(sU,sV);for iU=1:obj.nobUfor iV= 1:obj.nobV

tmp = C{iU,iV};index = iU+obj.nobU*(iV-1);SU = SU + tmp * obj.controlPoints(index,1);SV = SV + tmp * obj.controlPoints(index,2);SOL = SOL + tmp * x(index);

endendfigure;mesh(SU,SV,SOL)

The complete code, along with the demo examples below, is available for download from our web page.1 As introducedin Section 2, it also covers diffusion-type equations (1) with a 2 × 2 coefficient matrix K . Moreover, combinations of zeroDirichlet and Neumann boundary conditions are admitted.

9. Examples

In this section we study two examples, an L-shape domain with two different parameterizations and a disk. For bothexamples, analytic reference solutions are available and help to assess the numerical results.

9.1. L-shape

The first geometry, the L-shape, is parameterized according to the data given in Section 6. The grid of control points andthe physical domain including the image of the knot lines are plotted in Fig. 2.

Fig. 3 shows the same geometry after three refinement steps. Note that the image of the knot lines represents thecomputational mesh for the discretization of Ω . As already mentioned in Section 4, the basis functions on the L-shape areplotted in Fig. 5.

On this domain we solve

−�T = 2π2 sin(πx) sin(π y) (27)

with zero Dirichlet boundary conditions and analytical solution

T (x, y) = sin(πx) sin(π y). (28)

Fig. 4 shows the numerical approximation and the distribution of the absolute error. Such an error plot, however,comprises solely little information on the convergence of the method. In order to study the convergence and the qual-ity of different parameterizations, we introduce an alternative geometry map via

1 http://www-m2.ma.tum.de/bin/view/Allgemeines/EXCITING.

Page 8: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655 651

Fig. 4. Numerical solution for 66 degrees of freedom (left), absolute error (right).

pU= 2;pV= 2;knotVectorU= [0 0 0 0.5 1 1 1];knotVectorV= [0 0 0 1 1 1];weights= [1,1,1,1,1,1,1,1,1,1,1,1]’;controlPoints = [ -1 1; -1 -1; -1 -1; 1 -1; -0.65 1; -0.7 0;

0 -0.7; 1 -0.65; 0 1; 0 0; 0 0; 1 0];

This parameterization is globally C 1-continuous, in contrast to the first one, which has a C 0-edge in the interior of thedomain. The corresponding control point grid and the physical domain including the image of the knot lines are plotted inFig. 6.

In order to compare the two parameterizations, we first calculate the energy norm

‖Th‖E =√

qT Aq (29)

of the numerical approximation. The norm ‖Th‖E is plotted in Fig. 7 on the left. As can be seen, by refining the gridsboth numerical solutions tend to the same maximum value. This confirms the theoretical result that ‖Th‖E → ‖T ‖E frombelow for any convergent Galerkin projection method. The convergence speed may serve as an indicator of the convergencebehavior of the method.

As discussed in Bazilevs et al. (2006), the convergence estimates feature a factor ‖DF−1‖ on the right-hand side, andthus it is clear that the geometry function (parameterization) has an influence on the accuracy.

In Fig. 7 on the left one can observe that the first parameterization behaves better especially in case of coarse mesheswith few degrees of freedom. This is also approved by Fig. 7 on the right, where we have plotted the L2 error norm‖T − Th‖L2 of both parameterizations for several refinement steps.

Further results on the influence of the parameterization can be found in Cohen et al. (2010) and Lipton et al. (2010).

9.2. Disk

The disk geometry belongs to the class of conic intersections that can only be described by rational splines and not bypolynomial splines. We use the following parameterization with quadratic NURBS:

pU= 2;pV= 2;knotVectorU= [0 0 0 1 1 1];knotVectorV= [0 0 0 1 1 1];weights=[ 1 sqrt(2)/2 1 sqrt(2)/2 1 sqrt(2)/2 1 sqrt(2)/2 1]’;controlPoints=[ -sqrt(2)/4 sqrt(2)/4; -sqrt(2)/2 0; -sqrt(2)/4 -sqrt(2)/4;

0 sqrt(2)/2; 0 0; 0 -sqrt(2)/2;sqrt(2)/4 sqrt(2)/4; sqrt(2)/2 0; sqrt(2)/4 -sqrt(2)/4];

The initial geometry and the corresponding coarse mesh are shown in Fig. 8, while Fig. 9 depicts a refined version.

Page 9: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

652 A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655

Fig. 5. Basis functions of the initial description on the L-shape domain for the first parameterization.

In order to test our implementation, we solve

−�T = sin(10 ·

√x2 + y2

)(30)

with zero Dirichlet boundary condition and analytical solution

T (x, y) = − 1

100

10·√

x2+y2∫sin(t)

tdt + 1

100sin

(10 ·

√x2 + y2

) + 1

100

5∫sin(t)

tdt − 1

100sin(5). (31)

0 0

Page 10: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655 653

Fig. 6. Initial geometry description of the L-shape: control point grid (left), computational domain with image of the knot lines (right) for the secondparameterization.

Fig. 7. Comparison of the energy norm ‖Th‖E (left) and the L2 error norm ‖T − Th‖L2 (right) between the two parameterizations of the L-shape domain.

Fig. 8. Initial geometry description of the disk: control point grid (left), computational domain with image of the knot lines (right).

The numerical result and the absolute error are shown in Fig. 10. We stress that, once again, different parameterizationsof the geometry are possible and these may also result in a different numerical behavior. Another aspect are the foursingularities of the Jacobian DF that arise for this particular geometry function. The singularities lie on the circle line andare marked by black dots in Fig. 8 on the right. In our numerical experiments, the quadrature for evaluating Eq. (25)remained stable and did not suffer from the singularities, even in close proximity. A conclusive explanation for this stablebehavior, however, is subject of ongoing research, see also Aigner et al. (2009).

10. Conclusions

In this contribution we have outlined the basic steps of Isogeometric Analysis, especially the usage of a common ge-ometry representation for CAD and numerical analysis. Key parts of the method have been illustrated using a tutorial 2DMATLAB code, which has a very lean structure, is interactive and straightforward to use, and which helps to understand

Page 11: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

654 A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655

Fig. 9. Refined disk: control point grid (left), computational domain with image of the knot lines (right).

Fig. 10. Numerical solution for 100 degrees of freedom (left), absolute error (right).

the algorithm in detail. We stress that the code is not intended for more complex problems where a more advanced designand more sophisticated techniques are favorable. Further features such as more involved boundary conditions or specificquadrature rules have also been omitted for the sake of simplicity. The numerical comparison of different isogeometric dis-cretizations reveals that the choice of the geometry map may have influence on the quality of the results. This is a topicthat definitely deserves further attention in the future.

Acknowledgements

The authors thank Bert Jüttler and his coworkers for many fruitful discussions. Furthermore, the support by the 7thFramework Programme of the European Union, project SCP8-218536 “EXCITING”, is gratefully acknowledged.

References

Aigner, M., Heinrich, C., Jüttler, B., Pilgerstorfer, E., Simeon, B., Vuong, A.-V., 2009. Swept volume parametrization for isogeometric analysis. In: Hancock, E.,Martin, R. (Eds.), The Mathematics of Surfaces. MoS XIII, 2009. Springer.

Bazilevs, Y., Calo, V.M., Cottrell, J.A., Evans, J., Hughes, T.J.R., Lipton, S., Scott, M.A., Sederberg, T.W., 2010. Isogeometric analysis using T-splines. ComputerMethods in Applied Mechanics and Engineering 199, 229–263.

Bazilevs, Y., Calo, V.M., Hughes, T.J.R., Zhang, Y., 2008. Isogeometric fluid-structure interaction: Theory, algorithms, and computations. Computational Me-chanics 43, 3–37.

Bazilevs, Y., da Veiga, L.B., Cottrell, J., Hughes, T., Sangalli, G., 2006. Isogeometric Analysis: Approximation, stability and error estimates for h-refined meshes.Mathematical Models and Methods in Applied Sciences 16 (7), 1031–1090.

Buffa, A., Sangalli, G., Vázquez, R., 2010. Isogeometric analysis in electromagnetics: B-splines approximation. Computer Methods in Applied Mechanics andEngineering 199, 1143–1152.

Page 12: ISOGAT a 2D Tutorial MATLAB Code for Isogeometric Analysis

A.-V. Vuong et al. / Computer Aided Geometric Design 27 (2010) 644–655 655

Cohen, E., Martin, T., Kirby, R.M., Lyche, T., Riesenfeld, R.F., 2010. Analysis-aware modeling: Understanding quality considerations in modeling for isogeo-metric analysis. Computer Methods in Applied Mechanics and Engineering 199, 334–356.

Cottrell, J.A., Hughes, T.J.R., Bazilevs, Y., 2009. Isogeometric Analysis: Toward Integration of CAD and FEA. John Wiley & Sons.Dörfel, M.R., Jüttler, B., Simeon, B., 2010. Adaptive isogeometric analysis by local h-refinement with T-splines. Computer Methods in Applied Mechanics and

Engineering 199, 264–275.Farin, G., 2002. Curves and Surfaces for CAGD: A Practical Guide, 5th ed. Morgan Kaufmann.Hughes, T.J.R., Cottrell, J.A., Bazilevs, Y., 2005. Isogeometric analysis: CAD, finite elements, NURBS, exact geometry and mesh refinement. Computer Methods

in Applied Mechanics and Engineering 194, 4135–4195.Hughes, T.J.R., Reali, A., Sangalli, G., 2010. Efficient quadrature for NURBS-based isogeometric analysis. Computer Methods in Applied Mechanics and Engi-

neering 199, 301–313.Koko, J., 2007. Vectorized matlab codes for linear two-dimensional elasticity. Scientific Programming 15, 157–172.Lipton, S., Evans, J.A., Bazilevs, Y., Elguedj, T., Hughes, T.J.R., 2010. Robustness of isogeometric structural discretizations under severe mesh distortion.

Computer Methods in Applied Mechanics and Engineering 199, 357–373.Piegl, L., Tiller, W., 1997. The NURBS Book. Monographs in Visual Communication, 2nd ed. Springer, New York.Vuong, A.-V., Simeon, B., submitted for publication. On isogeometric analysis and its usage for stress calculation.