• Ingen resultater fundet

Burgers' Equation with stochastic boundary conditions . 111

12.2 Multivariate Burgers' Equation

12.2.1 Burgers' Equation with stochastic boundary conditions . 111

The 2-variate stochastic Burgers' equation is solved in this section and the eects of having stochastic BC's are investigated. First the outline of how the SCM is used on the multivariate Burgers' equation is outlined in Algorithm 10.

Algorithm 10 Pseudocode for SCM applied to the 2-variate stochastic Burgers' equation

1: Compute the spatial collocation pointsx.

2: Compute the dierential matricesDandD2.

3: Compute the quadrature nodeszb1 andzb2 and the corresponding weights wb1 andwb2.

4: Compute the tensor product of the weights and nodes to obtain Zb1, Zb2

and W.

5: Compute the initial conditionIC.

6: Use a deterministic solver to solve the system in time (reach steady state).

7: Compute the meanE[u] =PM i=0uiWi

8: Compute the variance var(u) =PM

i=0 ui−E[u]2 Wi.

In general the approach is very similar to the approach used for the univariate Burgers' equation. The main dierence is the computation of the stochastic

112 Numerical tests for multivariate stochastic PDEs

grids and weights as well as the initial condition. Therefore the implementation of this is outlined in section 12.2.1.1.

12.2.1.1 Implementation

In this section the implementations that are signicantly dierent than the im-plementations in univariate case is outlined. The rest of the code can be found in appendix B.

The interesting part is implemented in the Matlab function InitBurg2D which looks like this

19 [Z1W,Z2W] = ndgrid (z1W,z2W) ;

20

12.2 Multivariate Burgers' Equation 113

32 U = z e r o s(xL∗ZN, 1 ) ;

33

34 f o r i = 1 :ZN

35 InitTemp = InitCond ;

36 InitTemp ( InitTemp >0) = InitTemp ( InitTemp >0)∗(1+ d e l t a 1 ( i ) ) ;

37 InitTemp ( InitTemp <0) = InitTemp ( InitTemp <0)∗(1+ d e l t a 2 ( i ) ) ;

38 U(xL∗( i−1)+1:xL∗( i ) ) = InitTemp ;

39 end

The BC's are uniformly distributed which means that Gauss Legendre quadra-ture is used.

The function ndgrid is used to compute all combinations of the nodes and of the weights. Then the weights are multiplied to attain the tensor product.

The initial condition is computed by using the exact solution and then change the values that are higher or lower than zero according to the grid of stochastic BC's. This is not strictly necessary in order to obtain good results but it speeds up the iteration process.

12.2.1.2 Tests

In this test a space grid of 31 points have been used and boundary conditions are distributed with u(−1)∼ U(1,1.1) andu(1)∼ U(−1,−1.1).

The tests have been conducted with 4 quadrature points in each stochastic di-mension which means that 16 deterministic solutions have been computed.

The one dimensional dierentiation matrix D and its squareD2 are of dimen-sion31×31which means that the dierentiation matrix for all the deterministic solutions is a(18·31)×(18·31)matrix. In this matrix 181'th of the elements are non-zero which means that the sparse structure of the matrix is denitely worth to utilize. If there had been used more quadrature points the system would have been even more sparse which is worth to note when solving the deterministic system.

The 18 deterministic solutions are plotted in gure 12.9 and have some inter-esting characteristics.

114 Numerical tests for multivariate stochastic PDEs

−1 −0.5 0 0.5 1

−1 0 1

x

Solutions

Figure 12.9: TheM = 18deterministic solutions for Burgers' Equation.

From gure 12.9 it is seen that the deterministic solutions are characterized by three dierent behaviours. The rst kind of deterministic solutions are the ones recognized from the previous univariate test case where the transition layer is shifted to the far right in the plot due to a positive disturbance in the left boundary. This was the tendency that was observed in the univariate case and it is not surprisingly also present in this multivariate test since some of the deterministic solutions are characterized by disturbances in the left boundary but (almost) none in the right boundary.

The second type of deterministic solutions are when there are disturbances in both BC's and the transition layer is located in at x = 0. This means that some of the deterministic solutions have the same characteristics in terms of the transition layer as the unperturbed deterministic solution but with shifted boundary values such the values in u(−1) are a bit higher than the original deterministic solution and the values inu(1)are a bit lower.

The last kind of deterministic solutions are the opposite of what was observed in the univariate test case, namely that there is disturbance in the right boundary and (almost) none in the left boundary which means that the transition layer is shifted to the far left.

The multivariate Burgers' equation yields deterministic solutions that are much dierent from the ones obtained in the univariate case since some of the solutions are very similar to the unperturbed deterministic solution and since there is solutions where the transition layer is shifted both to the left and to the right.

The statistics of the multivariate Burgers' equation have also been computed and in gure 12.10 the mean and variance can be seen.

12.2 Multivariate Burgers' Equation 115

−1 −0.5 0 0.5 1

−1 0 1

x

Mean

±std Var BoundMean

Figure 12.10: The estimated mean and variance and bounds on the solutions.

In gure 12.10 it is seen that the behaviour of the mean is very dierent from the mean computed for the univariate Burgers' equation and the solution of the deterministic Burgers' equation. Instead of having one transition layer where the mean goes from 1 to −1 it is divided into three.

It is also seen that there is a large variance and the uncertainty of this solutions is greater than seen for the other test cases.

12.2.2 3-variate Burgers' equation

Now the ν-parameter is chosen to be stochastic as well as the BC's. This means that it is now a three dimensional stochastic system and due to the tensor product of the stochastic variables this results in a potentially very large system. The overall approach is very similar to the 2-variate case and is outlined in Algorithm 11.

116 Numerical tests for multivariate stochastic PDEs

Algorithm 11 Pseudocode for SCM applied to the 3-variate stochastic Burgers' Equation

1: Compute the spatial collocation pointsx.

2: Compute the dierential matrices Dand D2.

3: Compute the quadrature nodeszb1,zb2andzνand the corresponding weights wb1,wb2 andwν.

4: Compute the tensor product of the weights and nodes to obtain Zb1, Zb2, Zν and W.

5: Compute the initial condition IC.

6: Use a deterministic solver to solve the system in time (reach steady state).

7: Compute the mean E[u] =PM i=0uiWi 8: Compute the variance var(u) =PM

i=0 ui−E[u]2

Wi.

By comparison of the pseudocodes in algorithm 10 and 11 it is seen that most of the steps are the same and some of the implementations can be reused. In the tests presented here the BC's are again chosen to be uniformly distributed as well as theν-parameter.

Theν-parameter is very interesting since it is the viscosity of the Burger's equa-tion and determines the smoothness of the PDE. Ifν= 0there would be a shock discontinuity instead of a transition layer [19].

The polynomial representations used in the spectral methods are not well suited for describing discontinuities andν= 0would therefore pose a serious problem.

During the numerical tests a smallνwas chosen which could not be solved with the current settings. This problem might be dealt with by using some other representations than the orthogonal polynomials but it is outside the scope of this thesis to investigate that.

If theν-parameter is increased the solution of Burgers' equation becomes smoother and the transition layer would not be a region of such rapid change. It would in other words result in a very dierent solution which will be seen in the numerical experiments.

12.2.2.1 Implementation

The interesting part of the implementations compared to the earlier implemen-tations is where the quadratures are used and the initial condition is computed.

This is done in the Matlab function InitBurg3D that is included here while the rest of the implementation is in appendix B.

1 f u n c t i o n [ InitCond ,U, Z ,ZW] = InitBurg3D (zN , alpha ,beta, nu , x , dStart , dEnd)

12.2 Multivariate Burgers' Equation 117

7 % Computing the quadrature weights and nodes f o r the random BC' s

19 % Computing the nodes and weights f o r the nu paremeter

20 i f strcmp( nu . t ,' uniform ')

35 [Z1W,Z2W,Z3W] = ndgrid (z1W,z2W,z3W) ;

36

118 Numerical tests for multivariate stochastic PDEs

45 nuEst = sum( z3 ) /zN ;

46 InitCond = Uexact (x , 0 , nuEst ) ;

47 U = z e r o s(xL∗ZN, 1 ) ;

48

49 f o r i = 1 :ZN

50 InitTemp = InitCond ;

51 InitTemp ( InitTemp >0) = InitTemp ( InitTemp >0)∗(1+ d e l t a 1 ( i ) ) ;

52 InitTemp ( InitTemp <0) = InitTemp ( InitTemp <0)∗(1+ d e l t a 2 ( i ) ) ;

53 U(xL∗( i−1)+1:xL∗( i ) ) = InitTemp ;

54 end

The implementation is very similar to the code used in the two dimensional case and the interesting part is the computation of the tensor grids.

It might seem like an innocent extension of the code used previously but it leads to a very increased computational eort. This is due to the fact thatM =m3 ifmBC1 =mBC2 =mν =mwhich means that the dierentiation matrices are increased very much in size which makes the deterministic system much more costly to solve.

In the tests there are used 61 space points and m = 4 for each stochas-tic dimension which means that the dierentiation matrices are of the size (61·43)×(61·43) = 3904×3904. This means that the two matrices con-tains 15,241,216 elements. Only a fraction of 641 of these elements are non-zero which is about 1.5 % but it is still a large system that potentially has to be solved many times - depending on the solver - in order to reach steady state.

Assuming thatm= 5quadrature points are needed in each dimension to obtain the desired accuracy it will result in a much larger to system. Instead of hav-ing 64 deterministic solutions there is now 125 and the dierentiation matrices are now of the size (61·53)×(61·53) = 7625×7625and contains 58,140,625 elements. Even though "only" 465,125 elements are non-zero it is still a large system and it shows how important it is not to use too many quadrature points if it is not needed. It also demonstrates that when the dimensionality of a prob-lem is increased the computational eort can be increased very much.

This example is a three dimensional stochastic problem and many of the stochas-tic PDE's to be solved have 50 or 100 which illustrates that the growth in the computational eort is a real problem in practise.

It is clear that sparsity has to be utilized when it is possible - both when solving the deterministic system but also - if possible - when computing the quadrature

12.2 Multivariate Burgers' Equation 119

nodes since fewer quadrature nodes in each dimension can signicantly reduce the number of deterministic solutions.

12.2.2.2 Tests

The BC's have been chosen to be the same as those in the test of the 2-variate Burgers' equation and the ν-parameter is chosen to be univariate as well with the distributionν ∼ U(0.05,0.5). This means that there is a large uncertainty in the ν-parameter but it results in some interesting results and demonstrates the eects of the viscosity of the Burgers' Equation.

There are m = 4 quadrature points and weights to represent each stochastic variable which means thatM = 43= 64deterministic solutions are computed.

The 64 solutions have been plotted in gure 12.11.

Figure 12.11: The deterministic solutions for the multivariate Burgers' Equa-tion.

It is seen that theν-parameter has great inuence on the shape of the solutions and the transition layer. Theoretically it would require less quadrature points to represent the solution for increasingν since the solution becomes smoother.

Besides a smoothing eect it also eects the signicance of the perturbed BC's.

When ν is high the realizations of the stochastic Burgers' equation are less eected by the stochastic BC's. The stochastic ν is therefore a signicant

pa-120 Numerical tests for multivariate stochastic PDEs

rameter when conducting UQ for Burgers' equation.

The eect on the statistics of having three stochastic variables have also been investigated. In gure 12.12 the mean and variance are plotted.

−1 −0.5 0 0.5 1

−1

−0.5 0 0.5 1

x

Mean

±std Var Mean

Figure 12.12: The mean, variance and bounds by standard deviation for the computed solution.

It is seen that the variance is relatively small compared to the one obtained in the 2-variate case and the transition layer in the mean is much smoother than previously which means that the stochasticν-parameter has a smoothing eect on the mean and dampens the variance.

It seems like the stochastic ν-parameter decreases the variance of the solution but as seen from gure 12.11 there are larger variations in the deterministic solutions. Hence the smaller variance is not a result of very similar solutions but of the fact that the steep solutions have less inuence on the statistics than the smooth solutions.

It is worth to note that the transition layer of the estimated mean is centred around x = 0 as it is for the unperturbed solution. The transition layer in the estimated mean does not give an exact representation of the solution to the unperturbed problem but it gives a better impression of the location of the transition layer than e.g. the estimated mean for the univariate Burgers' equation.

12.2 Multivariate Burgers' Equation 121

12.2.2.3 Test with a dierent right BC

In this section the right BC have been changed such that it is distributed as u(1)∼ U(−0.9,−1). The rest of the settings are the same as before andm= 4 for each stochastic variable which implies that 64 deterministic solutions have been computed. These solutions have been plotted in gure 12.13.

Figure 12.13: The deterministic solutions for the multivariate Burgers' Equa-tion.

In gure 12.13 it seen that that there are no deterministic solutions which have a transition layer shifted to the left and that there are more solutions which are shifted to the right than previously. This will naturally aect the statistics as seen in gure 12.14 where the estimated mean and variance are plotted.

−1 −0.5 0 0.5 1

−1 0 1

x

Mean

±std Var Mean

Figure 12.14: The estimated mean and variance.

122 Numerical tests for multivariate stochastic PDEs

The estimated mean and variance are skewed to the right in gure 12.14 com-pared to the results plotted in gure 12.12 and the transition layer is steeper.

Based on the investigations of the multivariate problems it safe to say that the stochastic parameters have a great inuence on the solutions of the problems.

Furthermore the eects of a stochastic parameter might be lessened or increased if another stochastic parameter in introduced and UQ is denitely a useful tool when working with e.g. stochastic PDEs. But as outlined in this chapter there are some diculties that need to be solved and one of the main problems is the growth in computational eort when the number of stochastic variables is increased.

Chapter 13

Tests with Smolyak sparse grids

From the theory outlined previously it follows that each collocation node implies to compute a deterministic solution to the system at hand. This means that the sparse grids potentially implies a signicantly reduction in the computational work and it is therefore lucrative to use sparse grids instead of the full tensor grids.

It is furthermore to be noted that the use of sparse grids becomes increasingly benecial for increasing dimensions. The decreased computational eort and time consumption motivates the use of the sparse grids even though it should be noted that the sparse grids are not a cure to the curse of dimensionality but only a remedy to ensure a lessened impact.

The implementations made by John Burkardt [2] are used to conduct tests with the sparse Gauss Legendre (SGL) grid and the sparse Clenshaw-Curtis (CC) grid.

Both types of sparse grids are often used to represent uniformly distributed stochastic variables. The relationship between the grids and the distribution of the variables is similar to the relationship between the orthogonal polynomials and the distributions outlined in Table 4.1. This means that the two types of grids should be optimal when used to represent uniformly distributed variables

124 Tests with Smolyak sparse grids

but they can be used for stochastic variables with other distributions.

It should be noted that the Smolyak grids in general are not restricted to repre-sent uniformly distributed variables and there are many types of Smolyak sparse grids that can be applied.

13.1 Introduction of the sparse grids

The two sparse grids will be introduced further in this section and in the follow-ing sections they will be used to estimate the statistics of the stochastic solutions of the Test equation and the stochastic Burgers' equation.