randomnize Subroutine

public subroutine randomnize(field, klev, ampl, ir, ihl, jhl)

Uses

  • proc~~randomnize~~UsesGraph proc~randomnize randomnize module~modglobal modglobal proc~randomnize->module~modglobal module~modmpi modmpi proc~randomnize->module~modmpi mpi mpi module~modmpi->mpi

Arguments

Type IntentOptional Attributes Name
real :: field(ib-ihl:ie+ihl,jb-jhl:je+jhl,kb-kh:ke+kh)
integer :: klev
real :: ampl
integer(kind=selected_int_kind(6)) :: ir
integer :: ihl
integer :: jhl

Called by

proc~~randomnize~~CalledByGraph proc~randomnize randomnize proc~readinitfiles readinitfiles proc~readinitfiles->proc~randomnize program~dalesurban DALESURBAN program~dalesurban->proc~readinitfiles

Source Code

   subroutine randomnize(field, klev, ampl, ir, ihl, jhl)

      use modmpi, only:myid, nprocs
      use modglobal, only:ib, ie, imax, jmax, jb, je, kb, ke, kh, ierank, BCxm
      integer(KIND=selected_int_kind(6)):: imm, ia, ic, ir
      integer ihl, jhl
      integer i, j, klev
      integer m, mfac
      real ran, ampl
      real field(ib - ihl:ie + ihl, jb - jhl:je + jhl, kb - kh:ke + kh)
      parameter(imm=134456, ia=8121, ic=28411)

      if (myid > 0) then
         mfac = myid*jmax*imax
         do m = 1, mfac
            ir = mod((ir)*ia + ic, imm)

         end do
      end if

      ! if (ierank .and. BCxm > 1) then
      !   do j = jb, je
      !     do i = ib, ie-1
      !       ir = mod((ir)*ia + ic, imm)
      !       ran = real(ir)/real(imm)
      !       field(i, j, klev) = field(i, j, klev) + (ran - 0.5)*2.0*ampl
      !     end do
      !   end do
      ! else
        do j = jb, je
          do i = ib, ie
            ir = mod((ir)*ia + ic, imm)
            ran = real(ir)/real(imm)
            field(i, j, klev) = field(i, j, klev) + (ran - 0.5)*2.0*ampl
          end do
        end do
      !end if

      if (nprocs - 1 - myid > 0) then
         mfac = (nprocs - 1 - myid)*imax*jmax
         do m = 1, mfac
            ir = mod((ir)*ia + ic, imm)
         end do
      end if

      return
   end subroutine randomnize