build_kipp_record Subroutine

private subroutine build_kipp_record(cnv, model, nz, tsec, dtsec, xm, rn, mt, eps)

Build record of one .kipp model.

Age, mass and radius arrive in cgs (s, g, cm). Energy column is net (nuclear minus neutrino), driving nuc layer w/ both signs; neu layer stays empty.

Arguments

Type IntentOptional 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.


Source Code

   subroutine build_kipp_record(cnv, model, nz, tsec, dtsec, xm, rn, mt, eps)
      !! Build record of one `.kipp` model.
      !!
      !! Age, mass and radius arrive in cgs (s, g, cm). Energy column is net (nuclear minus
      !! neutrino), driving `nuc` layer w/ both signs; `neu` layer stays empty.
      ! Arguments
      type(convtype), intent(out) :: cnv
         !! Record to build.
      integer(int32), intent(in) :: model
         !! Model number.
      integer(int32), intent(in) :: nz
         !! Number of cells.
      real(real64), intent(in) :: tsec
         !! Age (s).
      real(real64), intent(in) :: dtsec
         !! Time step (s).
      real(real64), intent(in) :: xm(:)
         !! Mass coordinate of each cell (g), centre to surface.
      real(real64), intent(in) :: rn(:)
         !! Radius coordinate of each cell (cm), centre to surface.
      real(real64), intent(in) :: eps(:)
         !! Net energy rate of each cell (erg/g/s), centre to surface.
      integer(int32), intent(in) :: mt(:)
         !! MESA mixing code of each cell, centre to surface.

      cnv%nvers = REC_NVERS
      cnv%ncyc = model
      cnv%ncoord = nz
      cnv%timesec = tsec
      cnv%dt = dtsec
      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_mesa_zones(mt, 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)
   end subroutine build_kipp_record