Applied Mathematics and Computation 183 (2006) 813–818 www.elsevier.com/locate/amc
Fourier embedded domain methods: Periodic and C1 extension of a function defined on an irregular region to a rectangle via convolution with Gaussian kernels Alfonso Bueno-Orovio Department of Mathematics, University of Castilla-La Mancha, E.T.S.I. Industriales, Avda. Camilo Jose´ Cela s/n, 13071 Ciudad Real, Spain
Abstract One possible way to solve a partial differential equation in an irregular region X is the use of the so-called domain embedding methods, in where the domain of interest is embedded within a rectangle. In order to apply a Fourier spectral method on the rectangle, the inhomogeneous term f(x, y) has to be extended to a new function g(x, y) that is periodic and infinitely differentiable, and equal to f(x, y) everywhere within X. Some authors have given explicit methods to compute extensions with infinite order convergence for the cases in where the boundary of X, oX, can be defined as the zero isoline of a function w(x, y). For the cases in where this is not possible, we suggest a new method to build these extensions via convolution with Gaussian kernels. Ó 2006 Elsevier Inc. All rights reserved. Keywords: Domain embedding methods; Fictitious domain methods; Fourier pseudospectral; Extension of a function
1. Introduction The numerical solution of partial differential equations in irregular domains is a problem subject to many computational difficulties, being the first of them the geometrical description of the domain of interest. The flexibility to describe complex geometries using unstructured meshes is one of the reasons why the finite element method is preferred in many science and engineering problems. However, the computational cost associated with constructing an appropriate solution grid can be significantly relevant in some situations, specially in problems involving moving boundaries in where a new grid has to be built at every time step. One way to overcome grid generation and the complexity coming from the irregularity of the domain is the use of the so-called domain embedding or fictitious domain methods. The idea of these methods is to approximate the solution to the original problem by the solution of an auxiliary problem in a fictitious domain in which the irregular geometry is embedded [1–5], what allows the application of direct fast solvers on the regE-mail address:
[email protected] URL: http://matematicas.uclm.es/abueno 0096-3003/$ - see front matter Ó 2006 Elsevier Inc. All rights reserved. doi:10.1016/j.amc.2006.06.029
814
A. Bueno-Orovio / Applied Mathematics and Computation 183 (2006) 813–818
ular domain. For instance, when applied to the solution of the Poisson equation uxx + uyy = f(x, y), if the inhomogeneous term f(x, y) can be extended from the irregular region X to a rectangle D so that the extended function g(x, y) is spatially periodic and C1 everywhere within and on the rectangle, then u will have a twodimensional Fourier series that will converge exponentially fast. Boundary conditions can be imposed a posteriori by adding homogeneous solutions through a boundary element or capacitance matrix method. Thus, a suitable extension of f(x, y) allows the use of a highly-accurate/easy-to-program spectral method even though the geometry is complicated. A way to define exponentially convergent extensions of f(x, y) using error-function-like functions was given in [6] for the case when f(x, y) is defined explicitly everywhere within the embedding rectangle D. However, the main assumption of the suggested extension is that the boundary of X, oX, can be defined as the zero isoline of a function w(x, y), what is in general not true for an arbitrarily given closed curve. For those cases in where the boundary cannot be expressed as the zero level set of a function w, we show in the present note that an extension based on convolutions with Gaussian kernels satisfies the same properties than the extension suggested in [6], therefore overcoming the problem of the description of the boundary. The plan of the paper is as follows. In Section 2 we describe the extensions based on error-function-like functions, while Section 3 is devoted to those based on convolutions with Gaussian kernels. Some numerical examples comparing both types of extensions are presented in Section 4. Finally, Section 5 summarizes the main conclusions of the present work. 2. The error-function-like extension As said above, the key assumption of the extension suggested by Boyd in [6] is that the boundary of the irregular geometry, oX, is defined as the zero-isoline (level set) of a C1 function w : R2 ! R. This function ~ yÞ awðx; yÞ, where a is a constant chosen so that the level surface w ~ ¼1 w(x, y) has to be rescaled as wðx; is a curve oK which is (i) contained within the rectangle D and (ii) exterior to o X. The basic idea for extending f(x, y) is to multiply it by a ‘‘window’’ function q(x, y) with the following properties (1) q(x, y) 1 everywhere in X, (2) q(x, y) is C1, (3) q(x, y) is ‘‘infinitely flat’’ (the function and all its derivatives are zero) everywhere on oK and its exterior. Such a window function is taken to be yÞÞ; qðx; yÞ Hð1 2wðx;
ð1Þ
where H : R ! R is a ‘‘ramp’’, i.e., a smoothed approximation to a step function Hðx; LÞ ð1=2Þf1 þ Eðx; LÞg and E : R ! R is the error-function-like function defined as 8 1; x < 1; > < x ; x 2 ½1; 1; Eðx; LÞ ¼ erf L pffiffiffiffiffiffiffi 1x2 > : 1; x > 1:
ð2Þ
ð3Þ
In these expressions, L is an experimentally-chosen factor that pffiffiffiffiffiffiffiffiffiffiffiffi ffi specifies how rapidly the erf-like, ramp and window functions tend to their limits. Thanks to the 1= 1 x2 , the argument of the error function varies from 1 to 1 as x ranges from 1 to 1, so that E is infinitely flat (in the sense that all its derivatives vanish) at x = ±1. This allows the erf-like function, and by inheritance, the ramp and windows functions, to be infinitely differentiable for all real x and y. A representative function q(x, y) is illustrated in the right panel of Fig. 1. The extended function is the product of f(x, y) with q(x, y): gðx; yÞ ¼ qðx; yÞf ðx; yÞ;
ð4Þ
A. Bueno-Orovio / Applied Mathematics and Computation 183 (2006) 813–818
815
D
1
∂Λ
1
∂Ω
0.5
ρ(x,y) 0.5
y
0 0
Ω
-0.5
x -1
y -1.5
-1
-0.5
0
0.5
1
1.5
x
yÞ. The physical domain X (shaded) is delimited by the isoline w ¼ 0. The dashed curve oK represents the Fig. 1. Left: Contours of wðx; ¼ 1. Both curves are contained within the exterior rectangle D. outer boundary of the windowing region, and is defined by the level set w Right: Window function q(x, y) obtained using the error-function-like extension approach.
that by construction is identically equal to f(x, y) everywhere in X and zero everywhere outside the curve oK. As proved in [6] this implies that, using the rectangle as the period box, its Fourier series has infinite order convergence, that means, its Fourier coefficients gmn will decrease faster than any finite inverse power of m and n (jgmnj 6 constant mjnk for sufficiently large m, n for arbitrarily large j and k). 3. Extension via convolution with Gaussian kernels Contrary to what is assumed in Section 2, there are many situations in where the boundary of the irregular domain of interest, oX, cannot be defined as the zero isoline of a C1 function w(x, y), or at least it is not easy to obtain such a function. This is for instance the case when dealing with a discretized domain extracted from an image, or the case of domains defined by their constructive solid geometry formulation (set of logical operations like union, subtraction or intersection between elementary primitives like circles, squares, etc). In these situations, and since Eq. (1) cannot be used, we suggest to obtain a window function /(x, y) as the convolution /ðx; yÞ ¼ Gðx; y; nÞ vX ðx; yÞ;
ð5Þ
in where G : R2 ! R is the Gaussian kernel Gðx; y; nÞ ¼
1 2 2 2 pffiffiffiffiffiffi 2 eðx þy Þ=2n ðn 2pÞ
and vX : R2 ! f0; 1g is the characteristic function of the physical domain of interest X ( 1; x 2 X; vX ðx; yÞ ¼ 0; x 2 D n X:
ð6Þ
ð7Þ
In these expressions,pnffiffiffiffiffiisffi an experimentally-chosen factor that plays the same role as L in the previous section, 2 and the factor 1=ðn 2pÞ is added to the definition of the Gaussian kernel to produce a normalized convolution in the range [0, 1]. It is known [7] that if a Cp function f and a L1loc function g are convoluted, the result f*g 2 Cp. Since Gðx; y; nÞ is C1 and vX is L1loc , then /(x, y) is a C1 function. In addition, since the kernel used in Eq. (6) and all its derivatives decay exponentially to zero for x n, by inheritance the window function /(x, y) and all its derivatives decay exponentially to zero in a strip of width of OðnÞ surrounding oX, and therefore /(x, y) can be assumed to be infinitely flat at the boundary of the rectangle D.
816
A. Bueno-Orovio / Applied Mathematics and Computation 183 (2006) 813–818
1
1
0.8
0.8
0.6
0.6
0.4
0.4
χΩ
0.2
1
1.2
1 0.5 0
Θ (φ ) ~ φ (x,y)
0.2
φ(x,y)
0
~ φ(x,y)
1.4
x
0 1.6
1.8
1
x
1.2
1.4
1.6
1.8
y
x
~ yÞ, viewed at the right part of the Cassini ovals, y = 0. The dashed vertical Fig. 2. Left: Steps in the generation of the window function /ðx; lines show the limit of the characteristic function of the domain, vX. Due to the smoothing introduced by the convolution, /(x, y)51 everywhere within X. This is solved generating a new characteristic function, H(/(x, y)) that is newly convoluted. Right: Window function ~ yÞ obtained via convolution with a Gaussian kernel. /ðx;
The only property that is not satisfied by /(x, y) is that, due to the smoothing introduced by the convolution, /(x, y) 5 1 in the interior points of X close to the boundary. Thus, we modify the definition given by Eq. (5) as ~ yÞ ¼ Gðx; y; nÞ Hð/ðx; yÞÞ /ðx;
ð8Þ
in where H : R ! f0; 1g is the standard Heaviside function centered at x = 0. In this equation, the role of H(/ (x, y)) is to produce a wider characteristic function that is newly smoothed by a second convolution with the ~ yÞ 1 everywhere within Gaussian kernel. These operations result in a new window function that satisfies /ðx; the original domain of interest X. The left panel of Fig. 2 shows graphically the different steps carried out ~ yÞ. A representative window function /ðx; ~ yÞ is illustrated in the right panel throughout the creation of /ðx; ~ yÞ. of the same figure. The extended function would be again the product of f(x, y) with /ðx; 4. Numerical examples Our first example is taken from [6]. The isolines of pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi wðx; yÞ ¼ x4 þ y 4 þ 2x2 y 2 2x2 þ 2y 2 þ 1 l
ð9Þ
are ‘‘ovals of Cassini’’. For l > 1, these ovals merge into a smooth dog bone shape as the one shown in the left panel of Fig. 1 for a value of l = 1.1. As stated in [6], the rate of convergence of the extended function g(x, y) will not only depend on the effectiveness of the extension procedure, but also on the smoothness of f(x, y). The easiest way to separate the two effects and verify that the extensions are spectrally-accurate procedures is to plot the coefficients of the window functions, which is equivalent to perform the extension of the trivial function f(x, y) = 1. The scatter plots shown in Fig. 3 demonstrate that both the error-function-like extension and the proposed extension based on convolutions converge exponentially fast, since the Fourier coefficients of both of them are bounded from above by linear envelopes (on a log-linear plot, a straight line implies that the coefficients are decreasing exponentially fast with degree). Thus, both types of extensions have similar properties and can be used indistinctly. Identical results are obtained for other smooth shapes. The left panel of Fig. 4 shows the irregular region used as domain of interest in our second numerical example. For this region it is not possible to define a function w(x, y) so that oX is delimited by its level set w = 0, and therefore the error-function-like approach cannot be used here. On the other hand, its extension can be computed straightforwardly using the suggested convolution procedure. The Fourier coefficients of the mentioned extension are shown in the right panel of the same figure. Once more, the scatter plot demonstrates that the Fourier series of the proposed extension has an infinite order of convergence.
A. Bueno-Orovio / Applied Mathematics and Computation 183 (2006) 813–818
10
10
10
10
10
absolute value of Fourier coefficients
absolute value of Fourier coefficients
10 0
-2
-4
-6
-8
817
0
-2
10
-4
10
-6
10
-8
10
-10
-10
10
10
0
20
40
60
80
100
120
0
20
total mode number
40
60
80
100
120
total mode number
Fig. 3. Two-dimensional Fourier cosine coefficients of the window functions obtained for the Cassini oval. Left: error-function-like ~ yÞ computed via convolution with a Gaussian kernel, with extension q(x, y), with smoothing parameter L = 4. Right: extension /ðx; pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi smoothing parameter n = 0.025. Horizontal axes represent the ‘‘total mode number’’, defined by m ¼ m2 þ n2 . Both Fourier series were truncated at m = 99, n = 69.
D absolute value of Fourier coefficients
1
0.5
y
10
0
∂Ω -0.5
Ω -1
0
-2
10
-4
10
-6
10
-8
10
-10
10 -1
-0.5
0
x
0.5
1
0
20
40
60
80
100
120
total mode number
Fig. 4. Left: Physical domain of interest X. In this case the boundary oX cannot be described easily as the zero isoline of a function w(x, y). ~ yÞ obtained for X via convolution with a Gaussian kernel, Right: Two-dimensional Fourier cosine coefficients of the window function /ðx; pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi with smoothing parameter n = 0.025. The horizontal axis represents the ‘‘total mode number’’, defined by m ¼ m2 þ n2 . The Fourier series was truncated at m = 99, n = 69.
Our final comment is that, as occurs in the error-function-like expansion with the smoothing parameter L, a little experimentation is usually enough and adequate to pick a satisfactory value for n. However, in this approach the width of the windowing region is only fixed by this parameter and not by an outer boundary oK. If n is taken too big the window function does not have enough space to decay to zero over the boundary of the embedding rectangle D. To avoid these situations, we recommend to take n < M/10, in where M is the value of the smallest margin left between the irregular region and the rectangle D.
818
A. Bueno-Orovio / Applied Mathematics and Computation 183 (2006) 813–818
5. Summary In the present paper we have introduced a complementary procedure to the one suggested in [6] to compute spatially periodic and C1 extensions of a function defined on an irregular region to a rectangle. The proposed approach proves to be especially suitable for those situations in where the boundary of the irregular region cannot be defined as (or, at least, is not easily defined as) the level set of a two-dimensional function w(x, y). This is the case of many situations of industrial interest, such as regions extracted from an image or domains defined by their constructive solid geometry formulation. Using the classification given in [8] and as happens with the error-function-like extension, the proposed window function solves the problem of ‘‘Fourier Extension of the First Kind’’, that is, when the function f(x, y) to be extended is known everywhere within the embedding rectangle. If the function is known but contains poles or branch points outside the physical domain X but within the rectangle (‘‘Fourier Extension of the Second Kind’’), the same strategy still works just taking a smaller value of the smoothing parameter n. This produces a window function of increasing sharpness as n ! 0. If n can be taken small enough so that all singularities of f(x, y) are outside the smoothing region, then the extended function g(x, y) will be identically zero at all these singularities and will have a Fourier series with infinite order convergence. The existence of fast convolution algorithms [9] also makes the suggested approach to be computationally efficient. In addition, the generalization of the method to three-dimensional situations [4] is absolutely straightforward. Finally, and as in the case of the error-function-like extension, the extensions presented here can also be improved by the use of ‘‘imbricate series’’ [6,8]. Acknowledgements The author is supported by Consejerı´a de Educacio´n and Ciencia de la Junta de Comunidades de CastillaLa Mancha under PhD grant 03-056. This work is also partially supported by the Ministerio de Educacio´n y Ciencia under contract grant number BFM2003-02832 and Consejerı´a de Educacio´n y Ciencia de la Junta de Comunidades de Castilla-La Mancha under contract grant number PAI-05-001. References [1] L. Badea, P. Daripa, On a Fourier method of embedding domains using an optimal distributed control, Numer. Algorithms 32 (2003) 261–273. [2] M. Elghaoui, R. Pasquetti, A spectral embedding method applied to the advection–diffusion equation, J. Comput. Phys. 125 (1996) 464–476. [3] M. Elghaoui, R. Pasquetti, Mixed spectral-boundary element embedding algorithms for the Navier–Stokes equations in the vorticitystream function formulation, J. Comput. Phys. 153 (1996) 82–100. [4] A. Bueno-Orovio, V.M. Pe´rez-Garcı´a, F.H. Fenton, Spectral methods for partial differential equations in irregular domains: the spectral smoothed boundary method, SIAM J. Sci. Comput. 28 (2006) 886–900. [5] A. Bueno-Orovio, V.M. Pe´rez-Garcı´a, Spectral smoothed boundary methods: the role of external boundary conditions, Numer. Meth. Part Differen. Equat. 22 (2006) 435–448. [6] J.P. Boyd, Fourier embedded domain methods: extending a function defined on an irregular region to a rectangle so that the extension is spatially periodic and C1, App. Math. Comput. 161 (2005) 591–597. [7] H. Bre´zis, Analyse fonctionelle: theo´rie et applications, Masson, Paris, 1983. [8] J.P. Boyd, A comparison of numerical algorithms for Fourier extension of the first, second and third kinds, J. Comput. Phys. 178 (2002) 118–160. [9] R.M. Haralick, L.G. Shapiro, Computer and Robot Vision, vol. 1, Addison Wesley, New York, 1992, pp. 298–299.