Impose boundary conditions.
The boundary conditions are imposed on the primitive variables by means of the ghost cells approach.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(euler_1D_openmp), | intent(in) | :: | self | Euler field. |
||
real(kind=R_P), | intent(inout) | :: | primitive(1:self%Np,1-self%Ng:self%Ni+self%Ng) | Primitive variables [1:Np,1-Ng:Ni+Ng]. |
pure subroutine impose_boundary_conditions(self, primitive)
!--------------------------------------------------------------------------------------------------------------------------------
!< Impose boundary conditions.
!<
!< The boundary conditions are imposed on the primitive variables by means of the ghost cells approach.
!--------------------------------------------------------------------------------------------------------------------------------
class(euler_1D_openmp), intent(IN) :: self !< Euler field.
real(R_P), intent(INOUT) :: primitive(1:self%Np,1-self%Ng:self%Ni+self%Ng) !< Primitive variables [1:Np,1-Ng:Ni+Ng].
integer(I_P) :: i !< Space counter.
!--------------------------------------------------------------------------------------------------------------------------------
!--------------------------------------------------------------------------------------------------------------------------------
select case(trim(adjustl(self%BC_L)))
case('TRA') ! trasmissive (non reflective) BC
do i=1-self%Ng, 0
primitive(:, i) = primitive(:, -i+1)
enddo
case('REF') ! reflective BC
do i=1-self%Ng, 0
primitive(:, i) = primitive(:, -i+1) ! all variables
primitive(self%Ns + 1, i) = -primitive(self%Ns + 1, -i+1) ! only velocity
enddo
endselect
select case(trim(adjustl(self%BC_R)))
case('TRA') ! trasmissive (non reflective) BC
do i=self%Ni+1, self%Ni+self%Ng
primitive(:, i) = primitive(:, self%Ni-(i-self%Ni-1))
enddo
case('REF') ! reflective BC
do i=self%Ni+1, self%Ni+self%Ng
primitive(:, i) = primitive(:, self%Ni-(i-self%Ni-1)) ! all variables
primitive(self%Ns + 1, i) = -primitive(self%Ns + 1, self%Ni-(i-self%Ni-1)) ! only velocity
enddo
endselect
return
!--------------------------------------------------------------------------------------------------------------------------------
endsubroutine impose_boundary_conditions