19.06.2015 Views

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

A FEniCS Tutorial - FEniCS Project

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.4 A Physical Example<br />

With the basic programming techniques for time-dependent problems from Sections<br />

3.3-3.2 we are ready to attack more physically realistic examples. The<br />

next example concerns the question: How is the temperature in the ground<br />

affected by day and night variations at the earth’s surface? We consider some<br />

box-shaped domain Ω in d dimensions with coordinates x 0 ,...,x d−1 (the problem<br />

is meaningful in 1D, 2D, and 3D). At the top of the domain, x d−1 = 0, we<br />

have an oscillating temperature<br />

T 0 (t) = T R +T A sin(ωt),<br />

where T R is some reference temperature, T A is the amplitude of the temperature<br />

variations at the surface, and ω is the frequency of the temperature oscillations.<br />

At all other boundaries we assume that the temperature does not change anymore<br />

when we move away from the boundary, i.e., the normal derivative is zero.<br />

Initially, the temperature can be taken as T R everywhere. The heat conductivity<br />

properties of the soil in the ground may vary with space so we introduce<br />

a variable coefficient κ reflecting this property. Figure 7 shows a sketch of the<br />

problem, with a small region where the heat conductivity is much lower.<br />

The initial-boundary value problem for this problem reads<br />

̺c ∂T<br />

∂t = ∇·(κ∇T) in Ω×(0,t stop ], (80)<br />

T = T 0 (t) on Γ 0 , (81)<br />

∂T<br />

∂n = 0 on ∂Ω\Γ 0, (82)<br />

T = T R at t = 0. (83)<br />

Here, ̺ is the density of the soil, c is the heat capacity, κ is the thermal conductivity<br />

(heat conduction coefficient) in the soil, and Γ 0 is the surface boundary<br />

x d−1 = 0.<br />

We use a θ-scheme in time, i.e., the evolution equation ∂P/∂t = Q(t) is<br />

discretized as<br />

P k −P k−1<br />

= θQ k +(1−θ)Q k−1 ,<br />

∆t<br />

where θ ∈ [0,1] is a weighting factor: θ = 1 corresponds to the backward<br />

difference scheme, θ = 1/2 to the Crank-Nicolson scheme, and θ = 0 to a<br />

forward difference scheme. The θ-scheme applied to our PDE results in<br />

̺c Tk −T k−1<br />

∆t<br />

= θ∇·(κ∇T k) +(1−θ)∇·(k∇T k−1) .<br />

Bringing this time-discrete PDE into weak form follows the technique shown<br />

many times earlier in this tutorial. In the standard notation a(T,v) = L(v) the<br />

66

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!