MATH 4810Computational Modelling

Module 03 · Unit 3.1 · Lesson 3 of 3

Boundary and Initial Conditions

A PDE alone is not a problem. Boundary and initial conditions determine whether the problem is well posed — and how the numerical scheme must treat the edges of the grid.

Duration ≈ 2.5 hours Prerequisite Unit 3.1, Lessons 1 & 2 Feeds Lab 5 · Assignment 3
  1. Lesson 1
  2. Lesson 2
  3. Lesson 3

1 Modelling context

A partial differential equation describes how a quantity evolves in space and time. By itself, it does not determine a unique solution: an infinite family of functions satisfies the same PDE. To single out a particular solution, additional conditions are required on the boundary of the domain and, for time-dependent problems, at the initial time.

These conditions are not a formality. They determine whether the problem is well posed — whether a solution exists, is unique, and depends continuously on the data. They also determine what happens at the edges of the numerical grid, where finite-difference stencils that reach outside the grid are not directly applicable.

This lesson covers the standard boundary and initial conditions, the meaning of each, and the way each is incorporated into a finite-difference scheme.

No unique solution without conditions

The PDE is not the model. The PDE plus its domain plus its boundary and initial conditions is the model. Any of the three can be changed, and the resulting problem is a different problem.

2 Learning objectives

By the end of this lesson you will be able to

  • State the three components of a well-posed PDE problem.
  • Classify a boundary condition as Dirichlet, Neumann, or Robin.
  • State the physical interpretation of each boundary-condition type.
  • Implement each boundary-condition type in a finite-difference scheme.
  • Determine whether a given PDE problem is well posed.
  • Recognise the consequences of an ill-posed problem for numerical simulation.

3 Prerequisite review

Domain
The region of space and time over which the PDE holds. For a one-dimensional problem, typically [a, b] × [0, T].
Boundary
The set of points where the spatial domain ends — in one dimension, the two endpoints x = a and x = b.
Normal derivative
The derivative of the solution in the direction perpendicular to the boundary. Denoted ∂u/∂n. In one dimension, it is simply ±∂u/∂x, with the sign chosen so that it points outward from the domain.
Well posed
A problem is well posed if a solution exists, is unique, and depends continuously on the data. For PDEs, this requires a domain, a PDE, and appropriate boundary and initial conditions.

4 Mathematical formulation

Boundary conditions

A boundary condition specifies some aspect of the solution on the boundary of the spatial domain. The three standard types are:

Dirichlet condition

The value of the solution is specified:

u(a, t) = g_D(t)

For example, in a heat-conduction problem, a Dirichlet condition at x = a means the temperature at that endpoint is fixed over time — the endpoint is in contact with a reservoir held at a prescribed temperature.

Neumann condition

The derivative of the solution normal to the boundary is specified:

∂u/∂n (a, t) = g_N(t)

In one dimension, this is −∂u/∂x(a, t) = g_N(t) if the outward normal points in the negative x direction. Physically, a Neumann condition specifies the flux across the boundary. A homogeneous Neumann condition, ∂u/∂n = 0, represents an insulated boundary.

Robin condition

A linear combination of the value and the normal derivative is specified:

a u(a, t) + b ∂u/∂n(a, t) = g_R(t)

Physically, a Robin condition describes convective heat exchange with an environment: the flux across the boundary is proportional to the difference between the boundary value and the ambient value.

Boundary condition types and their physical interpretations
Type Condition Physical meaning
Dirichlet u = g Value fixed at the boundary
Neumann ∂u/∂n = g Flux fixed at the boundary
Robin a u + b ∂u/∂n = g Flux proportional to difference from ambient value

Initial conditions

For a time-dependent PDE, an initial condition specifies the state of the system at the initial time:

u(x, 0) = u_0(x),    x ∈ [a, b]

The number of initial conditions required depends on the order of the time derivative in the PDE. The heat equation (∂u/∂t = α ∂²u/∂x²) is first-order in time and requires one initial condition. The wave equation (∂²u/∂t² = c² ∂²u/∂x²) is second-order in time and requires two: the initial displacement and the initial velocity.

Well-posedness

A problem consisting of a domain, a PDE, and appropriate boundary and initial conditions is well posed if:

  • Existence. A solution exists that satisfies the PDE in the interior and the boundary and initial conditions.
  • Uniqueness. Only one solution satisfies all the conditions.
  • Continuous dependence. Small changes in the boundary or initial data produce small changes in the solution.

The third condition — continuous dependence — is what makes numerical computation meaningful. If arbitrarily small perturbations in the data could produce arbitrarily large changes in the solution, no numerical method could produce a reliable answer, regardless of its accuracy.

Domain, boundary conditions, and initial condition A rectangular domain in the x-t plane. The horizontal axis is space from x equals a to x equals b. The vertical axis is time from zero to T. The left edge is marked Dirichlet or Neumann or Robin, the right edge is marked similarly, and the bottom edge is marked as the initial condition. The interior is shaded to indicate where the PDE holds. interior: PDE holds boundary conditions boundary conditions initial condition u(x, 0) = u_0(x) x t a b 0 T
Figure 3.5. The three components of a well-posed PDE problem. The PDE holds in the interior; boundary conditions are imposed on the left and right edges; the initial condition is imposed on the bottom edge.

Numerical treatment of each condition type

In a finite-difference scheme, boundary conditions are implemented in different ways depending on their type.

Dirichlet conditions. The boundary value is assigned directly to the boundary grid point at each time level:

u_0^n = g_D(t_n)
u_{N_x}^n = g_D(t_n)

Neumann conditions. The derivative is approximated with a one-sided difference and used to solve for the boundary value:

( u_0^n − u_1^n ) / Δx = − g_N(t_n)  ⟹  u_0^n = u_1^n − Δx g_N(t_n)

A ghost point approach is an alternative: introduce a fictitious grid point outside the domain whose value is chosen so that the central difference reproduces the specified derivative.

Robin conditions. The condition is solved simultaneously with the interior scheme, or the boundary value is eliminated using the relation between the value and the derivative.

5 Worked example

A rod with mixed boundary conditions

Consider a one-dimensional heat-conduction problem in a rod of length 1:

∂u/∂t = α ∂²u/∂x²,    α = 0.05,    x ∈ [0, 1]

The initial condition is a uniform temperature:

u(x, 0) = 100,    0 ≤ x ≤ 1

The boundary conditions are mixed:

  • At x = 0: the rod is held at 0 by contact with an ice bath. This is a Dirichlet condition: u(0, t) = 0.
  • At x = 1: the rod is insulated. No heat flows across the boundary, so the flux is zero. This is a homogeneous Neumann condition: ∂u/∂x(1, t) = 0.

Numerical treatment of the Dirichlet end.

At the left boundary, the grid value is set directly:

u_0^n = 0    for all n

Numerical treatment of the Neumann end.

At the right boundary, we need to impose ∂u/∂x(1, t) = 0. Use a first-order one-sided difference:

( u_{N_x}^n − u_{N_x − 1}^n ) / Δx = 0  ⟹  u_{N_x}^n = u_{N_x − 1}^n

Alternatively, use the ghost-point approach with a second-order central difference. Introduce a fictitious point u_{N_x + 1} and require

( u_{N_x + 1}^n − u_{N_x − 1}^n ) / (2 Δx) = 0  ⟹  u_{N_x + 1}^n = u_{N_x − 1}^n

Then apply the interior stencil at i = N_x, using the ghost value in place of the missing neighbour. This preserves second-order accuracy at the boundary.

Physical expectation.

Heat flows from the interior toward the cold end at x = 0. The insulated end at x = 1 has no flux, so it retains its heat. The steady state is u(x, ∞) = 0 everywhere, since the only source of heat is the initial condition, which eventually drains through the cold end.

Numerical check.

Run the simulation and confirm: (i) the temperature at x = 0 remains zero at every time step; (ii) the temperature gradient at x = 1 remains zero; (iii) the average temperature decreases monotonically over time, and (iv) it approaches zero as t becomes large.

6 Verification check

Checks to perform

  • Confirm boundary values are imposed, not computed. Boundary grid points at each time level should equal the specified boundary data, to within floating-point tolerance.
  • Verify Neumann conditions numerically. Compute the one-sided difference at the boundary and confirm it equals the specified flux.
  • Check conservation for insulated boundaries. If all boundaries are insulated (homogeneous Neumann), the total heat in the domain should be conserved. Verify this numerically at every time step.
  • Test the steady-state behaviour. If the problem has a steady state, confirm the numerical solution approaches it as t grows.
  • Check the initial condition is imposed exactly. At n = 0, the numerical grid function should equal u_0(x_i) at every grid point.
  • Verify consistency of boundary conditions with initial conditions. If the initial condition does not satisfy the boundary condition at the corner (a, 0), the numerical solution may develop an artefact at that corner. Decide in advance whether the initial condition should be adjusted to be compatible.

7 Interpretation

Boundary and initial conditions determine what the numerical solution represents. They are not numerical artefacts, and they are not optional. Changing a boundary condition changes the physical problem, and therefore changes what the solution means.

Three consequences follow:

  • The boundary condition is part of the model's claim-support scope. A model with an insulated boundary at x = 1 does not describe a system in which heat escapes through that end. The claim-support statement must reflect the conditions under which the model is valid.
  • Boundary conditions interact with the numerical scheme. A Neumann condition implemented with a first-order one-sided difference reduces the accuracy of the scheme near the boundary. A second-order implementation preserves the interior accuracy but requires more care.
  • Corner compatibility matters. If the initial condition and the boundary condition disagree at a corner of the domain, the numerical solution will develop a sharp feature at that corner. The feature may be physical — an instantaneous change of boundary data — or it may be an artefact of an ill-posed problem. Deciding which requires the model's context.

Reporting template

A clean way to report the boundary and initial conditions is: "The problem is solved on [a, b] × [0, T] with boundary conditions [list, with type for each end] and initial condition [state]. The numerical treatment of the Neumann boundary is [method], with truncation error [order]." Every element of this sentence is part of the result.

8 Uncertainty and limitations

The boundary and initial data are inputs to the model, and they carry uncertainty just as parameters do. Two distinct sources should be distinguished.

Sources of uncertainty in boundary and initial data
Source Cause Reduced by
Measurement error The boundary or initial data are measured, not known exactly Better instruments; propagation of error in sensitivity analysis
Idealisation error The boundary condition is an idealisation of a complex reality More detailed boundary modelling; comparison against observation
Incompatibility Initial and boundary conditions disagree at a corner Adjusting the data to be consistent; or accepting a known artefact

The most common practical issue is idealisation error. An "insulated" boundary is never perfectly insulated; a "fixed" temperature is never perfectly fixed. The model treats these as exact, and the resulting solution reflects that choice. Sensitivity analysis, in which the boundary data are varied over a plausible range, quantifies the impact.

Well-posedness is a prerequisite, not a guarantee

A well-posed problem has a unique solution that depends continuously on the data. It does not follow that the problem accurately represents the real system. Well-posedness is a precondition for numerical computation; validation is a separate question.

9 Common implementation errors

Watch for these

  • Applying the interior stencil at a boundary point. The central difference requires both neighbours. At i = 0 or i = N_x, one neighbour is missing. A one-sided stencil must be used, or the boundary value must be treated separately.
  • Overwriting the boundary value with the computed value. The interior scheme computes only interior points. The boundary values are imposed by the boundary condition at each time level. Overwriting them produces a solution that does not respect the boundary data.
  • Getting the sign wrong in a Neumann condition. The outward normal at the right end points in the positive x direction; at the left end it points in the negative direction. The same physical flux corresponds to opposite signs of ∂u/∂x at the two ends.
  • Using a first-order boundary treatment and expecting second-order overall accuracy. A second-order interior scheme combined with a first-order boundary treatment has an effective order of one. Either use a second-order boundary treatment, or acknowledge the reduced order.
  • Ignoring corner incompatibility. If the initial condition violates the boundary condition at a corner, the numerical solution develops a sharp transient. Decide in advance whether to adjust the initial condition or to accept the artefact, and document the choice.
  • Assuming all boundary conditions are compatible with the scheme. A Robin condition requires careful treatment to preserve the order of the interior scheme. A quick implementation can degrade the overall accuracy.
  • Forgetting that the wave equation needs two initial conditions. Initial displacement alone is insufficient; initial velocity is also required.

10 Independent modelling task

Your turn

  1. Choose a one-dimensional time-dependent PDE problem, such as the heat equation on [0, 1].
  2. Specify the boundary conditions. Use a Dirichlet condition at one end and either a Neumann or a Robin condition at the other. State the physical interpretation of each.
  3. Specify the initial condition. Verify that it is compatible with the boundary conditions at both corners.
  4. Implement each boundary condition numerically. For the Dirichlet end, assign the boundary value directly. For the Neumann or Robin end, use a one-sided difference (or a ghost-point method).
  5. Run the simulation. Verify that the boundary values at every time step equal the specified data, to within floating-point tolerance.
  6. If one of the boundaries is insulated, verify that the total heat is conserved to within numerical tolerance.
  7. Write a short paragraph on the effect that changing the Neumann boundary to a Dirichlet boundary would have on the solution, and why.

This exercise forms part of Laboratory 5 and the boundary-condition component of Assignment 3.

11 Reflection prompt

Reflect before continuing

Why does the heat equation require only one initial condition while the wave equation requires two?

Two or three sentences. Consider the order of the time derivative in each equation and what information it takes to determine a unique solution.

12 Lesson summary

Key takeaways

  • A well-posed PDE problem has three components. A domain, a PDE, and appropriate boundary and initial conditions.
  • The three boundary-condition types are Dirichlet, Neumann, and Robin. Each has a distinct physical interpretation and a distinct numerical treatment.
  • Boundary values are imposed, not computed. The interior scheme applies only to interior points.
  • The number of initial conditions depends on the order of the time derivative. The heat equation needs one; the wave equation needs two.
  • Corner compatibility matters. Initial conditions that disagree with boundary conditions at a corner produce a numerical artefact.
  • Well-posedness is not validation. A well-posed problem is a precondition for numerical computation; it is not evidence that the model represents the real system.

Unit 3.1 complete

You have constructed grids, derived finite-difference approximations, and specified the boundary and initial conditions that make a PDE problem well posed. Unit 3.2 assembles these ingredients into working schemes and examines their stability.

§ Self-quiz, practice, and homework

Self-quiz

Q1

A boundary condition of the form u = g is:

Show answer

Dirichlet.

Q2

A well-posed PDE problem requires:

Show answer

A PDE, a domain, and appropriate boundary and initial conditions.

Q3

The heat equation requires how many initial conditions?

Show answer

One. The heat equation is first-order in time.

Q4

A homogeneous Neumann condition ∂u/∂n = 0 represents:

Show answer

An insulated boundary.

Q5

Corner incompatibility between initial and boundary conditions produces:

Show answer

A sharp transient at the corner. Decide in advance whether this is physical or an artefact.

Practice exercises

  1. Classify each boundary condition: (a) u(0, t) = 5, (b) ∂u/∂x(L, t) = 0, (c) u(0, t) + 2 ∂u/∂x(0, t) = 3, (d) u(L, t) = sin(t).
  2. For a heat-conduction problem in a rod, describe the physical meaning of each of the four conditions in exercise 1.
  3. Write the numerical implementation for a Neumann condition at the left boundary using a one-sided difference. Show the derivation.
  4. Write the numerical implementation for a Robin condition at the right boundary. Explain the algebra.

Homework problems

  1. Boundary condition design. Choose a physical problem (heat conduction, diffusion, wave propagation). Specify the boundary conditions at both ends and justify each in physical terms. Write the numerical implementation of each. 500 words plus formulas.
  2. Well-posedness check. For each of the following, decide whether the problem is well posed and justify briefly: (a) heat equation with zero boundary conditions but no initial condition; (b) wave equation with initial displacement but no initial velocity; (c) Poisson equation with no boundary conditions. Describe what happens numerically if you try to solve each.
  3. Corner compatibility. Construct a problem where the initial condition violates the boundary condition at a corner. Implement the scheme and demonstrate the resulting artefact. Suggest a resolution.

Mini project

Choose a physical system with mixed boundary conditions (e.g. a rod with one end insulated and the other held at fixed temperature). Implement the scheme, verify boundary values are imposed correctly at each time step, and check conservation of the appropriate quantity if one boundary is insulated. Submit the spreadsheet and a report. This is the basis for Laboratory 5 and Assignment 3.

👤