mbound Function

public pure function mbound(i, k) result(c)

Return cgs mass or radius of convection boundary k of model i.

Boundary 0 is inner grid edge; k > 0 lies midway between coords iconv(k) and iconv(k) + 1, taken in r^3 on radius axis so it halves shell volume.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: i

Model index; boundary index, 0..nconv.

integer(kind=int32), intent(in) :: k

Model index; boundary index, 0..nconv.

Return Value real(kind=real64)


Source Code

   pure function mbound(i, k) result(c)
      !! Return cgs mass or radius of convection boundary `k` of model `i`.
      !!
      !! Boundary 0 is inner grid edge; `k > 0` lies midway between coords `iconv(k)` and
      !! `iconv(k) + 1`, taken in r^3 on radius axis so it halves shell volume.
      ! Arguments
      integer(int32), intent(in) :: i, k
         !! Model index; boundary index, `0..nconv`.
      real(real64) :: c
      integer(int32) :: ic, nc
      nc = data(i)%ncoord
      if (st%yaxis == 'radius') then
         if (k == 0) then
            c = data(i)%rncoord(1)
         else
            ic = data(i)%iconv(k)
            c = (0.5d0*(data(i)%rncoord(ic)**3 + &
                        data(i)%rncoord(min(ic + 1, nc))**3))**(1.d0/3.d0)
         end if
      else
         if (k == 0) then
            c = data(i)%xmcoord(1)
         else
            ic = data(i)%iconv(k)
            c = 0.5d0*(data(i)%xmcoord(ic) + data(i)%xmcoord(min(ic + 1, nc)))
         end if
      end if
   end function mbound