module immersed_vessel_m !! Immersed boundary module, based on vessel function from equilibrium use precision_m, only : FP use immersed_m, only : immersed_t use equilibrium_m, only : equilibrium_t use mesh_cart_m, only : mesh_cart_t implicit none type, public, extends(immersed_t) :: immersed_vessel_t !! Immersed boundary type based on vessel contains procedure, public :: init procedure, public :: display final :: destructor_immersed_vessel_t end type contains subroutine init(self, equi, mesh, filename) class(immersed_vessel_t), intent(inout) :: self class(equilibrium_t), intent(inout) :: equi type(mesh_cart_t), intent(in) :: mesh character(len=*), intent(in), optional :: filename integer :: l real(FP) :: x, y, phi phi = mesh%get_phi() ! Allocate fields allocate(self%charfun(mesh%get_n_points())) allocate(self%dirindfun(mesh%get_n_points())) !$omp parallel default(none) private(l, x, y) & !$omp shared(self, mesh, equi, phi) !$omp do do l = 1, mesh%get_n_points() x = mesh%get_x(l) y = mesh%get_y(l) if (equi%in_vessel(x, y, phi)) then self%charfun(l) = 0.0_FP else self%charfun(l) = 1.0_FP endif ! Set dirindfun to 0 self%dirindfun(l) = 0.0_FP enddo !$omp end do !$omp end parallel ! Build inds and adj_inds call self%build_inds(mesh) call self%build_adj_inds(mesh) end subroutine subroutine display(self) class(immersed_vessel_t), intent(in) :: self ! No parameters to display end subroutine subroutine destructor_immersed_vessel_t(self) !! Destructor for immersed_vessel_t type(immersed_vessel_t), intent(inout) :: self if (allocated(self%charfun)) deallocate(self%charfun) if (allocated(self%dirindfun)) deallocate(self%dirindfun) if (allocated(self%inds)) deallocate(self%inds) if (allocated(self%adj_inds)) deallocate(self%adj_inds) end subroutine end module