Generalized subroutine to fix particular value at particular face
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(out), | dimension(-2:imx+2, -2:jmx+2, -2:kmx+2) | :: | var | Variable of which values are being fixed in the ghost cell |
|
real(kind=wp), | intent(in), | dimension(1:6) | :: | fix_val | Amount of value that need to be fixed. |
|
character(len=*), | intent(in) | :: | face | Name of the face at which boundary condition is called |
subroutine fix(var, fix_val, face)
!< Generalized subroutine to fix particular value
!< at particular face
implicit none
real(wp), dimension(-2:imx+2, -2:jmx+2, -2:kmx+2) , intent(out) :: var
!< Variable of which values are being fixed in the ghost cell
real(wp), dimension(1:6) , intent(in) :: fix_val
!< Amount of value that need to be fixed.
character(len=*) , intent(in) :: face
!< Name of the face at which boundary condition is called
select case(face)
case("imin")
var( 0, 1:jmx-1, 1:kmx-1) = fix_val(1)
var( -1, 1:jmx-1, 1:kmx-1) = fix_val(1)
var( -2, 1:jmx-1, 1:kmx-1) = fix_val(1)
case("imax")
var( imx , 1:jmx-1, 1:kmx-1) = fix_val(2)
var( imx+1, 1:jmx-1, 1:kmx-1) = fix_val(2)
var( imx+2, 1:jmx-1, 1:kmx-1) = fix_val(2)
case("jmin")
var(1:imx-1, 0, 1:kmx-1) = fix_val(3)
var(1:imx-1, -1, 1:kmx-1) = fix_val(3)
var(1:imx-1, -2, 1:kmx-1) = fix_val(3)
case("jmax")
var(1:imx-1, jmx , 1:kmx-1) = fix_val(4)
var(1:imx-1, jmx+1, 1:kmx-1) = fix_val(4)
var(1:imx-1, jmx+2, 1:kmx-1) = fix_val(4)
case("kmin")
var(1:imx-1, 1:jmx-1, 0) = fix_val(5)
var(1:imx-1, 1:jmx-1, -1) = fix_val(5)
var(1:imx-1, 1:jmx-1, -2) = fix_val(5)
case("kmax")
var(1:imx-1, 1:jmx-1, kmx ) = fix_val(6)
var(1:imx-1, 1:jmx-1, kmx+1) = fix_val(6)
var(1:imx-1, 1:jmx-1, kmx+2) = fix_val(6)
case DEFAULT
!print*, "ERROR: wrong face for boundary condition"
Fatal_error
end select
end subroutine fix