Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions star/defaults/controls.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -2160,9 +2160,15 @@
! mlt_Pturb_factor
! ~~~~~~~~~~~~~~~~

! For MESA's momentum equation, include MLT turbulent pressure at face k = mlt_Pturb_factor*(1/3d0)*0.5*(rho(k) + rho(k-1))*mlt_vc(k)**2/3
! MLT turbulent pressure for cell k = avg of values at faces. For TDC, mlt_Pturb_factor = 2d0
! corresponds to TDC_alpha_Pt = 1d0, where Pt = (2/3)*rho(k)*(mlt_vc(k)/sqrt(2/3))**2
! The MLT turbulent pressure is ``P_turb = mlt_Pturb_factor*rho*mlt_vc**2/3``.
! In the momentum equation, MESA uses the stored convective speed ``mlt_vc_old``
! at each face to calculate the turbulent pressure difference across that face.
!
! In TDC, ``mlt_vc = sqrt(2/3)*w``, where ``w**2 = e_t`` is the specific
! turbulent kinetic energy. The pressure used for TDC pressure work is
! ``P_turb = TDC_alpha_Pt*(2/3)*rho*w**2 = TDC_alpha_Pt*rho*mlt_vc**2``.
! For the same density and convective speed, ``mlt_Pturb_factor = 3d0``
! gives the same pressure as ``TDC_alpha_Pt = 1d0``.

! this replaces conv_dP_term_factor. also see extra_pressure vector and other_pressure routine

Expand Down Expand Up @@ -2206,7 +2212,11 @@
! ~~~~~~~~~~~
! + ``TDC_alpha_D`` : The turbulent viscous damping parameter which determines the saturation of TDC. Increasing this decreases convection speeds. This control is analogous to RSP_alfad, and previously called alpha_TDC_DAMP.
! + ``TDC_alpha_R`` : The radiative damping parameter which determines the saturation of TDC. Increasing this decreases convection speeds. This control is analogous to RSP_gammar, and previously called alpha_TDC_DAMPR.
! + ``TDC_alpha_Pt`` : The prefactor on the term accounting for work done against turbulent pressure (P_turb * dV/dt). Physically this should be unity. Turbulent pressure effects on the momentum equations are set by ``mlt_Pturb_factor``. Together, These controls are analogous to RSP_alfap, and previously called alpha_TDC_PtdVdt.
! + ``TDC_alpha_Pt`` multiplies the turbulent pressure in the TDC work term
! ``P_turb*dV/dt``. A value of ``1d0`` uses the standard pressure
! ``P_turb = (2/3)*rho*e_t``.
! Use ``mlt_Pturb_factor`` to set the turbulent pressure contribution to the momentum equation.
! This control was previously called ``alpha_TDC_PtdVdt``.
! + ``TDC_alpha_M`` : The prefactor on the term accounting for eddy viscous dissipation. This control is analogous to RSP_alfam.
! + ``TDC_alpha_C`` : The prefactor on the convective flux. This control is analogous to RSP_alfac.
! + ``TDC_alpha_S`` : The prefactor on the convective source term, S . This control is analogous to RSP_alfas.
Expand Down Expand Up @@ -3072,6 +3082,8 @@
! Standard values are the ones for which static version of the Kuhfuss
! model reduces to standard MLT. See Table 1 in `Smolec & Moskalik (2008)`_
! for standard values and the description of the parameters.
! RSP uses ``P_turb = RSP_alfap*(2/3)*rho*e_t`` in both the momentum and
! turbulent energy equations.

! .. _Smolec & Moskalik (2008): https://ui.adsabs.harvard.edu/abs/2008AcA....58..193S

Expand Down
31 changes: 0 additions & 31 deletions star/private/auto_diff_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -285,37 +285,6 @@ function wrap_d_p1(s, k) result(d_p1)
end if
end function wrap_d_p1

function wrap_d_m1_start(s, k) result(d_m1)
type (star_info), pointer :: s
type(auto_diff_real_star_order1) :: d_m1
integer, intent(in) :: k
d_m1 = 0d0
if (k > 1) then
d_m1 % val = s%rho_start(k-1)
d_m1 % d1Array(i_lnd_m1) = s%rho_start(k-1)
end if
end function wrap_d_m1_start

function wrap_d_00_start(s, k) result(d_00)
type (star_info), pointer :: s
type(auto_diff_real_star_order1) :: d_00
integer, intent(in) :: k
d_00 = 0d0
d_00 % val = s%rho_start(k)
d_00 % d1Array(i_lnd_00) = s%rho_start(k)
end function wrap_d_00_start

function wrap_d_p1_start(s, k) result(d_p1)
type (star_info), pointer :: s
type(auto_diff_real_star_order1) :: d_p1
integer, intent(in) :: k
d_p1 = 0d0
if (k < s%nz) then
d_p1 % val = s%rho_start(k+1)
d_p1 % d1Array(i_lnd_p1) = s%rho_start(k+1)
end if
end function wrap_d_p1_start

function wrap_lnd_m1(s, k) result(lnd_m1)
type (star_info), pointer :: s
type(auto_diff_real_star_order1) :: lnd_m1
Expand Down
7 changes: 3 additions & 4 deletions star/private/star_utils.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3821,17 +3821,16 @@ real(dp) function get_rho_face_val(s,k) result(rho_face)
rho_face = alfa*s% rho(k) + beta*s% rho(k-1)
end function get_rho_face_val

function get_rho_start_face(s,k) result(rho_face)
real(dp) function get_rho_start_face(s,k) result(rho_face)
type (star_info), pointer :: s
integer, intent(in) :: k
type(auto_diff_real_star_order1) :: rho_face
real(dp) :: alfa, beta
if (k == 1) then
rho_face = wrap_d_00_start(s,k)
rho_face = s% rho_start(k)
return
end if
call get_face_weights(s, k, alfa, beta)
rho_face = alfa*wrap_d_00_start(s,k) + beta*wrap_d_m1_start(s,k)
rho_face = alfa*s% rho_start(k) + beta*s% rho_start(k-1)
end function get_rho_start_face

function get_T_face(s,k) result(T_face)
Expand Down
6 changes: 3 additions & 3 deletions star/private/turb_support.f90
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ subroutine do1_mlt_eval( &
gradT, Y_face, mlt_vc, D, Gamma
integer, intent(out) :: ierr

real(dp) :: cgrav, m, XH1, P_theta, L_theta
real(dp) :: cgrav, m, XH1, P_theta, L_theta, rho_start
integer :: iso
type(auto_diff_real_star_order1) :: gradr, r, L, T, P, opacity, rho, dV, &
chiRho, chiT, Cp, rho_start, energy
chiRho, chiT, Cp, energy
include 'formats'
ierr = 0

Expand Down Expand Up @@ -173,7 +173,7 @@ subroutine do1_mlt_eval( &
opacity = opacity_in
rho = rho_in
rho_start = get_rho_start_face(s,k)
dV = 1d0/rho - 1d0/rho_start ! both variables are face wrapped.
dV = 1d0/rho - 1d0/rho_start ! rho_start is fixed during the Newton solve.
chiRho = chiRho_in
chiT = chiT_in
Cp = Cp_in
Expand Down