boundary_edge Subroutine

public subroutine boundary_edge(bplane, bedge, nb)

Returns 3 x nb array containing points along the BoundedPlane's boundary edge

Arguments

TypeIntentOptionalAttributesName
type(BoundedPlane), intent(in) :: bplane

Bounded plane

real(kind=Float64), intent(out), dimension(:,:):: bedge

Boundary edge points of bounded plane

integer, intent(out) :: nb

Number of points in boundary edge


Called by

proc~~boundary_edge~~CalledByGraph proc~boundary_edge boundary_edge proc~gyro_range gyro_range proc~gyro_range->proc~boundary_edge proc~npa_gyro_range npa_gyro_range proc~npa_gyro_range->proc~gyro_range proc~npa_f npa_f proc~npa_f->proc~npa_gyro_range proc~pnpa_f pnpa_f proc~pnpa_f->proc~npa_gyro_range proc~npa_mc npa_mc proc~npa_mc->proc~npa_gyro_range proc~pnpa_mc pnpa_mc proc~pnpa_mc->proc~npa_gyro_range program~fidasim fidasim program~fidasim->proc~npa_f program~fidasim->proc~pnpa_f program~fidasim->proc~npa_mc program~fidasim->proc~pnpa_mc

Contents

Source Code


Source Code

subroutine boundary_edge(bplane, bedge, nb)
    !+ Returns 3 x `nb` array containing points along the BoundedPlane's boundary edge
    type(BoundedPlane), intent(in)             :: bplane
        !+ Bounded plane
    real(Float64), dimension(:,:), intent(out) :: bedge
        !+ Boundary edge points of bounded plane
    integer, intent(out)                       :: nb
        !+ Number of points in boundary edge

    integer :: i
    real(Float64) :: th, dth, x, y
    real(Float64), dimension(4) :: xx, yy

    select case (bplane%shape)
        case (1) !Rectangular boundary
            nb = 4
            if(nb.gt.size(bedge,2)) then
                if(inputs%verbose.ge.0) then
                    write(*,'("BOUNDARY_EDGE: Incompatible boundary edge array : ",i2," > ",i2)') nb, size(bedge,2)
                endif
                stop
            endif
            xx = [-bplane%hw,-bplane%hw,bplane%hw,bplane%hw]
            yy = [-bplane%hh,bplane%hh,bplane%hh,-bplane%hh]
            do i=1,nb
                bedge(:,i) = matmul(bplane%basis,[xx(i),yy(i),0.d0]) + bplane%origin
            enddo
        case (2)
            nb = 50
            if(nb.gt.size(bedge,2)) then
                if(inputs%verbose.ge.0) then
                    write(*,'("BOUNDARY_EDGE: Incompatible boundary edge array : ",i2," > ",i2)') nb, size(bedge,2)
                endif
                stop
            endif
            dth = 2*pi/nb
            do i=1,nb
                th = i*dth
                x = bplane%hw*cos(th)
                y = bplane%hh*sin(th)
                bedge(:,i) = matmul(bplane%basis,[x,y,0.d0]) + bplane%origin
            enddo
        case default
            if(inputs%verbose.ge.0) then
                write(*,'("BOUNDARY_EDGE: Unknown boundary shape: ",i2)') bplane%shape
            endif
            stop
    end select

end subroutine boundary_edge