diffw Subroutine

public subroutine diffw(putout)

Uses

  • proc~~diffw~~UsesGraph proc~diffw diffw module~modfields modfields proc~diffw->module~modfields module~modglobal modglobal proc~diffw->module~modglobal module~modmpi modmpi proc~diffw->module~modmpi 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~~diffw~~CalledByGraph proc~diffw diffw proc~subgrid subgrid proc~subgrid->proc~diffw program~dalesurban DALESURBAN program~dalesurban->proc~subgrid

Source Code

  subroutine diffw(putout)

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

    !*****************************************************************

    real, intent(inout) :: putout(ib-ih:ie+ih,jb-jh:je+jh,kb:ke+kh)
    real                :: emom, eomm, eopm, epom
    integer             :: i,j,k,jm,jp,km,kp

    if (lles) then

       do k=kb+1,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)

                eomm = ( dzf(km) * ( ekm(i,j,k)  + ekm(i,jm,k)  )  + &
                         dzf(k)  * ( ekm(i,j,km) + ekm(i,jm,km) ) ) * dzhiq(k)

                eopm = ( dzf(km) * ( ekm(i,j,k)  + ekm(i,jp,k)  )  + &
                         dzf(k)  * ( ekm(i,j,km) + ekm(i,jp,km) ) ) * dzhiq(k)

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


                ! discretized diffusion term
                putout(i,j,k) = putout(i,j,k) &
                              + ( &
                                epom * ( &
                                       (w0(i+1,j,k)-w0(i,j,k))    *dxi &
                                     + (u0(i+1,j,k)-u0(i+1,j,km)) *dzhi(k) &
                                     ) &
                              - emom * ( &
                                       (w0(i,j,k)-w0(i-1,j,k))    *dxi &
                                     + (u0(i,j,k)-u0(i,j,km))     *dzhi(k) &
                                       ) &
                                ) * dxi &
                              + ( &
                                eopm * ( &
                                       (w0(i,jp,k)-w0(i,j,k))     *dyi &
                                     + (v0(i,jp,k)-v0(i,jp,km))   *dzhi(k) &
                                       ) &
                               -eomm * ( &
                                       (w0(i,j,k)-w0(i,jm,k))     *dyi &
                                     + (v0(i,j,k)-v0(i,j,km))     *dzhi(k) &
                                       ) &
                                )*dyi &
                              + ( &
                                ekm(i,j,k) * (w0(i,j,kp)-w0(i,j,k)) *dzfi(k) &
                              - ekm(i,j,km)* (w0(i,j,k)-w0(i,j,km)) *dzfi(km) &
                                ) * 2. * dzhi(k)
             end do
          end do
       end do

    else ! DNS

       do k=kb+1,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 * ( &
                                        (w0(i+1,j,k)-w0(i,j,k))    *dxi &
                                      + (u0(i+1,j,k)-u0(i+1,j,km)) *dzhi(k) &
                                        ) &
                              - numol * ( &
                                        (w0(i,j,k)-w0(i-1,j,k))    *dxi &
                                      + (u0(i,j,k)-u0(i,j,km))     *dzhi(k) &
                                        ) &
                                )*dxi &
                              + ( &
                                numol * ( &
                                        (w0(i,jp,k)-w0(i,j,k))     *dyi &
                                      + (v0(i,jp,k)-v0(i,jp,km))   *dzhi(k) ) &
                              - numol * ( &
                                        (w0(i,j,k)-w0(i,jm,k))     *dyi &
                                      + (v0(i,j,k)-v0(i,j,km))     *dzhi(k) &
                                      ) &
                                )*dyi &
                              + ( &
                                numol * (w0(i,j,kp)-w0(i,j,k)) *dzfi(k) &
                              - numol * (w0(i,j,k)-w0(i,j,km)) *dzfi(km) &
                                ) * 2. * dzhi(k)
             end do
          end do
       end do

    end if

  end subroutine diffw