diffu Subroutine

public subroutine diffu(putout)

Uses

  • proc~~diffu~~UsesGraph proc~diffu diffu module~modfields modfields proc~diffu->module~modfields module~modglobal modglobal proc~diffu->module~modglobal module~modmpi modmpi proc~diffu->module~modmpi module~modsurfdata modsurfdata proc~diffu->module~modsurfdata decomp_2d decomp_2d module~modfields->decomp_2d mpi mpi module~modmpi->mpi

Arguments

Type IntentOptional Attributes Name
real, intent(inout) :: putout(ib-ih:ie+ih,jb-jh:je+jh,kb:ke+kh)

Called by

proc~~diffu~~CalledByGraph proc~diffu diffu proc~subgrid subgrid proc~subgrid->proc~diffu program~dalesurban DALESURBAN program~dalesurban->proc~subgrid

Source Code

  subroutine diffu (putout)

    use modglobal, only : ib,ie,ih,jb,je,jh,kb,ke,kh,kmax,dx2i,dxi,lles,&
         dzf,dzfi,dy,dyi,dy2i,dzhi,dzhiq,jmax,numol
    use modfields, only : u0,v0,w0
    use modsurfdata,only : ustar
    use modmpi, only    : myid
    implicit none

    real, intent(inout) :: putout(ib-ih:ie+ih,jb-jh:je+jh,kb:ke+kh)
    real                :: emmo,emom,emop,empo
    real                :: fu,dummy
    real                :: ucu, upcu
    integer             :: i,j,k,jm,jp,km,kp

    if (lles) then

       do k=kb,ke
          kp=k+1
          km=k-1

          do j=jb,je
             jp=j+1
             jm=j-1

             do i=ib,ie

                emom = ( dzf(km) * ( ekm(i,j,k)  + ekm(i-1,j,k) )  + &
                         dzf(k)  * ( ekm(i,j,km) + ekm(i-1,j,km))) * dzhiq(k)

                emop = ( dzf(kp) * ( ekm(i,j,k)  + ekm(i-1,j,k))   + &
                         dzf(k)  * ( ekm(i,j,kp) + ekm(i-1,j,kp))) * dzhiq(kp)

                empo = 0.25 * ((ekm(i,j,k) + ekm(i,jp,k)) + (ekm(i-1,j ,k) + ekm(i-1,jp,k)))

                emmo = 0.25 * ((ekm(i,j,k) + ekm(i,jm,k)) + (ekm(i-1,jm,k) + ekm(i-1,j ,k)))


                ! Discretized diffusion term
                putout(i,j,k) = putout(i,j,k) &
                              + ( &
                                ekm(i,j,k)  * (u0(i+1,j,k)-u0(i,j,k)) &
                              - ekm(i-1,j,k)* (u0(i,j,k)-u0(i-1,j,k)) &
                                ) * 2. * dx2i &
                              + ( &
                                  empo * ( &
                                         (u0(i,jp,k)-u0(i,j,k))   *dyi &
                                       + (v0(i,jp,k)-v0(i-1,jp,k))*dxi &
                                         ) &
                                 -emmo * ( &
                                         (u0(i,j,k)-u0(i,jm,k))   *dyi &
                                       + (v0(i,j,k)-v0(i-1,j,k))  *dxi &
                                       ) &
                                 ) * dyi &
                               + ( &
                                 emop * ( &
                                        (u0(i,j,kp)-u0(i,j,k))   *dzhi(kp) &
                                      + (w0(i,j,kp)-w0(i-1,j,kp))*dxi) &
                                -emom * ( &
                                        (u0(i,j,k)-u0(i,j,km))   *dzhi(k) &
                                      + (w0(i,j,k)-w0(i-1,j,k))  *dxi) &
                                 ) *dzfi(k)
             end do
          end do
       end do
    else ! DNS
       do k=kb,ke
          kp=k+1
          km=k-1

          do j=jb,je
             jp=j+1
             jm=j-1

             do i=ib,ie

                ! Discretized diffusion term
                putout(i,j,k) = putout(i,j,k) &
                              + ( &
                                numol * (u0(i+1,j,k)-u0(i,j,k))*dxi &
                              - numol * (u0(i,j,k)-u0(i-1,j,k))*dxi &
                                ) * 2. * dxi &
                              + ( &
                                numol * ( &
                                        (u0(i,jp,k)-u0(i,j,k))   *dyi &
                                      + (v0(i,jp,k)-v0(i-1,jp,k))*dxi &
                                        ) &
                              - numol * ( &
                                        (u0(i,j,k)-u0(i,jm,k))   *dyi &
                                    +   (v0(i,j,k)-v0(i-1,j,k))  *dxi &
                                        ) &
                                  ) * dyi &
                              + ( &
                                numol * ( &
                                        (u0(i,j,kp)-u0(i,j,k))   *dzhi(kp) &
                                      + (w0(i,j,kp)-w0(i-1,j,kp))*dxi) &
                              - numol * ( &
                                        (u0(i,j,k)-u0(i,j,km))   *dzhi(k) &
                                      + (w0(i,j,k)-w0(i-1,j,k))  *dxi &
                                      ) &
                                ) *dzfi(k)
             end do
          end do
       end do

    end if   ! lles

  end subroutine diffu