copy1 Subroutine

public subroutine copy1(var, type, face, dims)

Copy 1 layer of interior cell to first ghost cell layer

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(inout), dimension(-2:dims%imx+2, -2:dims%jmx+2, -2:dims%kmx+2):: var

Varible over which these operation has to be performed

character(len=*), intent(in) :: type

Type of copy: flat, symmetry, anti-symmetry

character(len=*), intent(in) :: face

Face over which boundary condition is being called

type(extent), intent(in) :: dims

Contents

Source Code


Source Code

    subroutine copy1(var, type, face, dims)
      !< Copy 1 layer of interior cell to first ghost cell layer
      implicit none
      type(extent), intent(in) :: dims
      character(len=*), intent(in) :: face
      !< Face over which boundary condition is being called
      character(len=*), intent(in) :: type
      !< Type of copy: flat, symmetry, anti-symmetry
      real(wp), dimension(-2:dims%imx+2, -2:dims%jmx+2, -2:dims%kmx+2), intent(inout) :: var
      !< Varible over which these operation has to be performed
      real(wp) :: a2=1
      integer :: imx, jmx, kmx
      imx = dims%imx
      jmx = dims%jmx
      kmx = dims%kmx

      select case(type)
        case("anti")
          a2 = -1
        case("symm")
          a2 =  1
        case DEFAULT
          print*, "ERROR: Wrong boundary condition type"
      end select

      select case(face)
        case("imin")
            var(      0, 1:jmx-1, 1:kmx-1) = a2*var(     1, 1:jmx-1, 1:kmx-1)
        case("imax")
            var(  imx  , 1:jmx-1, 1:kmx-1) = a2*var( imx-1, 1:jmx-1, 1:kmx-1)
        case("jmin")
            var(1:imx-1,       0, 1:kmx-1) = a2*var(1:imx-1,      1, 1:kmx-1)
        case("jmax")
            var(1:imx-1,   jmx  , 1:kmx-1) = a2*var(1:imx-1,  jmx-1, 1:kmx-1)
        case("kmin")
            var(1:imx-1, 1:jmx-1,       0) = a2*var(1:imx-1, 1:jmx-1,      1)
        case("kmax")
            var(1:imx-1, 1:jmx-1,   kmx  ) = a2*var(1:imx-1, 1:jmx-1,  kmx-1)
        case DEFAULT
          print*, "ERROR: wrong face for boundary condition"
      end select
    end subroutine copy1