Build record of one MONASH model.
Mass coord mass * (1 - omx)^3, centre to surface; radius is running sum of radius steps;
epsnuc layer approximated from dL/dm, which includes gravothermal terms; zones from
kcvtn via mon_type_char. Widens field ranges w/ model's colour-field values.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(convtype), | intent(out) | :: | cnv |
Record to build. |
||
| type(rawset), | intent(out) | :: | raw |
Colour-field values of model. |
||
| integer, | intent(in) | :: | model |
Model number. |
||
| integer, | intent(in) | :: | nz |
Number of cells. |
||
| real(kind=real64), | intent(in) | :: | time |
Age (s), stored as |
||
| real(kind=real64), | intent(in) | :: | dt |
Time step that reached this model (s), stored as |
||
| real(kind=real64), | intent(in) | :: | mass |
Total mass (g). |
||
| real(kind=real64), | intent(in) | :: | ltc |
Central temperature, |
||
| real(kind=real64), | intent(in) | :: | lpc |
Central pressure, |
||
| real(kind=real64), | intent(in) | :: | omx(:) |
Mass coordinate |
||
| real(kind=real64), | intent(in) | :: | rhop(:) |
Density of each cell. |
||
| real(kind=real64), | intent(in) | :: | up(:) |
Internal energy per gram of each cell. |
||
| real, | intent(in) | :: | vconvp(:) |
Convective velocity of each cell. |
||
| integer(kind=int16), | intent(in) | :: | kcvtn(:) |
Convection code of each cell. |
||
| real(kind=real64), | intent(in) | :: | f(:,:) |
Steps across each cell. Rows: luminosity (Lsun), |
||
| real, | intent(in) | :: | w(:,:) |
Seven mass fractions of each cell. |
||
| real, | intent(in) | :: | wd(:,:) |
Seven reaction rates of each cell. |
subroutine build_mon_record(cnv, raw, model, nz, time, dt, mass, ltc, & lpc, omx, rhop, up, vconvp, kcvtn, f, w, wd) !! Build record of one MONASH model. !! !! Mass coord `mass * (1 - omx)^3`, centre to surface; radius is running sum of radius steps; !! epsnuc layer approximated from `dL/dm`, which includes gravothermal terms; zones from !! `kcvtn` via `mon_type_char`. Widens field ranges w/ model's colour-field values. ! Arguments type(convtype), intent(out) :: cnv !! Record to build. type(rawset), intent(out) :: raw !! Colour-field values of model. integer, intent(in) :: model !! Model number. integer, intent(in) :: nz !! Number of cells. real(real64), intent(in) :: time !! Age (s), stored as `timesec`. real(real64), intent(in) :: dt !! Time step that reached this model (s), stored as `dt`. real(real64), intent(in) :: mass !! Total mass (g). real(real64), intent(in) :: ltc !! Central temperature, `ln T`. real(real64), intent(in) :: lpc !! Central pressure, `ln P`. real(real64), intent(in) :: omx(:) !! Mass coordinate `omx` of each cell. real(real64), intent(in) :: rhop(:) !! Density of each cell. real(real64), intent(in) :: up(:) !! Internal energy per gram of each cell. real, intent(in) :: vconvp(:) !! Convective velocity of each cell. integer(int16), intent(in) :: kcvtn(:) !! Convection code of each cell. real(real64), intent(in) :: f(:, :) !! Steps across each cell. !! !! Rows: luminosity (Lsun), `ln T`, radius (Rsun), `ln P`. real, intent(in) :: w(:, :) !! Seven mass fractions of each cell. real, intent(in) :: wd(:, :) !! Seven reaction rates of each cell. integer(int32) :: j, fld real(real64) :: radius, dm real(real64), allocatable :: xm(:), rn(:), eps(:) character(len=1), allocatable :: zones(:) allocate (xm(nz), rn(nz), eps(nz), zones(nz)) call build_mon_fields(raw, nz, ltc, lpc, rhop, up, vconvp, f, w, wd) radius = 0.d0 do j = 1, nz xm(j) = mass*(1.d0 - omx(j))**3 radius = radius + f(3, j) rn(j) = SOLRAD*radius dm = xm(j) if (j > 1) dm = xm(j) - xm(j - 1) ! this dl-based rate includes gravothermal terms, so it approximates the nuclear rate if (dm > 0.d0) then eps(j) = f(1, j)*LSUN/dm else eps(j) = 0.d0 end if zones(j) = mon_type_char(kcvtn(j)) end do do fld = 1, MON_NFIELDS do j = 1, nz call update_field_range(fld, raw%v(j, fld)) end do end do cnv%nvers = REC_NVERS cnv%ncyc = model cnv%ncoord = nz cnv%timesec = time cnv%dt = dt cnv%toffset = 0.d0 cnv%idx_kind_len = idx_kind_len cnv%nuc_kind_len = nuc_kind_len cnv%ladv = 0 cnv%nadv = 0 cnv%levcnv = 0 cnv%abun = 0.d0 cnv%aw = 0.d0 cnv%angltv = 0.d0 cnv%xmcoord = xm cnv%rncoord = rn call build_zones(zones, nz, cnv) call build_energy(eps, nz, cnv%nnuc, cnv%nuc, cnv%inuc) cnv%nneu = 0 allocate (cnv%neu(0), cnv%ineu(0)) cnv%minloss = EPS_BASE cnv%mingain = EPS_BASE cnv%minnucl = EPS_BASE cnv%minnucg = EPS_BASE cnv%minneul = EPS_BASE cnv%minneug = EPS_BASE cnv%minlossd = 0 cnv%mingaind = 0 cnv%minnucld = 0 cnv%minnucgd = 0 cnv%minneuld = 0 cnv%minneugd = 0 call alloc_empty_layers(cnv) deallocate (xm, rn, eps, zones) end subroutine build_mon_record