Trace every contour bin of colour field f into fcache.
Scale per fscale; bin 1 covers whole star, higher bins nest inward. Reuses energy band
tracer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | f |
Colour field index. |
subroutine build_field_cache(f) !! Trace every contour bin of colour field `f` into `fcache`. !! !! Scale per `fscale`; bin 1 covers whole star, higher bins nest inward. Reuses energy band !! tracer. ! Arguments integer(int32), intent(in) :: f !! Colour field index. type(tracer_t) :: tr integer(int32) :: i, n, lev, maxn, m integer(int32), allocatable :: lvals(:), lidxs(:) real(real64), allocatable :: ivlo(:), ivhi(:) associate (fc => fcache(fscale(), f)) if (allocated(fc%band)) deallocate (fc%band) fc%nlev = FIELD_NBINS allocate (fc%band(fc%nlev)) maxn = 1 do i = 1, nmodels maxn = max(maxn, field_layer_len(i, f)) end do call tracer_alloc(tr, 64_int32, nmodels) allocate (lvals(maxn), lidxs(maxn), ivlo(maxn + 1), ivhi(maxn + 1)) do lev = 1, fc%nlev call tracer_reset(tr) do i = 1, nmodels call get_field_buf(i, f, lvals, lidxs, n) call level_intervals(i, lvals, lidxs, n, lev, ivlo, ivhi, m) call tracer_step(tr, fc%band(lev), i, ivlo, ivhi, m) end do call tracer_flush(tr, fc%band(lev)) end do deallocate (lvals, lidxs, ivlo, ivhi) call tracer_dealloc(tr) fc%valid = .true. end associate end subroutine build_field_cache