15
ME 582 – Handout 9 – Unsteady Examples 9-1 METU Mechanical Engineering Department ME 582 Finite Element Analysis in Thermofluids Spring 2018 (Dr. C. Sert) Handout 9 – Unsteady Examples Note: You can use unsteady1D.m code to obtain the 1D solutions given in this handout. The code comes with input files prepared for these examples. Example 1 – Cooling Bar: Consider the unsteady heat diffusion in a 1D domain governed by the following DE 2 2 = 0 , − 1 ≤ ≤ 1 , 0 ≤ ≤ 1 Initial condition ∶ (0, ) = (1 − 2 ) Boundary conditions : (, = −1) = 0 , (, = 1) = 0 Obtain the solution using the 1 st order forward Euler scheme with a time step of Δ = 0.1. This can be seen as a model of the cooling of a 1D bar that is initially heated to have a parabolic temperature distribution, with the maximum value being at its center. Its ends are kept at a fixed low (zero) temperature. The bar gives heat to the surrounding through its ends and its temperature reduces in time. Let’s solve this problem using the following mesh of 5 linear elements, each having a length of = 0.4 and = 0.2 Elemental mass matrix is defined as follows = ∫ Ω e = ∫ 1 −1 which is the same for each element because all elements have the same size. Entries of [ ] can be evaluated as follows 11 =∫ 1 2 (1 − ) 1 2 (1 − )(0.2) 1 −1 = 2 15 12 =∫ 1 2 (1 − ) 1 2 (1 + )(0.2) 1 −1 = 1 15 21 = 12 (due to the symmetry of [ ] ) e=1 e=2 e=3 e=4 e=5 1 2 3 4 5 6

Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-1

METU Mechanical Engineering Department ME 582 Finite Element Analysis in Thermofluids

Spring 2018 (Dr. C. Sert) Handout 9 – Unsteady Examples

Note: You can use unsteady1D.m code to obtain the 1D solutions given in this handout. The code comes with input files prepared for these examples.

Example 1 – Cooling Bar:

Consider the unsteady heat diffusion in a 1D domain governed by the following DE

𝜕𝑇

𝜕𝑡−𝜕2𝑇

𝜕𝑥2= 0 , − 1 ≤ 𝑥 ≤ 1 , 0 ≤ 𝑡 ≤ 1

Initial condition ∶ 𝑇(0, 𝑥) = (1 − 𝑥2)

Boundary conditions : 𝑇(𝑡, 𝑥 = −1) = 0 , 𝑇(𝑡, 𝑥 = 1) = 0

Obtain the solution using the 1st order forward Euler scheme with a time step of Δ𝑡 = 0.1.

This can be seen as a model of the cooling of a 1D bar that is initially heated to have a parabolic temperature distribution,

with the maximum value being at its center. Its ends are kept at a fixed low (zero) temperature. The bar gives heat to the

surrounding through its ends and its temperature reduces in time.

Let’s solve this problem using the following mesh of 5 linear elements, each having a length of ℎ𝑒 = 0.4 and 𝐽𝑒 = 0.2

Elemental mass matrix is defined as follows

𝑀𝑖𝑗𝑒 = ∫𝑆𝑖𝑆𝑗 𝑑𝑥

Ωe

= ∫ 𝑆𝑖𝑆𝑗 𝐽𝑒 𝑑𝜉

1

−1

which is the same for each element because all elements have the same size. Entries of [𝑀𝑒] can be evaluated as follows

𝑀11𝑒 = ∫

1

2(1 − 𝜉)

1

2(1 − 𝜉)(0.2) 𝑑𝜉

1

−1

=2

15

𝑀12𝑒 = ∫

1

2(1 − 𝜉)

1

2(1 + 𝜉)(0.2) 𝑑𝜉

1

−1

=1

15

𝑀21𝑒 = 𝑀12

𝑒 (due to the symmetry of [𝑀𝑒] )

e=1

𝑥

e=2 e=3 e=4 e=5

1 2 3 4 5 6

Page 2: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-2

𝑀22𝑒 = ∫

1

2(1 + 𝜉)

1

2(1 + 𝜉) (0.2) 𝑑𝜉

1

−1

=2

15

For each element, the mass matrix is

[𝑀𝑒] =1

15[2 11 2

]

Assembled global mass matrix is

[𝑀] =1

15

[ 2 1 1 4 1 1 4 1 1 4 1 1 4 1 1 2]

Elemental stiffness matrix is defined as

𝐾𝑖𝑗𝑒 = ∫

𝑑𝑆𝑖𝑑𝜉 1

𝐽𝑒 𝑑𝑆𝑗

𝑑𝜉 1

𝐽𝑒 𝐽𝑒 𝑑𝜉

1

−1

→ [𝐾𝑒] = [2.5 −2.5−2.5 2.5

]

Elemental stiffness matrices are also the same for all elements. Assembled global stiffness matrix is

[𝐾] =

[ 2.5 −2.5 −2.5 5 −2.5 −2.5 5 −2.5 −2.5 5 −2.5 −2.5 5 −2.5 −2.5 2.5]

At level 𝑠 = 0 nodal unknown vector {𝑇}0 can be obtained from the given initial condition as follows

{𝑇}0 =

{

00.640.960.960.640 }

Following is the forward Euler formula that we’ll use to “march in time”. [𝐾] and {𝐹} do not depend on time, so we

removed their subscript 𝑠.

[𝑀] {𝑇}𝑠+1 = ([𝑀] − ∆𝑡[𝐾]){𝑇}𝑠 + ∆𝑡 {𝐹}⏟=0

{𝑇}𝑠

Actually {𝐹} is zero for this problem. After applying reduction for the EBCs, the following 4x4 system is obtained.

1

15[

4 1 1 4 1 1 4 1 1 4

] {

𝑇2𝑇3𝑇4𝑇5

}

1

= (1

15[

4 1 1 4 1 1 4 1 1 4

] − 0.1 [

5 −2.5 −2.5 5 −2.5 −2.5 5 −2.5 −2.5 5

]){

0.640.960.960.64

}

Page 3: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-3

Solving this system, we get the following result for 𝑠 = 1 time level.

{

𝑇2𝑇3𝑇4𝑇5

}

1

= {

0.38740.77050.77050.3874

}

We can continue like this and calculate one more solution using

[𝑀] {𝑇}2 = ([𝑀] − ∆𝑡[𝐾]){𝑇}1

After applying reduction for EBCs and solving the system we get

{

𝑇2𝑇3𝑇4𝑇5

}

2

= {

0.45880.46890.46890.4588

}

If we continue a few more time steps we get the following results.

{

𝑇2𝑇3𝑇4𝑇5

}

3

= {

0.01790.54950.54950.0179

} , {

𝑇2𝑇3𝑇4𝑇5

}

4

= {

0.62980.02840.02840.6298

} , {

𝑇2𝑇3𝑇4𝑇5

}

5

= {

−0.70380.74620.7462−0.7038

}

The results are not physical. We expect to have the mid-point temperatures to be higher than the ones close to the

boundaries, but that is not the case. At time level 𝑠 = 5 we get negative temperature values, but the smallest temperature

that can appear in this problem is zero. This solution is unstable. Forward Euler scheme is only conditionally stable and

the selected Δ𝑡 exceeds the critical Δ𝑡 of this problem.

Example 2 – A Stable Solution with Forward Euler:

If we decrease the time step to 0.05 forward

Euler becomes stable, at least up to 𝑡𝑓𝑖𝑛𝑎𝑙 = 1,

which is reached in 20 steps.

Important: Critical Δ𝑡 depends on the DE being

solved, the time discretization scheme and the

size of the elements. If we increase the number

of elements to 10, i.e. decrease the element size

to 0.2, Δ𝑡 = 0.05 exceeds the critical Δ𝑡 and the

solution again becomes unstable. Therefore, as

the mesh gets finer and finer stability restriction

of an explicit scheme becomes more and more

severe. With a 10 element uniform mesh,

Δ𝑡 = 0.005 gives a stable solution. With a 50

element mesh, Δ𝑡 of about 2.5 × 10−4 is stable.

𝑠 = 0, 𝑡 = 0

𝑠 = 2, 𝑡 = 0.1

𝑠 = 4, 𝑡 = 0.2

𝑠 = 20, 𝑡 = 1

Page 4: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-4

Example 3 – Time Step Independence Analysis:

Backward Euler scheme is unconditionally stable. We can get a stable solution no matter what Δ𝑡 we use. But Δ𝑡 still

needs to be small enough to get an accurate solution. Let’s solve the previous problem using the 1st order backward Euler

scheme with 50 elements and with different Δ𝑡’s, and check the accuracy of the solution by looking at the value of 𝑇 at

𝑥 = 0 and 𝑡 = 𝑡𝑓𝑖𝑛𝑎𝑙 = 1. Results are as follows.

Δ𝑡 𝑇(𝑥 = 0, 𝑡 = 1) Percent relative error wrt.

the last solution

0.2 0.1388 59 %

0.1 0.1137 30 %

0.01 0.09011 3 %

10−3 0.08772 0.3 %

10−4 0.08748 0.03 %

10−5 0.08745 -----

Plot of this table is given below. After Δ𝑡 = 10−3, the solution is not changing considerably. We do not need to use smaller

time steps. Depending on how much accuracy we want, even Δ𝑡 = 10−2 can be considered as enough. This is a time step

independence study. Similar to a mesh independence study, we also need to perform this one for an unsteady problem.

Important: As discussed in the previous example, with 50 elements, forward Euler scheme needed a Δ𝑡 of about

2.5 × 10−4 for a stable solution. This value is 4 times larger than 10−3, which is roughly what we need to get a Δ𝑡

independent solution. If 3 % error is good enough, even using Δ𝑡 = 0.01 is acceptable, which is 40 times larger than the

critical Δ𝑡 limit of the forward Euler scheme. So compared to backward Euler, forward Euler needs a much smaller time

step due to stability. This is usually the case, i.e. for an explicit scheme the time step is usually restricted by stability, not

by accuracy. But what if we use mass lumping with forward Euler? Solution time per time step will reduce and the overall

run time can be comparable to (or even faster than) the backward Euler solution. Next example is about the use of mass

lumping.

Converged value

Page 5: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-5

Example 4 – Mass Lumping with the Forward Euler Scheme:

Forward Euler is an explicit scheme. But unlike FDM or FVM, in FEM it still requires the solution of a system of equations

at each time step, which is as costly as an implicit scheme. It already has a stability issue. So to be of any use, we need to

apply mass lumping to make it truly explicit, so that no solution of an equation system is necessary. This way, the forward

Euler scheme will be less costly per time step and may compete with implicit schemes in terms of overall run time.

Here we’ll not compare run times, but rather concentrate on the accuracy loss brought by mass lumping. When we solve

the same problem with 50 elements using forward Euler scheme with mass lumping, the result is not good. With mass

lumping the temperature profile becomes almost totally flat at the end of the solution with 𝑇(𝑥 = 0, 𝑡 = 1) = 0.0063.

Mass lumping caused too much accuracy loss for this problem. Of course what we have here is a very limited test, but the

least we should conclude is that we need to use mass lumping with caution. An important detail here is that we used the

simplest for of lumping, known as “row sum lumping”. Other more advanced techniques may give better results.

Example 5 – Crank Nicolson (C-N) Scheme:

Let’s repeat what we did in Example 3 using the Crank-Nicolson scheme. Again we have 50 elements.

Δ𝑡 𝑇(𝑥 = 0, 𝑡 = 1) Percent relative error wrt.

the last solution

0.2 0.08249 5.7 %

0.1 0.08634 1.3 %

0.01 0.08744 0.01 %

0.001 0.08745 -----

This study clearly demonstrates the higher accuracy provided by the Crank-Nicolson scheme. With Δ𝑡 = 0.1 we are able

to get a solution with 1.3 % error. In Example 3, 1st order backward Euler used with this Δ𝑡 resulted in 30 % error.

Δ𝑡 = 0.1 is 400 times larger than 2.5 × 10−4, which is the stability limit of the forward Euler scheme for 50 elements.

Converged value

Page 6: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-6

Note that the range of the vertical axis of the above plot and the one given in Example 3 are quite different. If we had

used the same range for both, the curve in this one would look much more flat and converged.

Example 6 – Unsteady Problem with a Steady State Final Solution:

Some problems go through an unsteady transition to reach a steady state solution. And sometimes what we are interested

in is only the final steady state solution, not how we reach there. In such a case, using an unconditionally implicit scheme

with a large time step makes sense.

Let’s modify the DE that we solved in the earlier examples by adding a force function.

𝜕𝑇

𝜕𝑡−𝜕2𝑇

𝜕𝑥2= 𝑓 , − 1 ≤ 𝑥 ≤ 1 , 0 ≤ 𝑡 ≤ 15

𝑓 = {40 if − 0.1 ≤ 𝑥 ≤ 0.1else

Initial condition ∶ 𝑇(0, 𝑥) = 0

Boundary conditions : 𝑇(𝑡, 𝑥 = −1) = 0 , 𝜕𝑇

𝜕𝑥|𝑡,𝑥=1

= 0

This time the physical interpretation is as such; Initially the bar is at zero temperature. While keeping the left end at zero

and insulating the right end, we supply concentrated heat to the middle part of the bar and its temperature rises until a

steady state is reached.

Let’s first perform a very accurate reference solution using the Crank-Nicolson scheme with 500 elements and Δ𝑡 = 0.001.

The result at different times are as follows. At the steady state the temperature at the insulated boundary reaches to 0.8

and that happens approximately at 𝑡 = 10 s. Here we solve the problem up to 𝑡𝑓𝑖𝑛𝑎𝑙 = 15.

𝑡 = 15

𝑡 = 0

𝑡 = 0.5

𝑡 = 1

Page 7: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-7

Now let’s reduce the number of elements to 50, which is enough to get an acceptable solution. We’ll solve the problem

using different schemes and time steps up to 𝑡𝑓𝑖𝑛𝑎𝑙 = 15 s, and record the final steady state temperature at the right

boundary, i.e. 𝑇(𝑡 = 15, 𝑥 = 1).

Scheme Δ𝑡 𝑇(𝑡 = 15, 𝑥 = 1) Relative error wrt the

exact value of 0.8

Notes

C-N 0.001 0.7928 0.9 %

C-N 0.01 0.7928 0.9 %

C-N 0.1 0.7928 0.9 %

C-N 1 0.7944 0.7 % Oscillatory

C-N 3 0.7562 5.5 % Oscillatory

Backward Euler 0.001 0.7928 0.9 %

Backward Euler 0.01 0.7928 0.9 %

Backward Euler 0.1 0.7928 0.9 %

Backward Euler 1 0.7922 1.0 %

Backward Euler 3 0.7881 1.5 %

Forward Euler 0.001 Unstable -----

Forward Euler 0.01 Unstable -----

Forward Euler 0.1 Unstable -----

Forward Euler 1 Unstable -----

Both implicit schemes provide acceptable steady state results using very high time steps such as Δ𝑡 = 1. With this Δ𝑡,

both schemes provide an error less than 1 % reaching 𝑡𝑓𝑖𝑛𝑎𝑙 in only 15 steps. However, with 50 elements, the explicit

forward Euler scheme is unstable even with Δ𝑡 = 0.001.

Important: As seen in the last column of the above table, C-N becomes oscillatory for very high Δ𝑡 values. Progress of such

a solution with Δ𝑡 = 1 is shown below. As seen, the rise of temperature from 𝑡 = 0 to 𝑡𝑓𝑖𝑛𝑎𝑙 is not monotonic, i.e. curves

corresponding to different time levels are crossing each other. At certain instants of time we see values slightly exceeding

the maximum steady state value of 0.8. This is not physical. But it is not instability, i.e. these oscillations do not grow

unboundedly in time. This is the typical oscillatory behavior of C-N seen with high Δ𝑡 values. Backward Euler scheme

shows no such oscillations, even when the solution is obtained with Δ𝑡 = 15, i.e. using a single time step to reach steady

state (Of course such a result is not very accurate. Try and see).

Conclusion: Using a low order implicit scheme such as 1st order backward Euler with a high Δ𝑡 is the best approach to

determine a steady state solution without paying attention to unsteady transitions. If the unsteady transition part also

needs to be captured accurately, a higher order scheme such as C-N and a lower Δ𝑡 can be suggested.

Page 8: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-8

Example 7 – Moving Cosine Hill:

Up to this point we solved unsteady diffusion. Let’s now consider the following unsteady advection problem.

𝜕𝜙

𝜕𝑡+ 𝑈

𝜕𝜙

𝜕𝑥= 0 for 𝑥 ∈ [0, 1.4] , 𝑡 ∈ [0, 1]

𝜙(0, 𝑡) = 0

𝜙(𝑥, 0) = {

1 + cos (5𝜋(𝑥 − 0.2))

2 if 𝑥 < 0.4

0 else

Initial condition given at 𝑡 = 0 is a smooth cosine hill centered at point 𝑥 = 0.2 with height 1 and base length 0.4. This

hill will move in the positive 𝑥 direction with a speed of 𝑈 = 1. Since this is a pure advection problem, the shape of the

hill is expected to remain the same as it travels. The equation is hyperbolic and only one BC at the left end of the domain

is necessary. No BC should be given at the right end. But our unsteady1D.m code asks for a BC there also, and we can

provide zero flux (do nothing) condition.

Forward Euler, backward Euler and Crank-Nicolson (C-N) schemes with 100 linear elements are used for the solutions.

Oscillatory nature of C-N seen with high Δ𝑡 values.

Page 9: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-9

Results at 𝑡 = 1 obtained using the forward Euler scheme with different Δ𝑡’s are shown below. Forward Euler scheme is

only conditionally stable and the solution is stable and acceptable only for small enough time steps. When time step is

increased, unphysical waves develop behind the main traveling cosine hill and they grow in magnitude. These waves are

an indication of dispersion errors of the approximation. When the combined space and time discretization has dominant

dispersion type truncation errors, these kind of extra unphysical waves appear in the solution.

Δ𝑡 = 10−4 Δ𝑡 = 5 × 10−4

Δ𝑡 = 10−3

Page 10: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-10

Next figure shows the solutions obtained with the backward Euler scheme, which is unconditionally stable. The solution

is smooth even for very large time steps. However, for large time steps the solution is too diffusive, as seen by the drop

of the hill’s height. This drop is an indication of diffusion errors. When the combined space and time discretization has

dominant diffusion type truncation errors, sharp features of the solution diffuse out and become too smooth.

Important: Altough the results with high Δ𝑡’s are smooth and free of oscillations, they are not accurate. Here we can easily

say this because we know the exact solution. But for a real-life flow problem with no known exact solution, it would be

difficult to judge the correctness of the solution. Accepting a smooth looking solution as accurate just because it looks

smooth is a commonly made mistake.

Δ𝑡 = 10−4 Δ𝑡 = 10−3

Δ𝑡 = 10−2 Δ𝑡 = 10−1

Page 11: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-11

The following figure shows results obtained with the C-N scheme, which is second order accurate in time. For large time

steps its diffusive error is less than the backward Euler scheme. However it is not as “oscillation-free” as the backward

Euler scheme, and similar to the previous example, it starts to create oscillations for high Δ𝑡’s. Again, these oscillations

are not a sign of instability because they do not grow in time unboundedly.

Very Important: All these results are at 𝑡 = 1. In one unit time, the cosine hill travels a distance of 1 unit with the given

unit velocity. The hill travels a distance of 𝑈Δ𝑡 units at each time step. For a given element size of ℎ𝑒, the hill passes over 𝑈Δ𝑡

ℎ𝑒 elements. For the mesh of 100 elements used in these simulations, one element length is 0.014 units. Therefore with

Δ𝑡 of say 0.1, the hill passes over about (1)(0.1)

0.014= 7 elements in one time step, which is simply too much for the explicit

forward Euler scheme. The hill tries to move too fast, but this is not allowed and the solution goes unstable.

The above calculation is usually presented in terms of the nondimensional Courant number defined as

𝐶 =𝑈Δ𝑡

ℎ𝑒

Courant number is important in studying stability characteristics of time discretization schemes. For explicit schemes

Courant Friedrichs Lewy (CFL) stability condition puts a maximum upper limit for 𝐶 as follows

CFL condition: 𝐶 < 𝐶𝑚𝑎𝑥 → Δ𝑡 < Δ𝑡𝑐𝑟𝑖𝑡𝑖𝑐𝑎𝑙

Δ𝑡 = 10−4 Δ𝑡 = 10−3

Δ𝑡 = 10−2 Δ𝑡 = 10−1

Page 12: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-12

For explicit schemes, for a given 𝑈 and ℎ𝑒, CFL condition puts a stability limit on the maximum allowed Δ𝑡. 𝐶𝑚𝑎𝑥 value

depends on the PDE that is being solved and the details of space and time discretizations, such as the polynomial order

of elements and order of the time discretization scheme. For simple PDES such as the one we have in this problem that

describes pure advection, we can calculate the value of 𝐶𝑚𝑎𝑥 by performing a stability analysis, which is not a subject of

our course.

CFL condition does not apply to implicit schemes that are unconditionally stable.

Important: As seen in the CFL condition equation, for a given 𝑈 value, the critical Δ𝑡 depends on the element size ℎ𝑒. If

we decrease the element size to get a more accurate solution, we should also decrease the time step so that the CFL

condition is not violated.

For multi-dimensiopnal problems where the velocity vector is not constant in magnitude, and the mesh not unfiorm, the

small elements over which we have the high advection speed, i.e. the combination which results in the highest Courant

number, are the most critical ones for stability and they are the ones that define the critical Δ𝑡.

Important: We have to be careful when deriving conclusions based on the solutions of a single problem. This example is

about pure advection, i.e. there is no diffusion. Real life problems usually include some amount of diffusion, which helps

us to stabilize the solution to a certain degree. Shape of the initial cosine hill is also important. For example if we try to

work with a square wave with sharp corners, the solutions will be much more oscillatory.

Example 8 – Rotating Cosine Hill:

2D version of the previous problem is sketched below. Now we have a roating cosine hill in a square domain.

Governing PDE and the boundary and initial conditions are as follows

𝜕𝜙

𝜕𝑡+ �⃗� ⋅ ∇𝜙 = 0 , Ω ∈ [−1,1] × [−1,1] , 𝑡 ∈ [0, 2𝜋]

𝜙 = 0 at all boundaries

View BB at 𝑡 = 0

H = 1

D = 0.5

𝑦

𝑥

Point A (-0.5, 0)

Flow

direction

B B

�⃗� = −𝑦𝑖 + 𝑥𝑗

(-1, -1)

(1, 1)

Page 13: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-13

𝜙(𝑥, 𝑦, 0) = { 1

2[cos (4𝜋𝑟) + 1] if 𝑟 < 0.25

0 else } where 𝑟 = √(𝑥 + 0.5)2 + 𝑦2

Problem domain is a 2x2 square. Initially the unknown 𝜙 is specified to be zero everywhere except the cosine hill centered

at point A with a height of 1 and a diameter of 0.5. A velocity field is specified as �⃗� = −𝑦𝑖 + 𝑥𝑗 , which rotates the cosine

hill around the origin in CCW direction. EBC of value zero is given at all boundaries. Similar to the previous problem, this

is also a pure advection case and the exact solution should have the hill rotating around the origin, without changing its

shape. Unfortunately due to diffusive errors of a numerical solution, the hill will diffuse out as it rotates, which will be

seen as a decrease in its height and an increase in its radius. Also due to the dispersive errors, there will be trailing waves

behind the rotating hill. The simulations are run for a total time of 2𝜋, which corresponds to one revolution of the hill.

Following figure shows the results obtained using a uniform mesh of 100 bilinear quadrilateral elements. For each case

backward Euler (BE) and Crank-Nicolson (C-N) schemes are tested with two different time steps. Considering its unstable

charateristics, forward Euler scheme is not used for this problem.

As seen, a mesh of 100 elements gives totally unacceptable results. Even the small time step gives no meaningful result,

because space discretization errors are very dominant for this very coarse mesh.

BE Δ𝑡 = 𝜋/100

C-N Δ𝑡 = 𝜋/100

BE Δ𝑡 = 𝜋/1000

C-N Δ𝑡 = 𝜋/1000

𝜙

Page 14: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-14

Following results are obtained with 400 elements. Now it is possible to identify the rotating hill. Similar to the previous

1D problem, backward Euler scheme has excessively large diffusive errors, especially for the larger Δ𝑡. Using C-N scheme

with Δ𝑡 = 𝜋/1000, height of the hill reduces to 0.75 after one rotation (it should stay at 1 for the exact solution) and

trailing waves have a maximum undershoot of 0.17.

BE Δ𝑡 = 𝜋/100

C-N Δ𝑡 = 𝜋/100

BE Δ𝑡 = 𝜋/1000

C-N Δ𝑡 = 𝜋/1000

𝜙

Page 15: Spring 2018 (Dr. C. Sert) Handout 9 Unsteady Examplescourses.me.metu.edu.tr/courses/me582/files/Handouts... · Actually {𝐹} is zero for this problem. After applying reduction for

ME 582 – Handout 9 – Unsteady Examples

9-15

Following results are obtained with 900 elements. Backward Euler is still too diffusive for the large time step and the result

is unacceptable. When the time step is reduced, backward Euler result gets considerably better. Best reult is obtained

using the C-N scheme with the small time step, for which height of the hill after one rotation reduces to only 0.92 and

trailing waves have a maximum undershoot of only 0.08.

Important: Errors accumulate as the time elapses. Results get worse if we increase 𝑡𝑓𝑖𝑛𝑎𝑙, i.e. allow the hill to make more

rotations. For example, if the 900 element case with the C-N scheme and t = /1000 is run for 3 rotations, maximum

height of the hill reduces to 0.80 and the trailing waves show a maximum undershoot of 0.17. Backward Euler performs

much worse. Using a high order accurate time discretization scheme becomes especially important for problems that

require long time integration. Here Adams-Moulton, Adams-Bashforth and Runge-Kutta schemes become good

alternatives.

BE Δ𝑡 = 𝜋/100

C-N Δ𝑡 = 𝜋/100

BE Δ𝑡 = 𝜋/1000

C-N Δ𝑡 = 𝜋/1000

𝜙