Skip to content

07. Non-Uniform Domain

We then include the effect of multiplying the second derivative by a small parameter:

The primary challenge in discretising this type of problem stems from the formation of a boundary layer near one of the domain's boundaries. This boundary layer presents a unique computational difficulty due to its dual nature. Outside this thin region, the equation's behavior approximates that of the case where . However, within the boundary layer itself, the influence of becomes significant and cannot be disregarded. This contrast in behavior between the two regions necessitates careful consideration of the discretization process. This is demonstrated in the second plot of example 1 in Section 9, where a uniform grid is used to discretise the problem and leads to the failure of the numerical solution to converge onto the analytical solution.

One method of overcoming such a problem is grid stretching. This technique involves clustering more points near the boundary where the boundary layer exists, allowing for a greater resolution in this region. The primary drawback of this approach is that the standard finite difference coefficients are invalid when used on non-uniform grids. While it is possible to derive new coefficients specifically for non-uniform grids, we instead elegantly map the physical domain onto a uniform computational grid. This transformation preserves the benefits of increased resolution near singularities while allowing the use of the standard finite difference coefficients.

We can establish a mapping between a non-uniform physical domain and a uniform computational grid . Given that represents the number of grid points, the mapping for is defined as follows:

where

  • represents the -th point in the physical domain

  • for

  • and is the clustering value that places half the points in between and .

To convert the PDE from the domain to the domain we use the chain rule

We call the terms and the metrics. We compute these numerically in subroutines first_difference and second_difference in domain.f90.

Substituting these derivatives into the PDE results in the modified equation

where

This is achieved by the subroutine scales in equations/builder.f90.

We note that in scales we actually work in terms of and as these quantities are easier to compute. From the chain rule:

initial_domain_settings Overview:

All domain considerations are dealt in the module domain.f90. We emphasise that to construct a new domain all that needs to be specified in the subroutine set_up_domain in domain.f90 are the domains boundaries, number of discretised points and the grid stretching settings. It is therefore easy to define multiple domains if needed.

Diagram showing function call structure of the functions which set up the initial domain.

equation_setup Overview:

All one-dimensional equations are built from the the modules equations.f90 and equations/builder.f90.

Diagram showing function call structure of the functions which set up the equations.