09. Example Equations
In this section, we present a set of example equations to illustrate the concepts discussed in earlier sections. While the definitions.f90
file and settings.input
configuration are provided in the solver/examples
directory, it is strongly recommended that you attempt to recreate these results independently. This hands-on approach will enhance your understanding of the numerical methods and their implementation. We have included a few MATLAB
codes in the directory solver
if you want to visualise your solutions.
Example 1: Singular Perturbation Boundary Value Problem
The inputs for this example are found in this directory. Use the code to solve the equation
See here for more details on this type of equation. This is a linear equation in one dimension. The general solution is given by
- Without grid stretching, solve this equation in the cases of and with as the number of grid points.
- What happens in the region past as gets smaller?
- Use grid stretching to cluster more points closer to end point of the domain in the cases of and . What can you conclude?
Example 2: Non-linear time dependent equation
The inputs for this example are found in this directory.
Use the code to solve the equation
on the domain
with boundary conditions
for the solution . The initial conditions are given by
on time domain .
Things to note:
There are two interesting behaviours that occur from the solution: 1. First the solution becomes constant very rapidly. This is due to the diffusive term . 2. Secondly, the solution tends to . This is because of the non-linear term : the time dependent equation is given by
and as becomes constant the term
becomes zero. We are left with
with the solution being an attractor i.e the solution is dominate over .
Example 3: Predator-Prey Model
The inputs for this example are found in this directory.
Attempt to solve the following coupled equation
where , on the domain
with boundary conditions
and time domain
Use the initial conditions
Exercises:
- How do the initial conditions change the behaviour of the predator and prey?
- Can you set up the system so that the prey die off?
Example 4: Turing Patterns
The inputs for this example are found in this directory.
Attempt to solve the following:
where and , on the domains
and time domain
Use the boundary conditions:
and initial conditions given by
where is a random number between and . Be careful with the number of spatial grid points; as we are in two dimensions the sizes of the matrices get huge very quickly and slow down the computation. This can be addressed with the use of parallel computing and openmp
. We used .
Hint: use the following intrinsic functions for r
Call random_seed()
Call random_number(r)
We note that for this particular problem, the small parameter that multiplies the second derivatives in the first equation does not cause a boundary layer to form in the PDE. Instead, the pattern made by will be less diffuse than the pattern made by all across the domain.
For a greater discussion see here.