setup_rbdpre Subroutine

public subroutine setup_rbdpre(mx, my, ns, nsd, lid, iwork)

This routine sets the mesh parameters needed to use the routines jac_rbdpre and psol_rbdpre, assuming a 2D rectangular problem. Additionally, it loads the lengths lrwp and liwp in array iwork.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: mx

Number of mesh points in x-direction.

integer, intent(in) :: my

Number of mesh points in y-direction.

integer, intent(in) :: ns

Number of PDE variables, the size of each block in the block-diagonal preconditioner matrix .

integer, intent(in) :: nsd

Number of differential PDE variables. In the DAE system, the first nsd variables at each spatial point have time derivatives, and the remaining (ns - nsd) do not.

integer, intent(in) :: lid

Flag indicating whether to load the ID array in iwork. If lid > 0, set the ID array in iwork, indicating which components are differential and which are algebraic. This value is required if either info(11) = 1 or info(16) = 1, in which case set lid = 40 or lid = 40 + neq, depending on the value of the constraint option info(10). Otherwise, set lid = 0.

integer, intent(inout) :: iwork(*)

Integer work array.


Called by

proc~~setup_rbdpre~~CalledByGraph proc~setup_rbdpre setup_rbdpre program~example_web example_web program~example_web->proc~setup_rbdpre

Source Code

   subroutine setup_rbdpre(mx, my, ns, nsd, lid, iwork)
   !! This routine sets the mesh parameters needed to use the routines [[jac_rbdpre]] and 
   !! [[psol_rbdpre]], assuming a 2D rectangular problem. Additionally, it loads the lengths
   !! `lrwp` and `liwp` in array `iwork`.

      integer, intent(in) :: mx
         !! Number of mesh points in x-direction.
      integer, intent(in) :: my
         !! Number of mesh points in y-direction.
      integer, intent(in) :: ns
         !! Number of PDE variables, the size of each block in the block-diagonal preconditioner
         !! matrix \(P_R\).
      integer, intent(in) :: nsd
         !! Number of differential PDE variables. In the DAE system, the first `nsd` variables
         !! at each spatial point have time derivatives, and the remaining `(ns - nsd)` do not.
      integer, intent(in) :: lid
         !! Flag indicating whether to load the ID array in `iwork`. If `lid > 0`, set the ID 
         !! array in `iwork`, indicating which components are differential and which are algebraic.
         !! This value is required if either `info(11) = 1` or `info(16) = 1`, in which case
         !! set `lid = 40` or `lid = 40 + neq`, depending on the value of the constraint option
         !! `info(10)`. Otherwise, set `lid = 0`.
      integer, intent(inout) :: iwork(*)
         !! Integer work array.

      integer :: i, i0, jx, jy

      ! Load the modules variables.
      srur = sqrt(epsilon(one))
      mp = ns
      mpd = nsd
      mpsq = ns*ns
      meshx = mx
      meshy = my
      mxmp = meshx*mp

      ! Set the sizes of the preconditioning storage space segments in RWORK and IWORK.
      iwork(27) = mpsq*meshx*meshy
      iwork(28) = mp*meshx*meshy

      ! If LID > 0, set the ID array in IWORK.
      if (lid == 0) return
      i0 = lid
      do jy = 1, my
         do jx = 1, mx
         do i = 1, mpd
            iwork(i0 + i) = 1
         end do
         do i = mpd + 1, mp
            iwork(i0 + i) = -1
         end do
         i0 = i0 + mp
         end do
      end do

   end subroutine setup_rbdpre