Skip to content

Commit

Permalink
[ci skip] run_stars_extras
Browse files Browse the repository at this point in the history
  • Loading branch information
pmocz committed Aug 9, 2024
1 parent 634663e commit d8987c3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
3 changes: 3 additions & 0 deletions star/private/starspots.f90
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ subroutine starspot_tweak_gradr(s, P, gradr, gradr_spot)

real(dp) :: mu_ideal_gas, R2, Teff_local, PB_i
type(auto_diff_real_star_order1) :: xspot_of_r ! xspot4

if (.not. s%doing_relax .and. .not. s%doing_first_model_of_run) then
mu_ideal_gas = s%mu(1) !1.00794d0 ! for hydrogen, 1 gram per mole
R2 = pow2(s%R(1))
Expand All @@ -82,6 +83,7 @@ subroutine starspot_tweak_PT(s)
type(star_info), pointer :: s

real(dp) :: alp

alp = 1d0 - s%fspot + s%fspot*pow4(s%xspot)

! This is the surface-average value for luminosity
Expand All @@ -101,6 +103,7 @@ subroutine starspot_restore_PT(s)
! ------------------------------------------------------------

type(star_info), pointer :: s

s%Teff = pow(L_init/(pi4*pow2(s%r(1))*boltz_sigma), 0.25_dp)
s%L(1) = L_init

Expand Down
28 changes: 14 additions & 14 deletions star/test_suite/starspots/src/run_star_extras.f90
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ subroutine extras_controls(id, ierr)
s% data_for_extra_profile_header_items => data_for_extra_profile_header_items

s% other_surface_PT => starspot_tweak_PT
s% other_mlt_results => YREC_spots_other_mlt_results
!!s% other_mlt_results => YREC_spots_other_mlt_results

end subroutine extras_controls

Expand Down Expand Up @@ -165,15 +165,15 @@ subroutine YREC_spots_other_mlt_results(id, k, MLT_option, & ! NOTE: k=0 is a v

!------------------------------
!if (s% star_age >= 10d0) then
if (.not. s% doing_relax .and. .not. s% doing_first_model_of_run) then
xspot_of_r = (P - PB_i)/P
gradr_spot = gradr/( fspot*pow4(xspot_of_r) + 1d0 - fspot)
else
gradr_spot = gradr
end if
!!if (.not. s% doing_relax .and. .not. s% doing_first_model_of_run) then
!! xspot_of_r = (P - PB_i)/P
!! gradr_spot = gradr/( fspot*pow4(xspot_of_r) + 1d0 - fspot)
!!else
!! gradr_spot = gradr
!!end if

call star_mlt_results(id, k, MLT_option, &
r, L, T, P, opacity, rho, chiRho, chiT, Cp, gradr_spot, grada, scale_height, &
r, L, T, P, opacity, rho, chiRho, chiT, Cp, gradr, grada, scale_height, &
iso, XH1, cgrav, m, gradL_composition_term, mixing_length_alpha, &
alpha_semiconvection, thermohaline_coeff, &
mixing_type, gradT, Y_face, conv_vel, D, Gamma, ierr)
Expand Down Expand Up @@ -212,25 +212,25 @@ subroutine starspot_tweak_PT(id, skip_partials, &
need_atm_Psurf = .true.
need_atm_Tsurf = .true.

alp = 1d0 - fspot + fspot*pow4(xspot)
!!!alp = 1d0 - fspot + fspot*pow4(xspot)

! This is the surface-average value for luminosity
L_init = s% L(1)
!!!L_init = s% L(1)

! Set the surface L to the unspotted, ambient L
s% L(1) = s% L(1) / alp
!!!s% L(1) = s% L(1) / alp

! Now, set the Teff. Used in atm table lookup to set boundary conditions
s% Teff = pow(s% L(1)/(pi4*pow2(s% r(1))*boltz_sigma), 0.25_dp)
!!!s% Teff = pow(s% L(1)/(pi4*pow2(s% r(1))*boltz_sigma), 0.25_dp)

! Set everything with Lamb.
call star_get_surf_PT(id, skip_partials, need_atm_Psurf, need_atm_Tsurf, &
lnT_surf, dlnT_dL, dlnT_dlnR, dlnT_dlnM, dlnT_dlnkap, &
lnP_surf, dlnP_dL, dlnP_dlnR, dlnP_dlnM, dlnP_dlnkap, &
ierr)

s% Teff = pow(L_init/(pi4*pow2(s% r(1))*boltz_sigma), 0.25_dp)
s% L(1) = L_init
!!!s% Teff = pow(L_init/(pi4*pow2(s% r(1))*boltz_sigma), 0.25_dp)
!!!s% L(1) = L_init

end subroutine starspot_tweak_PT

Expand Down

0 comments on commit d8987c3

Please sign in to comment.