Skip to content

03-2. Equation Definitions

In this section we will discuss how the equations are set in the file src/equations/definitions.f90. Depending on the settings set in settings.input (primarily Eqn_number, Domain_number, Time_switch, and Non_Linear_switch), different subroutines will be called.

Explanation of File Contents

The first subroutine to consider is equation1_linear. It sets up terms of the linear equation:

This is subroutine will always called regardless of Eqn_number being 1 or 2; if this value is set to 2 then equation2_linear will also be called. The subroutine equation2_linear is exactly the same but solves for rather than . Ax, Bx, C and D will always be set. Ay and By will only be set if Domain_number is 2.

   Subroutine equation1_linear(x, y, Ax, Bx, Ay, By, C, D)
      real(dp), intent(in) :: x, y ! xposition in the domain
      real(dp), intent(out) :: Ax, Bx, Ay, By, C, D
      real(dp) :: epsi

      epsi = 0.05d0

      Ax = epsi
      Bx = 0.d0

      Ay = epsi
      By = 0.d0

      C = 0.d0
      D = 1.d0

   End Subroutine equation1_linear

This subroutine equation1_BC_X_Bot is a boundary condition and is identical in form to the subroutine above. However it is only called when is at the lower boundary xl. There are four boundary condition subroutines for each equation:

For :

  • equation1_BC_X_Bot and equation1_BC_X_Top are always called and provide conditions for the xl and xr boundaries, respectively.

  • equation1_BC_Y_Bot and equation1_BC_Y_Top are only called when Domain_number is 2, and provide conditions for the yl and yr boundaries, respectively.

For (only called when Eqn_number is 2):

  • equation2_BC_X_Bot and equation2_BC_X_Top are always called and provide conditions for the xl and xr boundaries, respectively.

  • equation2_BC_Y_Bot and equation2_BC_Y_Top are only called when Domain_number is 2, and provide conditions for the yl and yr boundaries, respectively.

   Subroutine equation1_BC_X_Bot(x, y, Ax, Bx, Ay, By, C, D)
      real(dp), intent(in) :: x, y ! xposition in the domain
      real(dp), intent(out) :: Ax, Bx, Ay, By, C, D

      Ax = 0.d0
      Bx = 1.d0

      Ay = 0.d0
      By = 0.d0

      C = 0.d0
      D = 0.d0

   End Subroutine equation1_BC_X_Bot
  • When Time_switch is 1, the following is called to set the initial condition. There is a similar subroutine for that is called if Eqn_number is 2.
   Subroutine equation1_initial_condition(x, y, IC)
      real(dp), intent(in) :: x, y ! xposition in the domain
      real(dp), intent(out) :: IC

      IC = x + y 

   End Subroutine equation1_initial_condition
  • When Non_linear is 1, the following is called to set the non-linear terms. There is a similar subroutine for that is called if Eqn_number is 2.

  • If Eqn_number is 1 then only F and Fu are called.

  • If Eqn_number is 2 then F, Fu and Fv are called.

   Subroutine equation1_non_linear(x, y, u, v, F, Fu, Fv)
      real(dp), intent(in) :: x, y, u, v
      real(dp), intent(out) :: F, Fu, Fv
      !!! F is a function of u *Fu is dF(u,v)/du and Fv is dF(u,v)/dv
      !!!   Non linear terms do not effect boundaries

      F = u*u*v *u
      Fu = 2.d0*u*v *1.d0 
      Fv = u*u
   End Subroutine equation1_non_linear