Skip to content

03-1. Solver Settings

In this section we will discuss the input file solver/settings.input. This file sets parameters for the solver and domain of the simulation. This the file is read in by the subroutine read_me in the reader.f90 module. The relevant inputs extracted from this file are then shared with the rest of the code.

We will refer to the equations:

Explanation of File Contents

This first section is:

Settings ________________
1           !!! Time_switch (time marching if 1)
1           !!! Non_Linear_switch (non linear if 1)
2           !!! Eqn_number
2           !!! Domain_number

  • Time_switch toggles the the solver between a BVP solver when set to 0 and a IBVP solver when set to 1. When we have a BVP, this is equivalent to setting the time derivatives and .

  • Non_Linear_switch controls the Newton-iteration solver, disabling it when set to 0 and enabling it when set to 1. The equation that we solve when the Non_Linear_switch is 0 is linear, and so

  • Eqn_number sets how many equations to solve. If set to 1, we only solve for . If set to 2, we solve for both and .

  • Domain_number specifies the number of domains. If set to 1, we only solve over one domain . If set to 2, we only solve over one domain and .

Domain sections:

!!! xdomain settings_____
30        !!! nx - size of x domain
0,5   !!! xl, xr - start and end points of x domain
0,2.25    !!! x_stretch_on or off, grid stretch parameter (xhalf)

!!! ydomain settings_____
30        !!! ny - size of y domain
0,5       !!! yl, yr - start and end points of y domain
0,2.25    !!! y_stretch_on or off, grid stretch parameter (yhalf)

!!! temporal marching settings_____
1000              !!! nt - size of t domain
0.d0,10.d0        !!! tl, tr - start and end points of time domain
Here we set the sizes of the domains.

  • nx, ny and nt set the number of points inside each domain.

  • xl and xr are the start and end of the domain respectively. This is repeated for and .

  • For the spatial domains and we also include a grid stretch switch x_stretch_on and y_stretch_on When set to 0, then we have uniform domains. When set to 1, half the grid points have been clustered between xl and xhalf in a smooth manner. This is the same for .

!!! general settings_____
4           !!! DiffOrder - order of finite differences scheme
1.d-6       !!! Newton_Error
2000        !!! Max_iter - max Newton iterations
  • DiffOrder sets the order of the finite differences. Can be 2 (second order), (fourth order interior and second order boundaries) or (fourth order).

  • Newton_Error sets the tolerance needed to achieve convergence in the non-linear Newton iteration at each step. A smaller number yields a more accurate result.

  • Max_iter sets the maximum number of iterations allowed for the non-liner Newton iteration. If we pass this number, convergence is not reached and the solver stops.