Append record of one model's accumulated cells to recs.
Cells reversed from surface-to-centre (as read) to centre-to-surface; recs grows by
GROW_FAC when full; out-of-range or empty models produce nothing.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(convtype), | intent(inout), | allocatable | :: | recs(:) |
Records built so far, in stream order. |
|
| integer(kind=int32), | intent(inout) | :: | ndata |
Number of records in |
||
| integer(kind=int32), | intent(inout) | :: | ncap |
Capacity of |
||
| integer(kind=int32), | intent(in) | :: | model |
Model number. |
||
| integer(kind=int32), | intent(in) | :: | nz |
Number of cells. |
||
| real(kind=real64), | intent(in) | :: | tsec |
Age (s). |
||
| real(kind=real64), | intent(in) | :: | dtsec |
Time step (s). |
||
| real(kind=real64), | intent(in) | :: | am(:) |
Mass coordinate of each cell (g), surface to centre. |
||
| real(kind=real64), | intent(in) | :: | ar(:) |
Radius coordinate of each cell (cm), surface to centre. |
||
| integer(kind=int32), | intent(in) | :: | amt(:) |
MESA mixing code of each cell, surface to centre. |
||
| real(kind=real64), | intent(in) | :: | ae(:) |
Energy rate of each cell (erg/g/s), surface to centre. |
||
| integer(kind=int32), | intent(in) | :: | ifirst |
First model number to load. |
||
| integer(kind=int32), | intent(in) | :: | ilast |
Last model number to load. |
subroutine flush_kipp(recs, ndata, ncap, model, nz, tsec, dtsec, & am, ar, amt, ae, ifirst, ilast) !! Append record of one model's accumulated cells to `recs`. !! !! Cells reversed from surface-to-centre (as read) to centre-to-surface; `recs` grows by !! `GROW_FAC` when full; out-of-range or empty models produce nothing. ! Arguments type(convtype), allocatable, intent(inout) :: recs(:) !! Records built so far, in stream order. integer(int32), intent(inout) :: ndata !! Number of records in `recs`. integer(int32), intent(inout) :: ncap !! Capacity of `recs`. integer(int32), intent(in) :: model !! Model number. integer(int32), intent(in) :: nz !! Number of cells. integer(int32), intent(in) :: ifirst !! First model number to load. integer(int32), intent(in) :: ilast !! Last model number to load. real(real64), intent(in) :: tsec !! Age (s). real(real64), intent(in) :: dtsec !! Time step (s). real(real64), intent(in) :: am(:) !! Mass coordinate of each cell (g), surface to centre. real(real64), intent(in) :: ar(:) !! Radius coordinate of each cell (cm), surface to centre. real(real64), intent(in) :: ae(:) !! Energy rate of each cell (erg/g/s), surface to centre. integer(int32), intent(in) :: amt(:) !! MESA mixing code of each cell, surface to centre. type(convtype), allocatable :: tmp(:) real(real64), allocatable :: xm(:), rn(:), eps(:) integer(int32), allocatable :: mt(:) integer(int32) :: k, src if (nz < 1) return if (model < ifirst .or. model > ilast) return ndata = ndata + 1 if (ndata > ncap) then ncap = int(ncap*GROW_FAC) allocate (tmp(ncap)) tmp(1:ndata - 1) = recs(1:ndata - 1) deallocate (recs) call move_alloc(tmp, recs) end if ! reverse to the center -> surface ascending order the renderer expects allocate (xm(nz), rn(nz), eps(nz), mt(nz)) do k = 1, nz src = nz - k + 1 xm(k) = am(src) rn(k) = ar(src) eps(k) = ae(src) mt(k) = amt(src) end do call build_kipp_record(recs(ndata), model, nz, tsec, dtsec, xm, rn, mt, eps) deallocate (xm, rn, eps, mt) end subroutine flush_kipp