layers Module

Data layers and band caches traced from them.

A "layer" is a per-model quantity traced into bands: convection types (yzip zones), energy layers (signed integer contour levels, positive gain, negative loss; 0 nuclear generation, 1 nuclear loss, 2 neutrinos) or colour fields (columns in FIELD_NBINS bins, registered in convdata.f90). Caches traced on first use; cache_invalidate drops them on load and axis rebuild.



Variables

Type Visibility Attributes Name Initial
type(bandset_t), public :: conv_bands(NCONVTYPES)

Bands of each convection type, indexed by type_of codes.

type(chainset_t), public :: conv_chains(NCONVTYPES)

Exact region outline of each convection type.

logical, public :: conv_valid = .false.

conv_bands and conv_chains are traced.

type(ecache_t), public :: ecache(0:2)

Band cache of each energy layer.

Traced on first use, so color switches do not retrace.

type(fcache_t), public, allocatable :: fcache(:,:)

Band cache of each colour field, (scale, field) as in convdata%fld.

Traced on first use of each field and scale.


Derived Types

type, private ::  ecache_t

Band cache of one energy layer.

Read more…

Components

Type Visibility Attributes Name Initial
logical, public :: valid = .false.

Bands traced.

integer(kind=int32), public :: gmax = 0

Highest gain and loss levels, loss as positive number.

integer(kind=int32), public :: lmax = 0

Highest gain and loss levels, loss as positive number.

type(bandset_t), public, allocatable :: gain(:)

Bands of each gain level, gain(1:gmax), and each loss level, loss(1:lmax).

type(bandset_t), public, allocatable :: loss(:)

Bands of each gain level, gain(1:gmax), and each loss level, loss(1:lmax).

type, private ::  fcache_t

Band cache of one colour field on one scale.

Read more…

Components

Type Visibility Attributes Name Initial
logical, public :: valid = .false.

Bands traced.

integer(kind=int32), public :: nlev = 0

Number of contour bins.

type(bandset_t), public, allocatable :: band(:)

Bands of each bin, band(1:nlev).


Functions

public pure function type_of(ch) result(t)

Return convection-type code of zone character.

Read more…

Arguments

Type IntentOptional Attributes Name
character(len=1), intent(in) :: ch

Zone character from yzip.

Return Value integer(kind=int32)

public pure function layer_of_cfield() result(layer)

Return energy layer named by st%cfield, or -1 if not an energy layer.

Read more…

Arguments

None

Return Value integer(kind=int32)

public pure function field_of_cfield() result(f)

Return colour field named by st%cfield, 1..nfields, or 0.

Read more…

Arguments

None

Return Value integer(kind=int32)

private pure function first_field(names) result(f)

Return index of first registered name in names, or 0.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: names(:)

Canonical field names, in order of preference.

Return Value integer(kind=int32)

public pure function field_layer_len(i, f) result(n)

Return step-function entry count of colour field f in model i.

Read more…

Arguments

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

Model index.

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

Colour field index.

Return Value integer(kind=int32)

public pure function fscale()

Return colour-field scale index: 1 default, 2 flipped by st%cflip.

Arguments

None

Return Value integer(kind=int32)

private pure function layer_len(i, layer) result(n)

Return step-function entry count of energy layer in model i.

Read more…

Arguments

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

Model index.

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

Energy layer, 0 to 2.

Return Value integer(kind=int32)


Subroutines

public subroutine get_field_buf(i, f, vals, idxs, n)

Copy step function of colour field f in model i into buffers.

Read more…

Arguments

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

Model index.

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

Colour field index.

integer(kind=int32), intent(out) :: vals(:)

Contour bin of each entry, at least n long.

integer(kind=int32), intent(out) :: idxs(:)

Coordinate index where each entry starts, at least n long.

integer(kind=int32), intent(out) :: n

Number of entries copied.

public subroutine level_mins(layer, gmin, lmin)

Return minimum log10 gain and loss levels of energy layer.

Read more…

Arguments

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

Energy layer, 0 to 2.

integer(kind=int32), intent(out) :: gmin

log10 of lowest gain level.

integer(kind=int32), intent(out) :: lmin

log10 of lowest loss level.

public subroutine get_layer(i, layer, vals, idxs, n)

Copy step function of energy layer in model i into new arrays.

Arguments

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

Model index.

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

Energy layer, 0 to 2.

integer(kind=int32), intent(out), allocatable :: vals(:)

Signed contour level of each entry.

integer(kind=int32), intent(out), allocatable :: idxs(:)

Coordinate index where each entry starts.

integer(kind=int32), intent(out) :: n

Number of entries.

private subroutine get_layer_buf(i, layer, vals, idxs, n)

Copy step function of energy layer in model i into buffers.

Read more…

Arguments

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

Model index.

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

Energy layer, 0 to 2.

integer(kind=int32), intent(out) :: vals(:)

Signed contour level of each entry, at least n long.

integer(kind=int32), intent(out) :: idxs(:)

Coordinate index where each entry starts, at least n long.

integer(kind=int32), intent(out) :: n

Number of entries copied.

private subroutine scan_levels(layer, gmax, lmax)

Find highest gain and loss levels of energy layer over all models.

Arguments

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

Energy layer, 0 to 2.

integer(kind=int32), intent(out) :: gmax

Highest positive level, or 0.

integer(kind=int32), intent(out) :: lmax

Magnitude of most negative level, or 0.

private subroutine level_intervals(i, vals, idxs, n, L, ivlo, ivhi, m)

Find intervals of model i where step function reaches level L.

Read more…

Arguments

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

Model index.

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

Level of each step-function entry.

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

Coordinate index where each entry starts.

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

Number of entries.

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

Contour level, nonzero.

real(kind=real64), intent(out) :: ivlo(:)

Lower mass (g) or radius (cm) of each interval, at least n long.

real(kind=real64), intent(out) :: ivhi(:)

Upper mass (g) or radius (cm) of each interval, at least n long.

integer(kind=int32), intent(out) :: m

Number of intervals.

public subroutine build_conv_cache()

Trace all five convection types into conv_bands and conv_chains.

Read more…

Arguments

None

public subroutine build_energy_cache(layer)

Trace every gain and loss level of energy layer into ecache(layer).

Arguments

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

Energy layer, 0 to 2.

public subroutine build_field_cache(f)

Trace every contour bin of colour field f into fcache.

Read more…

Arguments

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

Colour field index.

public subroutine cache_invalidate()

Drop every cached band, on file load or axis rebuild.

Arguments

None