uinit Subroutine

public pure subroutine uinit(u, uprime, rpar, ipar)

This routine computes and loads the vector of initial values. The initial u values are given by the polynomial u = 16x(1-x)y(1-y). The initial uprime values are set to zero (DASKR corrects these during the first time step).

Arguments

Type IntentOptional Attributes Name
real(kind=rk), intent(out) :: u(:)
real(kind=rk), intent(out) :: uprime(:)
real(kind=rk), intent(in) :: rpar(:)
integer, intent(in) :: ipar(:)

Called by

proc~~uinit~2~~CalledByGraph proc~uinit~2 uinit program~example_heat example_heat program~example_heat->proc~uinit~2

Variables

Type Visibility Attributes Name Initial
integer, public :: i
integer, public :: ioff
integer, public :: j
integer, public :: k
integer, public :: m
real(kind=rk), public :: dx
real(kind=rk), public :: xj
real(kind=rk), public :: yk

Source Code

   pure subroutine uinit(u, uprime, rpar, ipar)
   !! This routine computes and loads the vector of initial values.
   !! The initial `u` values are given by the polynomial `u = 16x(1-x)y(1-y)`.
   !! The initial `uprime` values are set to zero ([[daskr]] corrects these during the first 
   !! time step).
      real(rk), intent(out) :: u(:)
      real(rk), intent(out) :: uprime(:)
      real(rk), intent(in) :: rpar(:)
      integer, intent(in) :: ipar(:)

      integer :: i, ioff, j, k, m
      real(rk) :: dx, xj, yk

      m = ipar(4)
      dx = rpar(1)

      do k = 0, m + 1
         yk = k*dx
         ioff = (m + 2)*k
         do j = 0, m + 1
            xj = j*dx
            i = ioff + j + 1
            u(i) = 16*xj*(one - xj)*yk*(one - yk)
         end do
      end do

      uprime = zero

   end subroutine uinit