HP-discontinuous galerkin method for nonlinear problems
Abstract
an adaptive wavelet-based method for a spatial discretization. We use a well-conditioned cubic
Full text
hp-DISCONTINUOUS GALERKIN METHOD FOR NONLINEAR PROBLEMS V´ ıt Dolejˇ s´ ı Charles University Prague Faculty of Mathematics and Physics Department of Numerical Mathematics Sokolovsk´ a 83, 186 75 Praha, Czech Republic [email protected]f.cuni.cz Abstract We deal with a numerical solution of nonlinear convection-diffusion problems with the aid of the discontinuous Galerkin finite element (DGFE) method. We propose a new hp-adaptation technique, which is based on a combination of a residuum-nonconformity estimator and a regularity indicator. The residuum-nonconformity estimator consists of two building blocks (the residuum error indicator and the value of the nonconformity). The estimator marks mesh elements for a refinement. The regularity indicator decides if the marked elements will be refined by h- or p-technique. The residuum-nonconformity estimator as well as the regularity indicator are easily computable quantities. Moreover, the same technique estimates an algebraic error arising from an iterative solution of the corresponding nonlinear algebraic system. The performance of the proposed hp-DGFE method is demonstrated by several numerical examples. Keywords: hp-discontinuous Galerkin finite element method; residuum-nonconformity indicator; regularity estimator; algebraic error. Introduction Our aim is to develop a sufficiently robust, efficient and accurate numerical scheme for the simulation of viscous compressible flows. The discontinuous Galerkin finite element (DGFE) methods have become very popular numerical techniques for the solution of the compressible Navier-Stokes equations. Recent progress of the use of the DG method for compressible flow simulations can be found in [11]. In this paper, we deal with a model problem represented by a scalar nonlinear convectiondiffusion equation. We focus on a hp-adaptation strategy of DGFE methods which significantly increase the accuracy and efficiency of the computation, see, e.g. [2, 6, 8, 12, 13]. The proposed strategy is based on a combination of a residuum-nonconformity estimator and a regularity indicator. The residuum-nonconformity estimator gives a lower estimate of the error measure consisting of the error measured in a dual norm and the quantity measuring a violation of the conformity of the solution. This estimator is locally defined for each mesh element, it is easily computable and its implementation is very simple. The regularity indicator is based on the integration of interelement jumps of the approximate solution over the element boundary. Taking into account results from a priori error analysis, we define the regularity indicator. If this value is smaller than one then we apply a p-refinement otherwise we use ah-refinement. Both refinements (hand p) are only isotropic, an anisotropic adaptation will be a subject of the further research. 56
1 Problem Formulation 1.1 Governing Equations We consider a formal nonlinear partial differential equation Lu =0 in Ω,(1a) u=uDon ∂ ΩD,(1b) Nu =gNon ∂ ΩN,(1c) where u:Ω→Ris the unknown scalar function defined on Ω∈Rd,d=2,3, Lis a formal second order differential operator and (1b) and (1c) formally represent the Dirichlet and Neumann boundary conditions on the parts of boundary ∂ ΩDand ∂ ΩN, respectively. We assume that there exits a unique weak solution of (1) which we denote again by u. Let Th(h>0) be a partition of the closure Ωof the domain Ωinto a finite number of closed d-dimensional simplicies Kwith mutually disjoint interiors. We call Th={K}K∈Thatriangulation of Ωand do not require the conforming properties from the finite element method. Over the triangulation Thwe define the so-called broken Sobolev space Hs(Ω,Th):={v;v|K∈Hs(K)∀K∈Th},s≥0 (2) with the seminorm |v|Hs(Ω,Th):=∑K∈Th|v|2 Hs(K)1/2,where |·|Hs(K)denotes the seminorm of the Sobolev space Hs(K),K∈Th. Moreover, to each K∈Th, we assign a positive integer pK(=local polynomial degree). Then we define the set ph:={pK,K∈Th}.(3) We define the finite dimensional subspace of H1(Ω,Th)which consists of discontinuous piecewise polynomial functions associated with the vector phby Shp={v;v∈L2(Ω),v|K∈PpK(K)∀K∈Th},(4) where PpK(K)denotes the space of all polynomials on Kof degree ≤pK,K∈Th. We introduce a formal discretization of (1) with the aid of DGFE method. Hence, let ˜ch(u,v):H2(Ω,Th)×H2(Ω,Th)→R(5) be the corresponding form which is nonlinear with respect to its first argument and linear with respect to the second one. We say that the function uh∈Shpis an approximate solution of (1), if ˜ch(uh,vh) = 0∀vh∈Shp.(6) Moreover, we define the form Nh:H1(Ω,Th)→Rby Nh(v):= 2∑ Γ∈FI hZΓh−1 Γ[[v]]2dS+∑ Γ∈FD hZΓh−1 Γ(v−uD)2dS 1/2 ,(7) where uDis from (1b), FI hdenotes the set of all interior faces of Th,FD hdenotes the set of all faces of Thlying on ∂ ΩD,[[·]] is the jump of a function from H1(Ω,Th)and hΓis the diameter of a face Γ. Finally, we characterise the weak solution of (1). 57
Lemma 1.1 The following implications are valid: i) Let u ∈H2(Ω)be the weak solution of (1) then ˜ch(u,v) = 0∀v∈H2(Ω,Th),(8a) Nh(u) = 0.(8b) ii) If u ∈H2(Ω,Th)satisfies both conditions of (8) then u is the weak solution of (1). The discrete problem (6) represents a system of Nh=dimShpnonlinear algebraic equations. We solve it with the aid of a Newton-like iterative method which gives the solution ˜uh∈Shp such that ˜ch(˜uh,vh)≈0∀vh∈Shp. 2 Residuum Estimator In this section we investigate the discretization error u−uhand the algebraic error ˜uh−uhin a suitable (dual) norm and define estimators giving some information about these errors. 2.1 Error Measure Similarly as in [3], our proposed error measure consists of two building blocks, which are motivated by Lemma 1.1, namely relations (8a) and (8b). Let X:=H2(Ω,Th)and k·kXis a norm defined on X, which will be specified later. The first building block is given by Rh(uh):=sup 06=v∈X ˜ch(uh,v) kvkX(9) which defines the residuum error in the dual norm of the approximate solution uh∈Shp⊂X and it measures a violation of (8a). However, it is impossible to evaluate Rh(uh), since the supremum is taken over an infinite-dimensional space. Therefore, in our approach, we seek the maximum over some sufficiently large but finite dimension subspace of X, which is presented in Section 2.2. The second building block is based on (8b), which characterises a violation of the conformity of the weak solution and a violation of the Dirichlet boundary condition. It is represented by the value Nh(uh)≥0 given by (7) which we call the nonconformity of the approximate solution. In contrast to Rh(uh)the quantity Nh(uh)is directly computable from (7). Finally, our error measure is the sum of squares of the residuum error and nonconformity, i.e., Eh(uh):= (Rh(uh)2+Nh(uh)2)1/2.(10) Due to Lemma 1.1 we simply observe that Eh(uh) = 0 if and only if uh=u. 2.2 Global and Element Residuum Estimators In the previous section, we introduced the error measure Eh(uh) = pRh(uh)2+Nh(uh)2of the approximate solution uh∈Shp⊂X. Whereas Nh(uh)is easy to evaluate, the quantity Rh(uh) has to be approximated in a suitable way, which is presented in this section. For each K∈Th and each integer p≥0, we define the spaces Sp K:={ φ h∈X, φ h|K∈Pp(K), φ h|Ω\K=0}(11) 58
and S+ hp:={ φ ∈X; φ =∑ K∈Th cK φ K,cK∈R, φ K∈SpK+1 K,K∈Th}.(12) Obviously, Shp⊂S+ hp⊂X. Now, we define the element residuum estimator ρ h,K(uh):=sup 06= ψ h∈SpK+1 K ˜ch(uh, ψ h) k ψ hkX=sup ψ h∈SpK+1 K,k ψ hkX=1 ˜ch(uh, ψ h),uh∈X,(13) for each K∈Thand the global residuum estimator ρ h(uh):=sup 06= ψ h∈S+ hp ˜ch(uh, ψ h) k ψ hkX=sup ψ h∈S+ hp,k ψ hkX=1˜ch(uh, ψ h),uh∈X,(14) which are easily computable quantities if k·kXis suitably chosen, see Section 2.4. Obviously, if u∈Xis the exact solution of (1) then consistency (8a) implies 0 = ρ h(u) = ρ h,K(u),K∈Th. Moreover, we have immediately a lower bound ρ h(uh)≤Rh(uh),(15) since ρ his the supremum over subspace S+ hp⊂X. However, it is open if there exists an upper bound, i.e., Rh(uh)≤C ρ h(uh), where C>0. This will be the subject of a further research. 2.3 Algebraic Residuum Estimators Similarly as in the previous section, we define the estimator corresponding to the algebraic error residuum. Let ˜uh∈Shpbe the output of the iterative process used for the solution of (6). We define the algebraic residuum estimator ρ A h(˜uh):=sup 06= ψ h∈Shp ˜ch(˜uh, ψ h) k ψ hkX=sup ψ h∈Shp,k ψ hkX=1˜ch(uh, ψ h),(16) which measures the algebraic error (the difference between ˜uhand uh), since ρ A h(uh) = 0 due to (6). The relations (14) and (16) give ρ A h(˜uh)≤ ρ h(˜uh), since in (14) the supremum is taken over the larger space. We stop the iterative process for the solution of the nonlinear algebraic problem (6) if ρ A h(˜uh)≤ βρ h(˜uh),(17) where β ∈(0,1). In numerical experiments we put β ≈0.01. 2.4 Choice of the Norm k·kX In order to ensure a fast evaluation of estimators ρ hand ρ A h, we need to choose the norm k·kX in a suitable way. We employ k·kX:= δ k·k2 L2(Ω)+ ε |·|2 H1(Ω,Th)1/2,(18) which guarantees that ρ h(uh)2=∑ K∈Th ρ h,K(uh)2.(19) Here δ and ε denote the size of “convection” and “diffusion”, respectively. Therefore, it is sufficient to evaluate the element residuum estimators ρ h,K,K∈Th. This is a standard task of seeking a constrain extrema over SpK+1 Kwith the constraint k ψ hkX=1. This can be done directly very fast since the dimension of SpK+1 K,K∈This small. 59
2.5 Residuum-Nonconformity Estimators We have already mentioned that the second building block of the error measure is given by the nonconformity Nh(uh)defined by (7). For the purpose of a mesh adaptation, we define its local variant Nh,K(v):= ∑ Γ∈FI h∩ ∂ KZΓh−1 Γ[[v]]2dS+∑ Γ∈FD h∩ ∂ KZΓh−1 Γ(v−uD)2dS 1/2 ,v∈H1(Ω,Th). (20) Obviously, from (7) and (20), we have Nh(v)2=∑K∈ThNh,K(v)2.Finally, we define the local and global residuum-nonconformity estimators of the approximate solution uh∈Shpby η h,K(uh):= ρ h,K(uh)2+Nh,K(uh)21/2,K∈Th,(21a) and η h(uh):= ρ h(uh)2+Nh(uh)21/2= ∑ K∈Th η h,K(uh)2!1/2 ,(21b) respectively. In virtue of (10), (15) and (21), we expect that the global residuum-nonconformity estimator η h(uh)approximates the error measure Eh(uh). In the following we introduce an adaptation technique which produces a hp-mesh and the corresponding approximate solution such that the estimator η h(uh)is under a given tolerance. 3hp-Adaptation Process In this section, we present a new hp-adaptive DG technique for the solution of (6). In Section 2, we defined the element and global residuum-nonconformity estimators η h,Kand η h, respectively. We employ the norm k·kXgiven by (18) which guarantees that equality (19) is valid. As already mentioned, our interest is to find the solution ˜uh∈Shpsuch that η h(˜uh)≤ ω ,(22) where ω >0 is a given tolerance. Let Thbe a given mesh and ˜uhthe corresponding approximation of (6). We require that η h,K(˜uh)≤ ω √#Th∀K∈Th,(23) where #Thdenotes the number of elements of Th. Obviously, if (23) is satisfied then, due to (21b), condition (22) is valid and the adaptation process stops. Otherwise, we mark for refinement all K∈Thviolating (23). Furthermore, all marked elements will be refined either by h- or by p-adaptation, namely, either we split a given mother element Kinto four daughter elements or we increase the degree of polynomial approximation for a given element. Thus the new mesh Tˆ hand new set {ˆpK,K∈ Tˆ h}are created. We interpolate the old solution on a new mesh and perform the next adaptation step till (22) is valid. 3.1 Regularity Indicator The estimation of the regularity of the solution is an essential key of any hp-adaptation strategy. Our approach is based on a measure of inter-element jumps which is the base of the jump indicator from [5] and the shock capturing technique from [7]. 60
We propose the regularity indicator gK(uh):=R ∂ K∩Ω[[uh]]2dS |K|h2pK−2 K ,K∈Th,(24) where |K|is the area of K∈Th. If the exact solution is sufficiently regular, i.e., sK≥pK+1, then gK(uh)≈Oh2pK+1 K/h2 Kh2pK−2 K=O(h1 K).On the other hand, if the exact solution is not sufficiently regular, i.e., sK<pK+1 (⇔sK≤pK), then gK(uh)≈Oh2sK−1 K/h2 Kh2pK−2 K= O(h2 δ −1 K),where δ =sK−pk≤0. Then we use the following strategy gK(uh)≤1⇒solution is regular ⇒p-refinement, gK(uh)>1⇒solution is irregular ⇒h-refinement,K∈Th.(25) 4 Numerical Experiments In the previous sections, we introduced and developed the adaptive hp-DGFE method. We demonstrate its performance in this section by several numerical examples. Let ˜uhbe the approximate solution resulting from an iterative method, i.e., the solution influenced by the algebraic error. We deal with two following numerical examples: (E1) nonlinear convection-diffusion equation with a corner singularity from [9], (E2) linear convection-diffusion equation with the strong interior layer and the exponential boundary layer from [10]. For the first one, we know the exact solution and therefore we are able to evaluate the computational error. We carried out a hp-adaptive algorithm starting on a mesh with the step h0and P1polynomial approximation. We evaluate ku−˜uhkX,Nh(˜uh)and ρ h(˜uh)with the corresponding experimental orders of convergence (EOC) with respect to the number of degree of freedom Nhdefined by EOC =logehl+1−logehl log(1/pNhl+1)−log(1/pNhl),l=1,2,..., (26) Moreover, we evaluate the “effectivity index” ieff := η h(˜uh) ku−˜uhkX2+Nh(˜uh)21/2= ρ h(˜uh)2+Nh(˜uh)21/2 ku−˜uhkX2+Nh(˜uh)21/2.(27) Let us note that the index ieff is not a standard effectivity index since ρ h(˜uh)is the approximation of Rh(˜uh)and not of ku−˜uhkX. Obviously, if Nh(˜uh)dominate ρ h(˜uh)and ku−˜uhkXthen the index ieff is close to one. In this case it would be also interesting to evaluate the ratio ρ h(˜uh)/ku−˜uhkX. 4.1 (E1): Nonlinear Convection-Diffusion Equation with a Corner Singularity We consider the scalar nonlinear convection-diffusion equation −∇·(K(u)∇u)− ∂ u2 ∂ x1− ∂ u2 ∂ x2=gin Ω:= (0,1)2,(28) 61
.00 .25 .50 .75 1.00 .00 .25 .50 .75 1.00 .00 .01 .03 .04 .05 .00 .01 .03 .04 .05 P 0 P 0 P 1 P 1 P 2 P 2 P 3 P 3 P 4 P 4 P 5 P 5 hp Source: Own Fig. 1.Example (E1) given by (28) –(30) with α =−3/2: the final grid with the corresponding degrees of polynomial approximation, the whole domain (left) and its detail (0,1/20)×(0,1/20)(right) where K(u)is the nonsymmetric matrix given by K(u) = ε 2+arctan(u) (2−arctan(u))/4 0(4+arctan(u))/2.(29) The parameter ε >0 plays a role of an amount of diffusivity and we put ε =10−3. We prescribe a Dirichlet boundary condition on ∂ Ωand set the source term gsuch that the exact solution is u(x1,x2) = (x2 1+x2 2) α /2x1x2(1−x1)(1−x2), α ∈R.(30) We present two choices: α =4 and α =−3/2. It is possible to show (see [1]) that u∈ H κ (Ω), κ ∈(0,3+ α ), where H κ (Ω)denotes the Sobolev-Slobodetskii space of functions with “non-integer derivatives”. Whereas the choice α =4 gives sufficiently regular solution, the choice α =−3/2 leads to the solution with a singularity at x1=x2=0. Numerical examples presented in [4], carried out for a little different problem, show that this singularity avoids to achieve an order of convergence better than O(h3/2)in the L2-norm and O(h1/2)in the H1-seminorm for any degree of polynomial approximation. Nevertheless, the exact solution is regular outside of the singularity. Table 1 shows the results for problem (28) – (30) with α =4 and α =−3/2, namely the values of the error ku−˜uhkX, nonconformity Nh(˜uh), residuum error estimate ρ h(˜uh)with the corresponding EOC, index ieff and the computational times in seconds. We observe that the computational error ku−˜uhkXconverge exponentially for α =4 and significantly faster than O(h1/2)for α =−3/2. Furthermore, the index ieff is very close to one for increasing Nhwhich supports the accuracy of the method. A small increase of ieff in Table 1 for α =4 for the last adaptation level is caused by the fact that we are close to the machine accuracy. Furthermore, Figure 1 shows the final hp-grid obtained with the aid of the hp-DGFE algorithm for α =−3/2. (The case α =4 is not interesting since only p-refinement is carried out due to the regularity of the exact solution.) We observe that the h-adaptation was carried out in a small region near the singularity. On the other hand, the p-adaptation appears in regions where the solution is regular. 62
Tab. 1.Example (E1) given by (28) –(30): error ku−˜uhkX, nonconformity Nh(˜uh), residuum error estimate ρ h(˜uh)with the corresponding EOC, index ieff and the computational time in seconds α =4: lev #ThNhku−˜uhkXEOC Nh(˜uh)EOC ρ h(˜uh)EOC ieff CPU(s) 0 128 384 6.45E-03 – 1.99E-02 – 5.58E-03 – 0.99 0.4 1 128 705 4.56E-04 8.72 3.07E-03 6.15 6.60E-04 7.03 1.01 0.7 2 128 384 6.45E-03 8.72 1.99E-02 6.15 5.58E-03 7.03 0.99 0.4 3 128 768 4.43E-04 7.73 3.01E-03 5.45 6.35E-04 6.27 1.01 0.7 4 128 1280 3.87E-05 9.54 2.75E-04 9.36 5.22E-05 9.78 1.01 1.0 5 128 1920 2.75E-06 13.05 1.73E-05 13.65 3.05E-06 14.02 1.00 1.4 6 128 2688 1.10E-07 19.12 7.04E-07 19.02 1.13E-07 19.59 1.00 2.2 7 128 3584 2.49E-09 26.35 1.62E-08 26.24 2.42E-09 26.72 1.00 3.4 8 128 4608 2.98E-11 35.22 2.23E-10 34.08 3.00E-11 34.92 1.00 5.3 9 128 5760 3.17E-15 82.03 2.02E-14 83.51 1.56E-14 67.83 1.25 9.0 α =−3/2: lev #ThNhku−˜uhkXEOC Nh(˜uh)EOC ρ h(˜uh)EOC ieff CPU(s) 0 128 384 1.32E-02 – 1.41E-01 – 4.52E-02 – 1.05 0.5 1 128 759 5.98E-03 2.32 6.70E-02 2.18 1.26E-02 3.75 1.01 0.8 2 128 919 5.50E-03 0.87 6.36E-02 0.55 6.26E-03 7.31 1.00 1.1 3 128 969 4.30E-03 9.31 5.52E-02 5.36 4.34E-03 13.81 1.00 1.4 4 134 1089 2.98E-03 6.29 3.96E-02 5.69 3.09E-03 5.86 1.00 1.6 5 140 1191 2.10E-03 7.81 2.75E-02 8.14 2.07E-03 8.91 1.00 1.9 6 152 1371 1.49E-03 4.82 1.93E-02 4.99 1.45E-03 5.03 1.00 2.1 7 158 1476 1.07E-03 9.07 1.37E-02 9.33 1.05E-03 8.72 1.00 2.5 8 164 1578 7.71E-04 9.78 9.78E-03 10.13 7.97E-04 8.34 1.00 2.9 9 176 1758 5.65E-04 5.75 7.04E-03 6.09 6.35E-04 4.21 1.00 3.3 10 188 1938 4.26E-04 5.81 5.15E-03 6.41 5.37E-04 3.43 1.00 3.8 11 200 2118 3.35E-04 5.41 3.87E-03 6.41 4.81E-04 2.48 1.00 4.3 Source: Own 4.2 (E2): Linear Convection-Diffusion Equation with the Strong Interior Layer and the Exponential Boundary Layer We consider the example from [10], given by − ε △u+b1 ∂ u ∂ x1+b2 ∂ u ∂ x2=0 in Ω:= (0,1)2,(31) where ε =10−8is a constant diffusion coefficient and (b1,b2) = (cos(− π /3),sin(− π /3)) is the convection. We prescribe the Dirichlet boundary condition on ∂ Ωby uD(x1,x2) = 0 for x1=1 or x2≤0.7, 1 otherwise.(32) The solution possesses an interior layer in the direction of the convection starting in (x1,x2) = (0,0.7)and contains two boundary layers along x1=0 and x2=0. On the boundary x1=1 and on the right part of the boundary x2=0, exponential layers are developed. The width of layers are proportional to ε . For this case, the exact solution is piecewise constant except thin regions along the boundary and interior layer, however, its analytical expression is unknown. Therefore the computational 63
Tab. 2.Example (E2) given by (31) –(32) with ε =10−8: the approximation of the error k¯u−˜uhkX, nonconformity Nh(˜uh), residuum error estimate ρ h(˜uh)with the corresponding EOC, index ieff and the computational time in seconds lev #ThNhk¯u−˜uhkXEOC Nh(˜uh)EOC ρ h(˜uh)EOC ieff CPU(s) 0 128 384 1.25E-01 – 3.58E+00 – 1.03E+00 – 1.04 0.3 1 128 635 9.56E-02 1.08 3.57E+00 0.01 7.60E-01 1.20 1.02 0.6 2 167 1211 8.06E-02 0.53 5.03E+00 -1.06 7.60E-01 -0.00 1.01 1.0 3 245 1984 7.50E-02 0.30 7.09E+00 -1.39 5.85E-01 1.06 1.00 2.2 4 467 3921 6.35E-02 0.49 1.00E+01 -1.02 5.95E-01 -0.05 1.00 4.0 5 1025 9751 6.12E-02 0.08 1.42E+01 -0.76 6.89E-01 -0.32 1.00 9.4 6 2189 21663 4.51E-02 0.76 2.01E+01 -0.87 7.32E-01 -0.15 1.00 18.2 7 4910 54765 3.17E-02 0.76 2.84E+01 -0.75 6.75E-01 0.17 1.00 50.8 8 7733 106285 2.28E-02 0.99 2.86E+01 -0.02 5.38E-01 0.68 1.00 196.6 9 14240 221582 1.76E-02 0.71 2.86E+01 -0.00 5.20E-01 0.09 1.00 505.8 10 19103 310336 1.62E-02 0.50 2.86E+01 -0.00 5.16E-01 0.04 1.00 1046.7 11 17849 272175 1.61E-02 -0.05 2.86E+01 0.00 5.16E-01 -0.00 1.00 1163.8 12 17426 250641 1.61E-02 -0.01 2.86E+01 -0.00 5.16E-01 0.00 1.00 1226.7 13 17366 240586 1.61E-02 0.03 2.86E+01 -0.01 5.16E-01 0.00 1.00 1248.5 14 17288 236116 1.61E-02 -0.16 2.86E+01 0.02 5.16E-01 0.01 1.00 1290.4 15 17207 233366 1.61E-02 0.12 2.86E+01 -0.05 5.16E-01 0.01 1.00 1311.4 Source: Own error ku−˜uhkXis approximated by k¯u−˜uhkXwhere ¯uis piecewise constant function corresponding to the exact solution of (31) in the limit with ε →0. (The boundary conditions have to be modified of course.) Table 2 shows the results of computations (E2) for problem (31) – (32), namely the values of the approximation of the error k¯u−˜uhkX, nonconformity Nh(˜uh), residuum error estimate ρ h(˜uh)with the corresponding EOC, index ieff and the computational times in seconds. The value k¯u−˜uhkXdoes not tend to zero, probably due to the difference between the exact solution uand its approximation ¯u. Moreover, the nonconformity Nh(˜uh)is high, it will decrease with an additional mesh adaptation, however, here we face a problem with a too high number of degree of freedom and the limits of our computer. It would be more efficient to apply an anisotropic mesh adaptation. Nevertheless, theresults show thatthe presentedhp-methodworksreasonably, both layers are well captured. Furthermore, Figure 2 shows the final hp-grid obtained with the aid of the hp-DGFE algorithm after 5, 10 and 15 adaptive cycles. We observe that the h-adaptation was carried out in regions near both layers. In regions, where the solution is constant, the P0approximation is finally used. We also observe that the algorithm is able to decrease Nhwhen the thin layers are well localized. Finally, Figure 3 shows the detail of the diagonal cut [0,0]→[1,1]of the approximate solution after l=5, l=10 and l=15 adaptation cycles. Conclusion We presented a hp-adaptive numerical method for the solution of the second order boundary value problem. This approach is based on a heuristic approximation of the error measured in a dual norm. Although a theoretical justification of this technique is missing, numerical experiments show reasonable computational properties. 64