Subroutine to apply boundary conditions on a FE_FILM
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(FE_FILM), | intent(inout) | :: | fe_f | FE film data type |
||
real(kind=R8), | intent(in), | dimension(MAX_NNC) | :: | bc | boundary conditions at the corners |
subroutine apply_bc_FE_film(fe_f, bc)
implicit none
type(FE_FILM), intent(inout) :: fe_f !! *FE film data type*
real(kind=R8), intent(in ), dimension(MAX_NNC) :: bc !! *boundary conditions at the corners*
integer(kind=I4) :: e, i, ind, ind_var
logical(kind=I4) :: mixture
real(kind=R8) :: v, v1, v2, x1, x2, y1, y2, l, d
mixture = (fe_f%data_f%fl%fluid_type == MIXT)
! case of hd problem: unknown is p
if (fe_f%data_f%pb_type == HD) ind_var = P_N
! copy of the bc values on the node values
do i = 1, fe_f%m%nc
fe_f%vn(fe_f%m%cor(i),ind_var) = fe_f%vn(fe_f%m%cor(i),ind_var) + bc(i)
enddo
! loop on edges
if (mixture) then
v1 = bc(1)/fe_f%vn(fe_f%m%cor(1), ind_var)
else
v1 = bc(1)
endif
x1 = fe_f%m%x(fe_f%m%cor(1))
y1 = fe_f%m%y(fe_f%m%cor(1))
do e = fe_f%m%ned, 1, -1
v2 = v1
x2 = x1
y2 = y1
if (mixture) then
v1 = bc(e)/fe_f%vn(fe_f%m%cor(e),ind_var)
else
v1 = bc(e)
endif
x1 = fe_f%m%x(fe_f%m%cor(e))
y1 = fe_f%m%y(fe_f%m%cor(e))
! length of the edge
l = ((x2 - x1)**2 + (y2 - y1) ** 2) ** 0.5_R8
do i = 2, fe_f%m%ed(e)%n - 1
ind = fe_f%m%ed(e)%nm(i)
! distance to point 2
d = ((x2 - fe_f%m%x(ind))**2 + (y2 - fe_f%m%y(ind)) ** 2) ** 0.5_R8
d = d / l
v = d * v1 + (1._R8 - d) * v2
! linear distribution along the edge
if (mixture) then
fe_f%vn(ind, ind_var) = exp( log(fe_f%vn(ind, ind_var)) + v)
else
fe_f%vn(ind, ind_var) = fe_f%vn(ind, ind_var) + v
endif
enddo
do i = 1, fe_f%m%ed(e)%n
ind = fe_f%m%ed(e)%nm(i)
! boundary nodes are set as imposed
fe_f%bc(ind, REY) = 0
enddo
enddo
return
endsubroutine apply_bc_FE_film