MESA profile and .kipp readers, and dispatcher over every input format.
load_convection picks reader from path ("Input formats", docs/formats.md); every reader
fills convdata%data w/ one .cnv-layout record per model. Non-structural source columns
(every named .kipp column, a curated MESA set) register as colour fields, binned into
FIELD_NBINS levels over whole-sequence range.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | cnv_loaded | = | .false. |
Last load went through |
|
| character(len=4), | public | :: | kipp_axis_units(3) | = | '' |
Units a Indexed by |
|
| integer(kind=int32), | private, | parameter | :: | MESA_MAX_THREADS | = | 4 |
Cap on profile-read thread pool. Parsing is memory-bandwidth bound, peaking around 3 to 4 threads; a lower |
| integer(kind=int32), | private, | parameter | :: | MESA_NO_MIXING | = | 0 |
MESA Mixing codes named as in MESA r26.04.1 const/public/const_def.f90. |
| integer(kind=int32), | private, | parameter | :: | MESA_CONVECTIVE_MIXING | = | 1 |
MESA |
| integer(kind=int32), | private, | parameter | :: | MESA_OVERSHOOT_MIXING | = | 2 |
MESA |
| integer(kind=int32), | private, | parameter | :: | MESA_SEMICONVECTIVE_MIXING | = | 3 |
MESA |
| integer(kind=int32), | private, | parameter | :: | MESA_THERMOHALINE_MIXING | = | 4 |
MESA |
| integer(kind=int32), | private, | parameter | :: | MESA_ROTATION_MIXING | = | 5 |
MESA |
| integer(kind=int32), | private, | parameter | :: | MESA_LEFTOVER_CONVECTIVE_MIXING | = | 9 |
MESA |
| integer(kind=int32), | private, | parameter | :: | MESA_NCAND | = | 9 |
Number of curated MESA colour-field columns. |
| character(len=16), | private, | parameter | :: | MESA_FIELD_CAND(MESA_NCAND) | = | [character(len=16)::'logT', 'logRho', 'logL', 'luminosity', 'logP', 'pressure', 'opacity', 'entropy', 'velocity'] |
Curated MESA profile body columns offered as colour fields. Only these scalars are read, since full body is huge; names absent from a run are skipped. |
Colour-field values of one profile, held between parallel read and serial binning.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=real64), | public, | allocatable | :: | v(:,:) |
Value per cell (rows, centre to surface) and field (columns). |
Return third blank-separated word of header line, blank if none.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
Header line. |
Test whether .kipp column is structural, so not offered as colour field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
Column name. |
Test whether s ends with suf.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s |
String to test. |
||
| character(len=*), | intent(in) | :: | suf |
Suffix. |
Return ZONE_CHAR type of MESA mixing code ("Required columns", docs/kippfiles.md).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | m |
MESA mixing code. |
Return 1-based position of whitespace-separated token equal to name, or -1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | line |
Line of column names. |
||
| character(len=*), | intent(in) | :: | name |
Column name to find. |
Return left-justified decimal string of non-negative integer.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | n |
Integer to write. |
Load any supported input into data, reader picked from path.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
Input path. |
||
| integer(kind=int32), | intent(in) | :: | ifirst |
First model number to load. |
||
| integer(kind=int32), | intent(in) | :: | ilast |
Last model number to load. |
Load profiles of MESA run directory into data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | dirname |
Path of MESA run directory. |
||
| integer(kind=int32), | intent(in) | :: | ifirst |
First model number to load. |
||
| integer(kind=int32), | intent(in) | :: | ilast |
Last model number to load. |
Register curated colour fields present in a run.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | dirname |
Path of MESA run directory. |
||
| integer(kind=int32), | intent(in) | :: | pnum |
Profile number whose body header is read. |
||
| integer(kind=int32), | intent(out), | allocatable | :: | fld_col(:) |
Body column of each registered field. |
|
| integer(kind=int32), | intent(out) | :: | nf |
Number of registered fields. |
Stream raw .kipp cell file into data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
Path of |
||
| integer(kind=int32), | intent(in) | :: | ifirst |
First model number to load. |
||
| integer(kind=int32), | intent(in) | :: | ilast |
Last model number to load. |
Re-read .kipp file and bin each registered field into recs(k)%fld.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
Path of |
||
| integer(kind=int32), | intent(in) | :: | ncols |
Number of values per cell. |
||
| integer(kind=int32), | intent(in) | :: | c_model |
Column of model number. |
||
| integer(kind=int32), | intent(in) | :: | fld_col(:) |
Column of each registered field. |
||
| integer(kind=int32), | intent(in) | :: | nf |
Number of registered fields. |
||
| type(convtype), | intent(inout) | :: | recs(:) |
Records of pass one, in stream order. |
||
| integer(kind=int32), | intent(in) | :: | ndata |
Number of records pass one built. |
||
| integer(kind=int32), | intent(in) | :: | ifirst |
First model number to load. |
||
| integer(kind=int32), | intent(in) | :: | ilast |
Last model number to load. |
Bin one model's accumulated field values into its record's fld layers.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(convtype), | intent(inout) | :: | recs(:) |
Records of pass one, in stream order. |
||
| integer(kind=int32), | intent(inout) | :: | counter |
Index of last filled record, advanced by one when model is kept. |
||
| integer(kind=int32), | intent(in) | :: | model |
Model number. |
||
| integer(kind=int32), | intent(in) | :: | nz |
Number of cells. |
||
| real(kind=real64), | intent(in) | :: | fb(:,:) |
Value of each field (rows) and cell (columns, surface to centre). |
||
| integer(kind=int32), | intent(in) | :: | nf |
Number of registered fields. |
||
| integer(kind=int32), | intent(in) | :: | ifirst |
First model number to load. |
||
| integer(kind=int32), | intent(in) | :: | ilast |
Last model number to load. |
Double cell capacity of field accumulation buffer, keeping contents.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(inout), | allocatable | :: | fb(:,:) |
Value of each field (rows) and cell (columns). |
|
| integer(kind=int32), | intent(inout) | :: | zcap |
Cell capacity, doubled. |
Read every column name and optional unit of a .kipp sidecar header, in column order.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | hdrfile |
Path of sidecar header. |
||
| integer(kind=int32), | intent(out) | :: | ncols |
Number of columns, from |
||
| character(len=32), | intent(out), | allocatable | :: | names(:) |
Name of each column, blank if unnamed. |
|
| character(len=32), | intent(out), | allocatable | :: | colunits(:) |
Unit of each column, blank if none stated. |
Find cgs factor of a .kipp age, time step, mass or radius column.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | col |
Column name, for the error message. |
||
| character(len=*), | intent(in) | :: | tok |
Unit the header states, blank if none. |
||
| integer(kind=int32), | intent(in) | :: | dm |
Dimension code of column, a |
||
| real(kind=real64), | intent(in) | :: | def |
Factor of unit column name implies. |
||
| real(kind=real64), | intent(out) | :: | fac |
Factor to cgs. |
||
| character(len=*), | intent(out) | :: | unit |
|
Register every named non-structural .kipp column as a colour field.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | names(:) |
Name of each column, blank if unnamed. |
||
| character(len=*), | intent(in) | :: | colunits(:) |
Unit of each column, blank if none. |
||
| integer(kind=int32), | intent(in) | :: | ncols |
Number of columns. |
||
| integer(kind=int32), | intent(out), | allocatable | :: | fld_col(:) |
Source column of each registered field. |
|
| integer(kind=int32), | intent(out) | :: | nf |
Number of registered fields. |
Append record of one model's accumulated cells to recs.
| 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. |
Build record of one .kipp model.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(convtype), | intent(out) | :: | cnv |
Record to build. |
||
| 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) | :: | xm(:) |
Mass coordinate of each cell (g), centre to surface. |
||
| real(kind=real64), | intent(in) | :: | rn(:) |
Radius coordinate of each cell (cm), centre to surface. |
||
| integer(kind=int32), | intent(in) | :: | mt(:) |
MESA mixing code of each cell, centre to surface. |
||
| real(kind=real64), | intent(in) | :: | eps(:) |
Net energy rate of each cell (erg/g/s), centre to surface. |
Double cell accumulation buffers of loadkipp, keeping contents.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(inout), | allocatable | :: | am(:) |
Mass coordinate of each cell. |
|
| real(kind=real64), | intent(inout), | allocatable | :: | ar(:) |
Radius coordinate of each cell. |
|
| real(kind=real64), | intent(inout), | allocatable | :: | ae(:) |
Energy rate of each cell. |
|
| integer(kind=int32), | intent(inout), | allocatable | :: | amt(:) |
Mixing code of each cell. |
|
| integer(kind=int32), | intent(inout) | :: | zcap |
Cell capacity, doubled. |
Locate sidecar header of .kipp file ("Header file", docs/kippfiles.md).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
Path of |
||
| character(len=*), | intent(out) | :: | hdrfile |
Path of header. |
Read ncols and required-role columns from .kipp sidecar header.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | hdrfile |
Path of sidecar header. |
||
| integer(kind=int32), | intent(out) | :: | ncols |
Number of values per cell. |
||
| integer(kind=int32), | intent(out) | :: | c_model |
Column of model number. |
||
| integer(kind=int32), | intent(out) | :: | c_age |
Column of age. |
||
| integer(kind=int32), | intent(out) | :: | c_dt |
Column of time step, 0 if absent. |
||
| integer(kind=int32), | intent(out) | :: | c_mass |
Column of mass coordinate. |
||
| integer(kind=int32), | intent(out) | :: | c_radius |
Column of radius coordinate. |
||
| integer(kind=int32), | intent(out) | :: | c_mix |
Column of mixing type. |
||
| integer(kind=int32), | intent(out) | :: | c_eps |
Column of energy rate. |
Assign header column to its role by accepted names ("Required columns", docs/kippfiles.md).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | name |
Column name. |
||
| integer(kind=int32), | intent(in) | :: | idx |
Column index, from 1. |
||
| integer(kind=int32), | intent(inout) | :: | c_model |
Column of model number. |
||
| integer(kind=int32), | intent(inout) | :: | c_age |
Column of age. |
||
| integer(kind=int32), | intent(inout) | :: | c_dt |
Column of time step. |
||
| integer(kind=int32), | intent(inout) | :: | c_mass |
Column of mass coordinate. |
||
| integer(kind=int32), | intent(inout) | :: | c_radius |
Column of radius coordinate. |
||
| integer(kind=int32), | intent(inout) | :: | c_mix |
Column of mixing type. |
||
| integer(kind=int32), | intent(inout) | :: | c_eps |
Column of energy rate. |
Parse profile<pnum>.data into one record.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | dirname |
Path of MESA run directory. |
||
| integer(kind=int32), | intent(in) | :: | pnum |
Profile number. |
||
| type(convtype), | intent(out) | :: | cnv |
Record to build. |
||
| integer(kind=int32), | intent(in) | :: | fld_col(:) |
Body column of each registered field. |
||
| integer(kind=int32), | intent(in) | :: | nf |
Number of registered fields. |
||
| type(rawset), | intent(out) | :: | rf |
Colour-field values of profile. |
Build convection zones of record from MESA mixing codes, mapped by type_char.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | mt(:) |
MESA mixing code of each cell, centre to surface. |
||
| integer(kind=int32), | intent(in) | :: | nz |
Number of cells. |
||
| type(convtype), | intent(inout) | :: | cnv |
Record receiving zones. |