convbuild Module

Record builders shared by profile readers (mesaload.f90, monload.f90).

Energy and field quantization, colour-field registry, zone run-length compression; re-exports units.f90 constants. Depends only on convdata, typedef and units, so either reader uses it w/o a module cycle.



Variables

Type Visibility Attributes Name Initial
real(kind=real64), public, parameter :: GROW_FAC = 0.5d0*(sqrt(5.d0)+1.d0)

Growth factor of a reader's full record array, golden ratio.

integer(kind=int32), public, parameter :: EPS_BASE = 1

Energy level floor, log10 of erg/g/s.

level_of maps it to level 1; readers store it as a record's first six level floors.

integer(kind=int32), public, parameter :: REC_NVERS = 10600

Record version readers build.


Functions

private pure function level_of(f) result(lev)

Return signed integer contour level of energy rate.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: f

Energy rate (erg/g/s).

Return Value integer(kind=int32)

private pure function field_level(v, f, logscale) result(lev)

Return contour bin (1 to FIELD_NBINS) of value in range of field f.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: v

Value to bin.

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

Field index in registry.

logical, intent(in) :: logscale

Bin in log10, not linearly.

Return Value integer(kind=int32)


Subroutines

public subroutine build_zones(zones, nz, cnv)

Run-length compress cell zone types into yzip and iconv.

Read more…

Arguments

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

ZONE_CHAR type of each cell, centre to surface, already mapped from reader's codes.

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

Number of cells.

type(convtype), intent(inout) :: cnv

Record receiving nconv, yzip, iconv.

public subroutine build_energy(f, nz, n, vals, idxs)

Quantize per-cell energy rate into energy-layer step function.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: f(:)

Energy rate of each cell (erg/g/s), centre to surface.

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

Number of cells.

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

Number of pairs.

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

Level of each pair.

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

Coordinate index where each pair starts.

public subroutine reset_field_registry(nf)

Allocate convdata.f90 colour-field registry for nf fields.

Read more…

Arguments

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

Number of fields.

public subroutine update_field_range(f, v)

Widen running range of field f w/ one sample.

Read more…

Arguments

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

Field index in registry.

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

Sample value.

public subroutine finalize_field_log(f)

Choose default binning of field f once its range is known.

Read more…

Arguments

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

Field index in registry.

public subroutine build_field_layer(raw, nz, f, out)

Run-length compress per-cell field into two (level, coordinate index) step functions.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in) :: raw(:)

Field value of each cell, centre to surface.

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

Number of cells.

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

Field index in registry.

type(fieldlayer), intent(out) :: out(2)

Step functions in default and other scale.

public subroutine alloc_empty_layers(cnv)

Allocate layers and arrays profile readers leave unfilled, at size zero.

Read more…

Arguments

Type IntentOptional Attributes Name
type(convtype), intent(inout) :: cnv

Record to complete.