build_mon_fields Subroutine

private subroutine build_mon_fields(raw, nz, ltc, lpc, rhop, up, vconvp, f, w, wd)

Fill colour-field values of one model, in MON_FIELD_NAMES order.

Temperature, pressure and luminosity are running sums of their steps from centre.

Arguments

Type IntentOptional Attributes Name
type(rawset), intent(out) :: raw

Colour-field values.

integer, intent(in) :: nz

Number of cells.

real(kind=real64), intent(in) :: ltc

Central temperature, ln T.

real(kind=real64), intent(in) :: lpc

Central pressure, ln P.

real(kind=real64), intent(in) :: rhop(:)

Density of each cell.

real(kind=real64), intent(in) :: up(:)

Internal energy per gram of each cell.

real, intent(in) :: vconvp(:)

Convective velocity of each cell.

real(kind=real64), intent(in) :: f(:,:)

Steps across each cell.

Rows: luminosity (Lsun), ln T, radius (Rsun), ln P.

real, intent(in) :: w(:,:)

Seven mass fractions of each cell.

real, intent(in) :: wd(:,:)

Seven reaction rates of each cell.


Source Code

   subroutine build_mon_fields(raw, nz, ltc, lpc, rhop, up, vconvp, f, w, wd)
      !! Fill colour-field values of one model, in `MON_FIELD_NAMES` order.
      !!
      !! Temperature, pressure and luminosity are running sums of their steps from centre.
      ! Arguments
      type(rawset), intent(out) :: raw
         !! Colour-field values.
      integer, intent(in) :: nz
         !! Number of cells.
      real(real64), intent(in) :: ltc
         !! Central temperature, `ln T`.
      real(real64), intent(in) :: lpc
         !! Central pressure, `ln P`.
      real(real64), intent(in) :: rhop(:)
         !! Density of each cell.
      real(real64), intent(in) :: up(:)
         !! Internal energy per gram of each cell.
      real, intent(in) :: vconvp(:)
         !! Convective velocity of each cell.
      real(real64), intent(in) :: f(:, :)
         !! Steps across each cell.
         !!
         !! Rows: luminosity (Lsun), `ln T`, radius (Rsun), `ln P`.
      real, intent(in) :: w(:, :)
         !! Seven mass fractions of each cell.
      real, intent(in) :: wd(:, :)
         !! Seven reaction rates of each cell.

      integer :: j
      real(real64) :: lum, ln_temp, ln_pressure

      allocate (raw%v(nz, MON_NFIELDS))
      lum = 0.d0
      ln_temp = ltc
      ln_pressure = lpc
      do j = 1, nz
         lum = lum + f(1, j)
         ln_temp = ln_temp + f(2, j)
         ln_pressure = ln_pressure + f(4, j)
         raw%v(j, 1) = exp(ln_temp)
         raw%v(j, 2) = rhop(j)
         raw%v(j, 3) = exp(ln_pressure)
         raw%v(j, 4) = lum
         raw%v(j, 5:11) = real(wd(1:7, j), real64)
         raw%v(j, 12) = up(j)
         raw%v(j, 13) = real(vconvp(j), real64)
         raw%v(j, 14:20) = real(w(1:7, j), real64)
      end do
   end subroutine build_mon_fields