From 31e276f434e570038bacadf723ae20ad83c10f06 Mon Sep 17 00:00:00 2001 From: Ebraheem Farag <63124736+Debraheem@users.noreply.github.com> Date: Sat, 11 Apr 2026 10:42:27 -0400 Subject: [PATCH 01/12] add arnett tdc, limiter, conservative L remap, Af split,mlt face interpolation --- star/Makefile | 1 + star/defaults/controls_dev.defaults | 97 ++ .../dev_TDC_Cepheid_9M/Makefile | 1 + .../dev_TDC_Cepheid_9M/ck | 7 + .../dev_TDC_Cepheid_9M/clean | 4 + .../dev_TDC_Cepheid_9M/gyre.in | 34 + .../dev_TDC_Cepheid_9M/history_columns.list | 1073 +++++++++++++++++ .../dev_TDC_Cepheid_9M/inlist_pgstar | 751 ++++++++++++ .../dev_TDC_Cepheid_9M/inlist_pulses | 245 ++++ .../dev_TDC_Cepheid_9M/inlist_pulses_header | 50 + .../dev_TDC_Cepheid_9M/profile_columns.list | 966 +++++++++++++++ .../dev_TDC_Cepheid_9M/re | 31 + .../dev_TDC_Cepheid_9M/re_nomodfiles | 41 + .../dev_TDC_Cepheid_9M/rn | 14 + .../dev_TDC_Cepheid_9M/rn1 | 7 + .../dev_TDC_Cepheid_9M/rn_nomodfiles | 7 + .../rsp_cepheid_9M_cycle40.mod | 3 + .../dev_TDC_Cepheid_9M/src/run.f90 | 15 + .../src/run_star_extras.f90 | 321 +++++ .../src/run_star_extras_TDC_pulsation.inc | 383 ++++++ .../run_star_extras_TDC_pulsation_defs.inc | 16 + star/private/adjust_mesh_split_merge.f90 | 28 +- star/private/ctrls_io.f90 | 18 +- star/private/mesh_adjust.f90 | 202 +++- star/private/mlt_tdc_face_support.f90 | 354 ++++++ star/private/struct_burn_mix.f90 | 3 +- star/private/tdc_hydro.f90 | 52 +- star/private/turb_info.f90 | 16 +- star/private/turb_support.f90 | 37 +- star_data/private/star_controls_dev.inc | 6 + turb/Makefile | 3 +- turb/private/tdc.f90 | 1 + turb/private/tdc_support.f90 | 372 +++++- turb/public/turb.f90 | 47 +- turb/test/.gitignore | 5 + turb/test/plotter/mesa.mplstyle | 46 + turb/test/plotter/plot_time_dependence.py | 191 +++ .../test/src/test_time_dependence_support.f90 | 1049 ++++++++++++++++ turb/test/src/test_turb.f90 | 90 +- turb/test/test_output | 797 +++++++++++- 40 files changed, 7218 insertions(+), 166 deletions(-) create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/Makefile create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/ck create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/clean create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/gyre.in create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/history_columns.list create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pgstar create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses_header create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/profile_columns.list create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re_nomodfiles create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn1 create mode 100755 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn_nomodfiles create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rsp_cepheid_9M_cycle40.mod create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run.f90 create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation.inc create mode 100644 star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation_defs.inc create mode 100644 star/private/mlt_tdc_face_support.f90 create mode 100644 turb/test/.gitignore create mode 100644 turb/test/plotter/mesa.mplstyle create mode 100644 turb/test/plotter/plot_time_dependence.py create mode 100644 turb/test/src/test_time_dependence_support.f90 diff --git a/star/Makefile b/star/Makefile index c248e3d6b..33fb44b3c 100644 --- a/star/Makefile +++ b/star/Makefile @@ -98,6 +98,7 @@ SRCS := \ private/init_model.f90 \ private/ionization_potentials.f90 \ private/kap_support.f90 \ + private/mlt_tdc_face_support.f90 \ private/magnetic_diffusion.f90 \ private/mass_utils.f90 \ private/mesh_adjust.f90 \ diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 59666ad67..bce06b878 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -200,6 +200,102 @@ use_TDC_enthalpy_flux_limiter = .false. + ! use_TDC_arnett_velocity_closure + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! If use_TDC_arnett_velocity_closure = .true., use the Arnett 1969 + ! closure for the face convective velocity, in the form presented in Renzo et al. + ! 2020 (ADS: https://ui.adsabs.harvard.edu/abs/2020MNRAS.493.4333R/abstract), + ! which points to equation 11 of Arnett 1969 + ! (ADS: https://ui.adsabs.harvard.edu/abs/1969Ap%26SS...5..180A/abstract). + ! This replaces the Kuhfuss 1986 closure inside TDC, while keeping the + ! same luminosity-balance solve for Y = gradT - gradL. TDC implicitly solves + ! the Arnett 1969 closure in place of the Kuhfuss 1986 closure. + + ! :: + + use_TDC_arnett_velocity_closure = .false. + + + ! TDC_arnett_growth_target + ! ~~~~~~~~~~~~~~~~~~~~~~~~ + + ! Unstable-side steady-state target used by the Arnett 1969 closure in + ! this implementation: + ! 0 = steady-state MLT convective velocity + ! 1 = steady-state Kuhfuss 1986 closure velocity without the MLT correction + ! 2 = steady-state Kuhfuss 1986 closure velocity with the MLT correction + + ! :: + + TDC_arnett_growth_target = 0 + + + ! use_TDC_acceleration_limit + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! If use_TDC_acceleration_limit = .true., apply a post-solve limit to the + ! TDC convective velocity over a single step: + ! growth is capped by the Kuhfuss 1986 closure steady-state velocity at the + ! solved thermal state, while decay is bounded by the Arnett/Wood stable-side + ! decay law. + + ! :: + + use_TDC_acceleration_limit = .false. + + + ! use_TDC_Af_split + ! ~~~~~~~~~~~~~~~~ + + ! If use_TDC_Af_split = .true., use a split-step closure for the TDC + ! convective velocity when the start-of-step and end-of-step thermal states + ! lie on opposite sides of Y = gradT - gradL = 0. + ! + ! This keeps the TDC solve implicit in the end-of-step Y, but changes the + ! A_f(Y) closure so that late stabilization and late destabilization do not + ! use one branch over the full timestep. + + ! :: + + use_TDC_Af_split = .false. + + + ! use_conservative_L_remesh + ! ~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! If use_conservative_L_remesh = .true., remesh luminosity by + ! conservatively remapping the cell-centered luminosity increment + ! dL/dq and then reconstructing face L from L_center. + ! + ! This applies to both the standard mesh-adjust path and the + ! split-AMR path. The default behavior remains the legacy direct + ! interpolation/averaging of face L. + ! Default = .false. keeps the old behavior. + + ! :: + + use_conservative_L_remesh = .false. + + + ! use_face_values_eos_and_kap_mlt_tdc + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! If use_face_values_eos_and_kap_mlt_tdc = .true., evaluate the current + ! MLT/TDC thermodynamic bundle from a face-centered state. Face T and rho + ! are still built by wrapping the cell-centered primitives to the face, + ! but then a single EOS call at that face state is used to obtain P, Cp, + ! chiRho, chiT, grad_ad, lnfree_e, eta, and opacity. Those face-EOS + ! quantities are then used directly in the local gradr seen by MLT/TDC. + ! Wrapped rho and wrapped specific energy are still used in the MLT/TDC + ! call, so this is a local thermodynamic-bundle change, not a full + ! face-state reformulation of the whole star solve. + + ! :: + + use_face_values_eos_and_kap_mlt_tdc = .false. + + ! include_mlt_Pturb_in_thermodynamic_gradients ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -218,6 +314,7 @@ ! If doing velocity time_centering, include time centering in mlt. Depending on the time ! centering flags adopted, include_mlt_in_velocity_time_centering includes time centering ! for P, L, and r in geff, gradr, grada, and mlt. + ! Currently not supported together with ``use_face_values_eos_and_kap_mlt_tdc``. ! :: diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/Makefile b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/Makefile new file mode 100644 index 000000000..c779b9d6d --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/Makefile @@ -0,0 +1 @@ +include $(MESA_DIR)/star/work/Makefile \ No newline at end of file diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/ck b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/ck new file mode 100755 index 000000000..78ca63a8c --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/ck @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +# this provides the definition of check_one +# check_one +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +check_one diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/clean b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/clean new file mode 100755 index 000000000..9dff1275b --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/clean @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd make +make clean diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/gyre.in b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/gyre.in new file mode 100644 index 000000000..10381b567 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/gyre.in @@ -0,0 +1,34 @@ +&model + add_center = .FALSE. +/ + +&mode + l = 0 +/ + +&osc + inner_bound = 'ZERO_R' ! for envelopes + nonadiabatic = .TRUE. +/ + +&rot +/ + +&num + diff_scheme = 'MAGNUS_GL2'!'COLLOC_GL2' +/ + +&scan + grid_type = 'LINEAR' + freq_min = 0.5!1d-4 + freq_max = 5.0!10.0 + freq_min_units = 'ACOUSTIC_DELTA' + freq_max_units = 'ACOUSTIC_DELTA' + n_freq = 50 +/ + +&grid + w_osc = 10 + w_exp = 2 + w_ctr = 10 +/ diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/history_columns.list b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/history_columns.list new file mode 100644 index 000000000..f461f8f35 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/history_columns.list @@ -0,0 +1,1073 @@ +! history_columns.list -- determines the contents of star history logs +! you can use a non-standard version by setting history_columns_file in your inlist + +! units are cgs unless otherwise noted. + +! reorder the following names as desired to reorder columns. +! comment out the name to omit a column (fewer columns => less IO => faster running). +! remove '!' to restore a column. + +! if you have a situation where you want a non-standard set of columns, +! make a copy of this file, edit as desired, and give the new filename in your inlist +! as history_columns_file. if you are just adding columns, you can 'include' this file, +! and just list the additions in your file. note: to include the standard default +! version, use include '' -- the 0 length string means include the default file. + +! blank lines and comments can be used freely. +! if a column name appears more than once in the list, only the first occurrence is used. + +! if you need to have something added to the list of options, let me know.... + + +! the first few lines of the log file contain a few items: + + ! version_number -- for the version of mesa being used + ! burn_min1 -- 1st limit for reported burning, in erg/g/s + ! burn_min2 -- 2nd limit for reported burning, in erg/g/s + + +!# other files + +! note: you can include another list by doing +! include 'filename' +! include '' means include the default standard list file + +! the following lines of the log file contain info about 1 model per row + +!---------------------------------------------------------------------------------------------- + +!# general info about the model + + model_number ! counting from the start of the run + num_zones ! number of zones in the model + + !## age + + star_age ! elapsed simulated time in years since the start of the run + !star_age_sec ! elapsed simulated time in seconds since the start of the run + !star_age_min ! elapsed simulated time in minutes since the start of the run + !star_age_hr ! elapsed simulated time in hours since the start of the run + !star_age_day ! elapsed simulated time in days since the start of the run + day ! elapsed simulated time in days since the start of the run + + log_star_age + log_star_age_sec + + !## timestep + + time_step ! timestep in years since previous model + time_step_sec ! timestep in seconds since previous model + time_step_days + log_dt ! log10 time_step in years + log_dt_sec ! log10 time_step in seconds + !log_dt_days ! log10 time_step in days + + !## mass + + star_mass ! in Msun units + !log_star_mass + + !star_gravitational_mass ! star_mass is baryonic mass + !star_mass_grav_div_mass + + !delta_mass ! star_mass - initial_mass in Msun units + log_xmstar ! log10 mass exterior to M_center (grams) + + !## mass change + + star_mdot ! d(star_mass)/dt (in msolar per year) + log_abs_mdot ! log10(abs(star_mdot)) (in msolar per year) + + !## imposed surface conditions + !Tsurf_factor + !tau_factor + !tau_surface + + !## imposed center conditions + !m_center + !m_center_gm + !r_center + !r_center_cm + !r_center_km + !L_center + !log_L_center + !log_L_center_ergs_s + !v_center + !v_center_kms + + !logt_max + +!---------------------------------------------------------------------------------------------- + +!# mixing and convection + + !max_conv_vel_div_csound + !max_gradT_div_grada + !max_gradT_sub_grada + !min_log_mlt_Gamma + + + !## mixing regions + + mass_conv_core ! (Msun) mass coord of top of convective core. 0 if core is not convective + + ! mx1 refers to the largest (by mass) convective region. + ! mx2 is the 2nd largest. + + ! conv_mx1_top and conv_mx1_bot are the region where mixing_type == convective_mixing. + ! mx1_top and mx1_bot are the extent of all kinds of mixing, convective and other. + + ! values are m/Mstar + conv_mx1_top + conv_mx1_bot + conv_mx2_top + conv_mx2_bot + mx1_top + mx1_bot + mx2_top + mx2_bot + + ! radius -- values are radii in Rsun units + !conv_mx1_top_r + !conv_mx1_bot_r + !conv_mx2_top_r + !conv_mx2_bot_r + !mx1_top_r + !mx1_bot_r + !mx2_top_r + !mx2_bot_r + + ! you might want to get a more complete list of mixing regions by using the following + + !mixing_regions ! note: this includes regions where the mixing type is no_mixing. + + ! the is the number of regions to report + ! there will be 2* columns for this in the log file, 2 for each region. + ! the first column for a region gives the mixing type as defined in const/public/const_def.f90. + + ! the second column for a region gives the m/mstar location of the top of the region + ! entries for extra columns after the last region in the star will have an invalid mixing_type value of -1. + ! mstar is the total mass of the star, so these locations range from 0 to 1 + ! all regions are include starting from the center, so the bottom of one region + ! is the top of the previous one. since we start at the center, the bottom of the 1st region is 0. + + ! the columns in the log file will have names like 'mix_type_1' and 'mix_qtop_1' + + ! if the star has too many regions to report them all, + ! the smallest regions will be merged with neighbors for reporting purposes only. + + + !mix_relr_regions + ! same as above, but locations given as r/rstar instead of m/mstar. + ! the columns in the log file will have names like 'mix_relr_type_1' and 'mix_relr_top_1' + + + !## conditions at base of largest convection zone (by mass) + !cz_bot_mass ! mass coordinate of base (Msun) + !cz_mass ! mass coordinate of base (Msun) -- same as cz_bot_mass + !cz_log_xmass ! mass exterior to base (g) + !cz_log_xmsun ! mass exterior to base (Msun) + !cz_xm ! mass exterior to base (Msun) + !cz_logT + !cz_logRho + !cz_logP + !cz_bot_radius ! Rsun + !cz_log_column_depth + !cz_log_radial_depth + !cz_luminosity ! Lsun + !cz_opacity + !cz_log_tau + !cz_eta + !cz_log_eps_nuc ! log10(ergs/g/s) + !cz_t_heat ! Cp*T/eps_nuc (seconds) + + !cz_csound + !cz_scale_height + !cz_grav + + !cz_omega + !cz_omega_div_omega_crit + + !cz_zone + + ! mass fractions at base of largest convection zone (by mass) + !cz_log_xa h1 + !cz_log_xa he4 + + !## conditions at top of largest convection zone (by mass) + !cz_top_mass ! mass coordinate of top (Msun) + !cz_top_log_xmass ! mass exterior to top (g) + !cz_top_log_xmsun ! mass exterior to top (Msun) + !cz_top_xm ! mass exterior to top (Msun) + !cz_top_logT + !cz_top_logRho + !cz_top_logP + !cz_top_radius ! Rsun + !cz_top_log_column_depth + !cz_top_log_radial_depth + !cz_top_luminosity ! Lsun + !cz_top_opacity + !cz_top_log_tau + !cz_top_eta + !cz_top_log_eps_nuc ! log10(ergs/g/s) + !cz_top_t_heat ! Cp*T/eps_nuc (seconds) + + !cz_top_csound + !cz_top_scale_height + !cz_top_grav + + !cz_top_omega + !cz_top_omega_div_omega_crit + + !cz_top_zone + !cz_top_zone_logdq + + ! mass fractions at top of largest convection zone (by mass) + !cz_top_log_xa h1 + !cz_top_log_xa he4 + +!---------------------------------------------------------------------------------------------- + +!# nuclear reactions + + !## integrated quantities + + !power_h_burn ! total thermal power from PP and CNO, excluding neutrinos (in Lsun units) + !power_he_burn ! total thermal power from triple-alpha, excluding neutrinos (in Lsun units) + !power_photo + !power_z_burn + !log_power_nuc_burn ! total thermal power from all burning, excluding photodisintegrations + log_LH ! log10 power_h_burn + log_LHe ! log10 power_he_burn + log_LZ ! log10 total burning power including LC, but excluding LH and LHe and photodisintegrations + log_Lnuc ! log(LH + LHe + LZ) + !log_Lnuc_ergs_s + !log_Lnuc_sub_log_L + !lnuc_photo + + !extra_L ! integral of extra_heat in Lsun units + !log_extra_L ! log10 extra_L + + !## neutrino losses + log_Lneu ! log10 power emitted in neutrinos, nuclear and thermal (in Lsun units) + !log_Lneu_nuc ! log10 power emitted in neutrinos, nuclear sources only (in Lsun units) + !log_Lneu_nonnuc ! log10 power emitted in neutrinos, thermal sources only (in Lsun units) + + !mass_loc_of_max_eps_nuc ! (in Msun units) + !mass_ext_to_max_eps_nuc ! (in Msun units) + !eps_grav_integral ! (in Lsun units) + !log_abs_Lgrav ! log10 abs(eps_grav_integral) (in Lsun units) + + !## information about reactions (by category) + + ! log10 total luminosity for reaction categories (Lsun units) + + pp + cno + tri_alpha + !c_alpha + !n_alpha + !o_alpha + !ne_alpha + !na_alpha + !mg_alpha + !si_alpha + !s_alpha + !ar_alpha + !ca_alpha + !ti_alpha + !fe_co_ni + !c12_c12 + !c12_o16 + !o16_o16 + !photo + !pnhe4 + !other + + !## information about individual reactions + + ! adds columns for all of the reactions that are in the current net + ! Note that if using op_split_burn=.true. then zones which have been split will report 0 for thier rates + !add_raw_rates ! raw reaction rates, reactions/second + !add_screened_rates ! screened reaction rates reactions/second + !add_eps_nuc_rates ! Nuclear energy (minus neutrino losses) released erg/s + !add_eps_neu_rates ! Neutrino losses erg/s + + ! individual reactions (as many as desired) + ! use list_net_reactions = .true. in star_job to list all reactions in the current net + ! reactions/second + !raw_rate r_h1_h1_ec_h2 + !raw_rate r_h1_h1_wk_h2 + + + + !## nuclear reactions at center + + ! center log10 burn erg/g/s for reaction categories + + !c_log_eps_burn cno + !c_log_eps_burn tri_alfa + + ! center d_eps_nuc_dlnd for reaction categories + + !c_d_eps_dlnd cno + !c_d_eps_dlnd tri_alfa + + ! center d_eps_nuc_dlnT for reaction categories + + !c_d_eps_dlnT cno + !c_d_eps_dlnT tri_alfa + + !## regions of strong nuclear burning + + ! 2 zones where eps_nuc > burn_min1 erg/g/s + ! for each zone have 4 numbers: start1, start2, end2, end1 + ! start1 is mass of inner edge where first goes > burn_min1 (or -20 if none such) + ! start2 is mass of inner edge where first zone reaches burn_min2 erg/g/sec (or -20 if none such) + ! end2 is mass of outer edge where first zone drops back below burn_min2 erg/g/s + ! end1 is mass of outer edge where first zone ends (i.e. eps_nuc < burn_min1) + ! similar for the second zone + + epsnuc_M_1 ! start1 for 1st zone + epsnuc_M_2 ! start2 + epsnuc_M_3 ! end2 + epsnuc_M_4 ! end1 + + epsnuc_M_5 ! start1 for 2nd zone + epsnuc_M_6 ! start2 + epsnuc_M_7 ! end2 + epsnuc_M_8 ! end1 + + + ! you might want to get a more complete list of burning regions by using the following + + !burning_regions + ! the is the number of regions to report + ! there will be 2* columns for this in the log file, 2 for each region. + ! the first column for a region gives int(sign(val)*log10(max(1,abs(val)))) + ! where val = ergs/gm/sec nuclear energy minus all neutrino losses. + ! the second column for a region gives the q location of the top of the region + ! entries for extra columns after the last region in the star will have a value of -9999 + ! all regions are included starting from the center, so the bottom of one region + ! is the top of the previous one. + ! since we start at the center, the bottom of the 1st region is q=0 and top of last is q=1. + + ! the columns in the log file will have names like 'burn_type_1' and 'burn_qtop_1' + + !burn_relr_regions + ! same as above, but locations given as r/rstar instead of m/mstar. + ! the columns in the log file will have names like 'burn_relr_type_1' and 'burn_relr_top_1' + + + ! if the star has too many regions to report them all, + ! the smallest regions will be merged with neighbors for reporting purposes only. + +!---------------------------------------------------------------------------------------------- + +!# information about core and envelope + + !## helium core + he_core_mass + he_core_radius + !he_core_lgT + !he_core_lgRho + !he_core_L + !he_core_v + !he_core_omega + !he_core_omega_div_omega_crit + !he_core_k + + !## CO core + co_core_mass + !CO_core + co_core_radius + !co_core_lgT + !co_core_lgRho + !co_core_L + !co_core_v + !co_core_omega + !co_core_omega_div_omega_crit + !co_core_k + + !## ONe core + one_core_mass + !one_core_radius + !one_core_lgT + !one_core_lgRho + !one_core_L + !one_core_v + !one_core_omega + !one_core_omega_div_omega_crit + !one_core_k + + !## iron core + fe_core_mass + !fe_core_radius + !fe_core_lgT + !fe_core_lgRho + !fe_core_L + !fe_core_v + !fe_core_omega + !fe_core_omega_div_omega_crit + !fe_core_k + + !## neutron rich core + neutron_rich_core_mass + !neutron_rich_core_radius + !neutron_rich_core_lgT + !neutron_rich_core_lgRho + !neutron_rich_core_L + !neutron_rich_core_v + !neutron_rich_core_omega + !neutron_rich_core_omega_div_omega_crit + !neutron_rich_core_k + + !## envelope + + !envelope_mass ! = star_mass - he_core_mass + !envelope_fraction_left ! = envelope_mass / (initial_mass - he_core_mass) + + !h_rich_layer_mass ! = star_mass - he_core_mass + !he_rich_layer_mass ! = he_core_mass - c_core_mass + !co_rich_layer_mass + +!---------------------------------------------------------------------------------------------- + +!# timescales + + !dynamic_timescale ! dynamic timescale (seconds) -- estimated by 2*pi*sqrt(r^3/(G*m)) + !kh_timescale ! kelvin-helmholtz timescale (years) + !mdot_timescale ! star_mass/abs(star_mdot) (years) + !kh_div_mdot_timescales ! kh_timescale/mdot_timescale + !nuc_timescale ! nuclear timescale (years) -- proportional to mass divided by luminosity + + !dt_cell_collapse ! min time for any cell to collapse at current velocities + !dt_div_dt_cell_collapse + + !dt_div_max_tau_conv ! dt/ maximum conv timescale + !dt_div_min_tau_conv ! dt/ minimum conv timescale + + + !min_dr_div_cs ! min over all cells of dr/csound (seconds) + !min_dr_div_cs_k ! location of min + !log_min_dr_div_cs ! log10 min dr_div_csound (seconds) + !min_dr_div_cs_yr ! min over all cells of dr/csound (years) + !log_min_dr_div_cs_yr ! log10 min dr_div_csound (years) + !dt_div_min_dr_div_cs + !log_dt_div_min_dr_div_cs + + !min_t_eddy ! minimum value of scale_height/conv_velocity + +!---------------------------------------------------------------------------------------------- + +!# conditions at or near the surface of the model + + !## conditions at the photosphere + !effective_T + !Teff + log_Teff ! log10 effective temperature + ! Teff is calculated using Stefan-Boltzmann relation L = 4 pi R^2 sigma Teff^4, + ! where L and R are evaluated at the photosphere (tau_factor < 1) + ! or surface of the model (tau_factor >= 1) when photosphere is not inside the model. + + !photosphere_black_body_T + !photosphere_cell_T ! temperature at model location closest to the photosphere, not necessarily Teff + !photosphere_cell_log_T + !photosphere_cell_density + !photosphere_cell_log_density + !photosphere_cell_opacity + !photosphere_cell_log_opacity + !photosphere_L ! Lsun units + !photosphere_log_L ! Lsun units + !photosphere_r ! Rsun units + !photosphere_log_r ! Rsun units + !photosphere_m ! Msun units + !photosphere_v_km_s + !photosphere_cell_k + !photosphere_column_density + !photosphere_csound + !photosphere_log_column_density + !photosphere_opacity + !photosphere_v_div_cs + !photosphere_xm + !photosphere_cell_free_e + !photosphere_cell_log_free_e + !photosphere_logg + !photosphere_T + + !## conditions at or near the surface of the model (outer edge of outer cell) + + luminosity ! luminosity in Lsun units + !luminosity_ergs_s ! luminosity in cgs units + log_L ! log10 luminosity in Lsun units + !log_L_ergs_s ! log10 luminosity in cgs units + radius ! Rsun + log_R ! log10 radius in Rsun units + !radius_cm + !log_R_cm + + log_g ! log10 gravity + gravity + log_Ledd + log_L_div_Ledd ! log10(L/Leddington) + lum_div_Ledd + !log_surf_optical_depth + !surface_optical_depth + + !log_surf_cell_opacity ! old name was log_surf_opacity + !log_surf_cell_P ! old name was log_surf_P + !log_surf_cell_pressure ! old name was log_surf_pressure + !log_surf_cell_density ! old name was log_surf_density + !log_surf_cell_temperature ! old name was log_surf_temperature + !surface_cell_temperature ! old name was surface_temperature + !log_surf_cell_z ! old name was log_surf_z + !surface_cell_entropy ! in units of kerg per baryon + ! old name was surface_entropy + + v_surf ! (cm/s) + v_surf_km_s ! (km/s) + v_div_csound_surf ! velocity divided by sound speed at outermost grid point + !v_div_csound_max ! max value of velocity divided by sound speed at face + !v_div_vesc + !v_phot_km_s + !v_surf_div_escape_v + + !v_surf_div_v_kh ! v_surf/(photosphere_r/kh_timescale) + + !surf_avg_j_rot + !surf_avg_omega + !surf_avg_omega_crit + !surf_avg_omega_div_omega_crit + !surf_avg_v_rot ! km/sec rotational velocity at equator + !surf_avg_v_crit ! critical rotational velocity at equator + !surf_avg_v_div_v_crit + !surf_avg_Lrad_div_Ledd + !surf_avg_logT + !surf_avg_logRho + !surf_avg_opacity + + ! Gravity Darkening, reports the surface averaged L/Lsun and Teff (K) caused by + ! gravity darkening in rotating stars. Based on the model of Espinosa Lara & Rieutord (2011) + ! 'polar' refers to the line of sight being directed along the rotation axis of the star + ! 'equatorial' refers to the line of sight coincident with the stellar equator + !grav_dark_L_polar !Lsun + !grav_dark_Teff_polar !K + !grav_dark_L_equatorial !Lsun + !grav_dark_Teff_equatorial !K + + !surf_escape_v ! cm/s + + !v_wind_Km_per_s ! Km/s + ! = 1d-5*s% opacity(1)*max(0d0,-s% mstar_dot)/ & + ! (4*pi*s% photosphere_r*Rsun*s% tau_base) + ! Lars says: + ! wind_mdot = 4*pi*R^2*rho*v_wind + ! tau = integral(opacity*rho*dr) from R to infinity + ! so tau = opacity*wind_mdot/(4*pi*R*v_wind) at photosphere + ! or v_wind = opacity*wind_mdot/(4*pi*R*tau) at photosphere + + !rotational_mdot_boost ! factor for increase in mass loss mdot due to rotation + !log_rotational_mdot_boost ! log factor for increase in mass loss mdot due to rotation + !surf_r_equatorial_div_r_polar + !surf_r_equatorial_div_r + !surf_r_polar_div_r + +!---------------------------------------------------------------------------------------------- + +!# conditions near center + + log_center_T ! temperature + log_center_Rho ! density + log_center_P ! pressure + + ! shorter names for above + log_cntr_P + log_cntr_Rho + log_cntr_T + + !center_T ! temperature + !center_Rho ! density + !center_P ! pressure + + !center_degeneracy ! the electron chemical potential in units of k*T + !center_gamma ! plasma interaction parameter + center_mu + center_ye + center_abar + !center_zbar + + !center_eps_grav + + !center_non_nuc_neu + !center_eps_nuc + !d_center_eps_nuc_dlnT + !d_center_eps_nuc_dlnd + !log_center_eps_nuc + + !center_entropy ! in units of kerg per baryon + !max_entropy ! in units of kerg per baryon + !fe_core_infall + !non_fe_core_infall + !non_fe_core_rebound + !max_infall_speed + + !compactness_parameter ! (m/Msun)/(R(m)/1000km) for m = 2.5 Msun + !compactness + !m4 ! Mass co-ordinate where entropy=4 + ! mu4 is sensitive to the choice of how much dm/dr you average over, thus we average dm and dr over M(entropy=4) and M(entropy=4)+0.3Msun + !mu4 ! dM(Msun)/dr(1000km) where entropy=4 + + + !center_omega + !center_omega_div_omega_crit + +!---------------------------------------------------------------------------------------------- + +!# abundances + + !species ! size of net + + !## mass fractions near center + + ! the following controls automatically add columns for all of the isos that are in the current net + !add_center_abundances + !add_log_center_abundances + + ! individual central mass fractions (as many as desired) + center h1 + center he4 + center c12 + center o16 + + ! individual log10 central mass fractions (as many as desired) + !log_center h1 + !log_center he4 + ! etc. + + + !## mass fractions near surface + + ! the following controls automatically add columns for all of the isos that are in the current net + !add_surface_abundances + !add_log_surface_abundances + + ! individual surface mass fractions (as many as desired) + !surface h1 + !surface he4 + surface c12 + surface o16 + ! etc. + + ! individual log10 surface mass fractions (as many as desired) + + !log_surface h1 + !log_surface he4 + + + !## mass fractions for entire star + + ! the following controls automatically add columns for all of the isos that are in the current net + !add_average_abundances + !add_log_average_abundances + + ! individual average mass fractions (as many as desired) + !average h1 + !average he4 + ! etc. + + ! individual log10 average mass fractions (as many as desired) + !log_average h1 + !log_average he4 + ! etc. + + + !## mass totals for entire star (in Msun units) + + ! the following controls automatically add columns for all of the isos that are in the current net + !add_total_mass + !add_log_total_mass + + ! individual mass totals for entire star (as many as desired) + total_mass h1 + total_mass he4 + ! etc. + + ! individial log10 mass totals for entire star (in Msun units) + !log_total_mass h1 + !log_total_mass he4 + ! etc. + +!---------------------------------------------------------------------------------------------- + +!# info at specific locations + + !## info at location of max temperature + !max_T + !log_max_T + + +!---------------------------------------------------------------------------------------------- + +!# information about shocks + + !## info about outermost outward moving shock + ! excluding locations with q > max_q_for_outer_mach1_location + ! returns values at location of max velocity + !shock_mass ! baryonic (Msun) + !shock_mass_gm ! baryonic (grams) + !shock_q + !shock_radius ! (Rsun) + !shock_radius_cm ! (cm) + !shock_velocity + !shock_csound + !shock_v_div_cs + !shock_lgT + !shock_lgRho + !shock_lgP + !shock_gamma1 + !shock_entropy + !shock_tau + !shock_k + !shock_pre_lgRho + +!---------------------------------------------------------------------------------------------- + +!# asteroseismology + + delta_nu ! large frequency separation for p-modes (microHz) + ! 1e6/(seconds for sound to cross diameter of star) + delta_Pg ! g-mode period spacing for l=1 (seconds) + ! sqrt(2) pi^2/(integral of brunt_N/r dr) + !log_delta_Pg + nu_max ! estimate from scaling relation (microHz) + ! nu_max = nu_max_sun * M/Msun / ((R/Rsun)^2 (Teff/Teff_sun)^0.5) + ! with nu_max_sun = 3100 microHz, Teff_sun = 5777 + !nu_max_3_4th_div_delta_nu ! nu_max^0.75/delta_nu + acoustic_cutoff ! 0.5*g*sqrt(gamma1*rho/P) at surface + acoustic_radius ! integral of dr/csound (seconds) + !ng_for_nu_max ! = 1 / (nu_max*delta_Pg) + ! period for g-mode with frequency nu_max = nu_max_ng*delta_Pg + !gs_per_delta_nu ! delta_nu / (nu_max**2*delta_Pg) + ! number of g-modes per delta_nu at nu_max + + !int_k_r_dr_nu_max_Sl1 ! integral of k_r*dr where nu < N < Sl for nu = nu_max, l=1 + !int_k_r_dr_2pt0_nu_max_Sl1 ! integral of k_r*dr where nu < N < Sl for nu = nu_max*2, l=1 + !int_k_r_dr_0pt5_nu_max_Sl1 ! integral of k_r*dr where nu < N < Sl for nu = nu_max/2, l=1 + !int_k_r_dr_nu_max_Sl2 ! integral of k_r*dr where nu < N < Sl for nu = nu_max, l=2 + !int_k_r_dr_2pt0_nu_max_Sl2 ! integral of k_r*dr where nu < N < Sl for nu = nu_max*2, l=2 + !int_k_r_dr_0pt5_nu_max_Sl2 ! integral of k_r*dr where nu < N < Sl for nu = nu_max/2, l=2 + !int_k_r_dr_nu_max_Sl3 ! integral of k_r*dr where nu < N < Sl for nu = nu_max, l=3 + !int_k_r_dr_2pt0_nu_max_Sl3 ! integral of k_r*dr where nu < N < Sl for nu = nu_max*2, l=3 + !int_k_r_dr_0pt5_nu_max_Sl3 ! integral of k_r*dr where nu < N < Sl for nu = nu_max/2, l=3 + +!---------------------------------------------------------------------------------------------- + +!# energy information + + !total_energy ! at end of step + !log_total_energy ! log(abs(total_energy)) + !total_energy_after_adjust_mass ! after mass adjustments + + ! shorter versions of above + !tot_E + !log_tot_E + + + !total_gravitational_energy + !log_total_gravitational_energy ! log(abs(total_gravitational_energy)) + !total_gravitational_energy_after_adjust_mass + + ! shorter versions of above + !tot_PE + !log_tot_PE + + !total_internal_energy + !log_total_internal_energy + !total_internal_energy_after_adjust_mass + + ! shorter versions of above + !tot_IE + !log_tot_IE + + !total_radial_kinetic_energy + !log_total_radial_kinetic_energy + !total_radial_kinetic_energy_after_adjust_mass + + ! shorter versions of above (does not include rot KE) + !tot_KE + !log_tot_KE + + !total_turbulent_energy + !log_total_turbulent_energy + !total_turbulent_energy_after_adjust_mass + !tot_Et + !log_tot_Et + + !total_energy_foe + + !tot_IE_div_IE_plus_KE + !total_IE_div_IE_plus_KE + + !total_entropy + !total_eps_grav + + !total_energy_sources_and_sinks ! for this step + !total_nuclear_heating + !total_non_nuc_neu_cooling + !total_irradiation_heating + !total_extra_heating ! extra heat integrated over the model times dt (erg) + !total_WD_sedimentation_heating + + !rel_run_E_err + + !rel_E_err + !abs_rel_E_err + !log_rel_E_err + + !tot_e_equ_err + !tot_e_err + + + !error_in_energy_conservation ! for this step + ! = total_energy - (total_energy_start + total_energy_sources_and_sinks) + !cumulative_energy_error ! = sum over all steps of abs(error_in_energy_conservation) + !rel_cumulative_energy_error ! = cumulative_energy_error/total_energy + log_rel_cumulative_energy_error ! = log10 of rel_cumulative_energy_error + log_rel_run_E_err ! shorter name for rel_cumulative_energy_error + + !rel_error_in_energy_conservation ! = error_in_energy_conservation/total_energy + log_rel_error_in_energy_conservation + + !virial_thm_P_avg + !virial_thm_rel_err + !work_inward_at_center + !work_outward_at_surface + + +!---------------------------------------------------------------------------------------------- + + !# rotation + + !total_angular_momentum + log_total_angular_momentum + !i_rot_total ! moment of inertia + + !total_rotational_kinetic_energy + !log_total_rotational_kinetic_energy + !total_rotational_kinetic_energy_after_adjust_mass + +!---------------------------------------------------------------------------------------------- + +!# velocities + + !avg_abs_v_div_cs + !log_avg_abs_v_div_cs + !max_abs_v_div_cs + !log_max_abs_v_div_cs + + !avg_abs_v + !log_avg_abs_v + !max_abs_v + !log_max_abs_v + + !u_surf + !u_surf_km_s + !u_div_csound_surf + !u_div_csound_max + + !infall_div_cs + +!---------------------------------------------------------------------------------------------- + +!# misc + + !e_thermal ! sum over all zones of Cp*T*dm + + !## eos + !logQ_max ! logQ = logRho - 2*logT + 12 + !logQ_min + !gamma1_min + + !## core mixing + !mass_semiconv_core + + !## H-He boundary + + !diffusion_time_H_He_bdy + !temperature_H_He_bdy + + + !## optical depth and opacity + + !one_div_yphot + !log_one_div_yphot + + !log_min_opacity + !min_opacity + + !log_tau_center + + !log_max_tau_conv + !max_tau_conv + !log_min_tau_conv + !min_tau_conv + + !tau_qhse_yrs + + !## other + + !Lsurf_m + !dlnR_dlnM + !h1_czb_mass ! location (in Msun units) of base of 1st convection zone above he core + !kh_mdot_limit + !log_cntr_dr_cm + !min_Pgas_div_P + !surf_c12_minus_o16 ! this is useful for seeing effects of dredge up on AGB + !surf_num_c12_div_num_o16 + + !phase_of_evolution ! Integer mapping to the type of evolution see star_data/public/star_data_def.inc for definitions + + !## MLT++ + !gradT_excess_alpha + !gradT_excess_min_beta + !gradT_excess_max_lambda + + !max_L_rad_div_Ledd + !max_L_rad_div_Ledd_div_phi_Joss + + + !## RTI + !rti_regions + + !## Ni & Co + !total_ni_co_56 + + + !## internal structure constants + + ! this is evaluated assuming a spherical star and does not account for rotation + !apsidal_constant_k2 + + +!---------------------------------------------------------------------------------------------- + +!# accretion + + !k_below_const_q + !q_below_const_q + !logxq_below_const_q + + !k_const_mass + !q_const_mass + !logxq_const_mass + + !k_below_just_added + !q_below_just_added + !logxq_below_just_added + + !k_for_test_CpT_absMdot_div_L + !q_for_test_CpT_absMdot_div_L + !logxq_for_test_CpT_absMdot_div_L + +!---------------------------------------------------------------------------------------------- + +!# Color output + + ! Outputs the bolometric correction (bc) for the star in filter band ``filter'' (case sensitive) + !bc filter + + ! Outputs the absolute magnitude for the star in filter band ``filter'' (case sensitive) + !abs_mag filter + + ! Adds all the bc's to the output + add_bc + + ! Adds all the absolute magnitudes to the output + add_abs_mag + + ! Outputs luminosity in filter band ``filter'' (erg s^-1) (case sensitive) + !lum_band filter + + ! Adds all the filter band luminosities to the output (erg s^-1) + add_lum_band + + ! Outputs log luminosity in filter band ``filter'' (log erg s^-1) (case sensitive) + !log_lum_band filter + + ! Adds all the filter band luminosities to the output (log erg s^-1) + add_log_lum_band + +!---------------------------------------------------------------------------------------------- + +!# RSP + + !rsp_DeltaMag ! absolute magnitude difference between minimum and maximum light (mag) + !rsp_DeltaR ! R_max - R_min difference in the max and min radius (Rsun) + !rsp_GREKM ! fractional growth of the kinetic energy per pulsation period ("nonlinear growth rate") - see equation 5 in MESA5 + !rsp_num_periods ! Count of the number of pulsation cycles completed + !rsp_period_in_days ! Running period, ie., period between two consecutive values of R_max (days) + !rsp_phase ! Running pulsation phase for a cycle + +!---------------------------------------------------------------------------------------------- +!# debugging + + !## retries + num_retries ! total during the run + + !## solver iterations + + num_iters ! same as num_solver_iterations + !num_solver_iterations ! iterations at this step + !total_num_solver_iterations ! total iterations during the run + !avg_num_solver_iters + + !rotation_solver_steps + + !diffusion_solver_steps + !diffusion_solver_iters + + !avg_setvars_per_step + !avg_skipped_setvars_per_step + !avg_solver_setvars_per_step + + !burn_solver_maxsteps + + !total_num_solver_calls_converged + !total_num_solver_calls_failed + !total_num_solver_calls_made + !total_num_solver_relax_calls_converged + !total_num_solver_relax_calls_failed + !total_num_solver_relax_calls_made + !total_num_solver_relax_iterations + + !total_step_attempts + !total_step_redos + !total_step_retries + !total_steps_finished + !total_steps_taken + + !TDC_num_cells + + !## Relaxation steps + !total_relax_step_attempts + !total_relax_step_redos + !total_relax_step_retries + !total_relax_steps_finished + !total_relax_steps_taken + + !## conservation during mesh adjust + !log_mesh_adjust_IE_conservation + !log_mesh_adjust_KE_conservation + !log_mesh_adjust_PE_conservation + + !## amr + !num_hydro_merges + !num_hydro_splits + + !## timing + !elapsed_time ! time since start of run (seconds) + + !## Extras + burning_regions 40 + mixing_regions 40 + mix_relr_regions 40 diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pgstar b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pgstar new file mode 100644 index 000000000..4a101208a --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pgstar @@ -0,0 +1,751 @@ + +&pgstar + +!pause = .true. + +pgstar_interval = 200 ! making this too small slows the model down. +pgstar_show_age_in_years = .true. +pgstar_show_age_in_seconds = .false. +pgstar_sleep = 0.0 + +! some global grid plot settings at end + +pgstar_show_model_number = .false. +pgstar_show_age = .false. + +!------------------------------------------------------------------------------------ + +Grid1_win_flag = .true. +Grid1_win_width = 12 +Grid1_win_aspect_ratio = 0.666 + +! file output +Grid1_file_flag = .true. +Grid1_file_dir = 'png' +Grid1_file_prefix = 'Grid1_' +Grid1_file_interval = 10 ! output when mod(model_number,Grid1_file_interval)==0 +Grid1_file_width = 27 ! (inches) negative means use same value as for window +Grid1_file_aspect_ratio = -1 ! negative means use same value as for window + +! reset the defaults + +Grid1_plot_name(:) = '' +Grid1_plot_row(:) = 1 ! number from 1 at top +Grid1_plot_rowspan(:) = 1 ! plot spans this number of rows +Grid1_plot_col(:) = 1 ! number from 1 at left +Grid1_plot_colspan(:) = 1 ! plot spans this number of columns +Grid1_plot_pad_left(:) = 0.0 ! fraction of full window width for padding on left +Grid1_plot_pad_right(:) = 0.0 ! fraction of full window width for padding on right +Grid1_plot_pad_top(:) = 0.0 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(:) = 0.0 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(:) = 0.7 ! multiply txt_scale for subplot by this + + +Grid1_title = '' + +Grid1_num_cols = 3 ! divide plotting region into this many equal width cols +Grid1_num_rows = 5 ! divide plotting region into this many equal height rows +Grid1_num_plots = 6 ! <= 10 + + +Grid1_plot_name(1) = 'Text_Summary1' +Grid1_plot_row(1) = 1 ! number from 1 at top +Grid1_plot_rowspan(1) = 1 ! plot spans this number of rows +Grid1_plot_col(1) = 1 ! number from 1 at left +Grid1_plot_colspan(1) = 3 ! plot spans this number of columns + +Grid1_plot_pad_left(1) = -0.03 ! fraction of full window width for padding on left +Grid1_plot_pad_right(1) = 0.0 ! fraction of full window width for padding on right +Grid1_plot_pad_top(1) = -0.06 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(1) = 0.07 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(1) = 1 ! 0.8 ! multiply txt_scale for subplot by this + + +Grid1_plot_name(3) = 'HR' +Grid1_plot_row(3) = 2 ! number from 1 at top +Grid1_plot_rowspan(3) = 1 ! plot spans this number of rows +Grid1_plot_col(3) = 1 ! number from 1 at left +Grid1_plot_colspan(3) = 1 ! plot spans this number of columns + +Grid1_plot_pad_left(3) = 0.00 ! fraction of full window width for padding on left +Grid1_plot_pad_right(3) = 0.08 ! fraction of full window width for padding on right +Grid1_plot_pad_top(3) = -0.04 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(3) = 0.01 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(3) = 0.7 ! multiply txt_scale for subplot by this + + +Grid1_plot_name(5) = 'Profile_Panels1' +Grid1_plot_row(5) = 3 ! number from 1 at top +Grid1_plot_rowspan(5) = 3 ! plot spans this number of rows +Grid1_plot_col(5) = 1 ! number from 1 at left +Grid1_plot_colspan(5) = 1 ! plot spans this number of columns + +Grid1_plot_pad_left(5) = 0.00 ! fraction of full window width for padding on left +Grid1_plot_pad_right(5) = 0.10 ! fraction of full window width for padding on right +Grid1_plot_pad_top(5) = 0.05 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(5) = 0 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(5) = 0.6 ! multiply txt_scale for subplot by this + + +Grid1_plot_name(2) = 'TRho_Profile' +Grid1_plot_row(2) = 2 ! number from 1 at top +Grid1_plot_rowspan(2) = 1 ! plot spans this number of rows +Grid1_plot_col(2) = 2 ! number from 1 at left +Grid1_plot_colspan(2) = 1 ! plot spans this number of columns + +Grid1_plot_pad_left(2) = -0.01 ! fraction of full window width for padding on left +Grid1_plot_pad_right(2) = 0.06 ! fraction of full window width for padding on right +Grid1_plot_pad_top(2) = -0.04 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(2) = 0.01 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(2) = 0.7 ! multiply txt_scale for subplot by this + + +Grid1_plot_name(4) = 'History_Panels1' +Grid1_plot_row(4) = 3 ! number from 1 at top +Grid1_plot_rowspan(4) = 3 ! plot spans this number of rows +Grid1_plot_col(4) = 2 ! number from 1 at left +Grid1_plot_colspan(4) = 1 ! plot spans this number of columns + +Grid1_plot_pad_left(4) = 0.00 ! fraction of full window width for padding on left +Grid1_plot_pad_right(4) = 0.06 ! fraction of full window width for padding on right +Grid1_plot_pad_top(4) = 0.05 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(4) = 0.0 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(4) = 0.6 ! multiply txt_scale for subplot by this + + +Grid1_plot_name(6) = 'Profile_Panels3' +Grid1_plot_row(6) = 2 ! number from 1 at top +Grid1_plot_rowspan(6) = 4 ! plot spans this number of rows +Grid1_plot_col(6) = 3 ! Number from 1 at left +Grid1_plot_colspan(6) = 1 ! plot spans this number of columns + +Grid1_plot_pad_left(6) = 0.04 ! fraction of full window width for padding on left +Grid1_plot_pad_right(6) = 0.06 ! fraction of full window width for padding on right +Grid1_plot_pad_top(6) = -0.04 ! fraction of full window height for padding at top +Grid1_plot_pad_bot(6) = 0 ! fraction of full window height for padding at bottom +Grid1_txt_scale_factor(6) = 0.6 ! multiply txt_scale for subplot by this + + +!------------------------------------------------------------------------------------ + +Profile_Panels3_win_flag = .false. + +Profile_Panels3_title = '' + +Profile_Panels3_num_panels = 5 + +Profile_Panels3_yaxis_name(1) = 'Abundance' + +Profile_Panels3_yaxis_name(2) = 'Power' + +Profile_Panels3_yaxis_name(3) = 'Mixing' +Mixing_legend_txt_scale_factor = 0.9 + +Profile_Panels3_yaxis_name(4) = 'conv_vel_div_csound'!'conv_vel'!'logRho' +Profile_Panels3_other_yaxis_name(4) = 'v_div_cs' ! 'vel_km_per_s' ! 'entropy' +Profile_Panels3_other_dymin(4) = 0.14 + +Profile_Panels3_yaxis_name(5) = 'v_div_vesc'!'lum_div_Ledd'!'log_csound'!'logT' +Profile_Panels3_other_yaxis_name(5) = 'vel_km_per_s'!'burn_num_iters' + Profile_Panels3_yaxis_log(5) = .false. + +! x-axis limits and properties +Profile_Panels3_xaxis_name = 'logtau'!'zone'!'radius' +Profile_Panels3_xmin = -101d0 +Profile_Panels3_xmax = -101d0 !1700! -101d0 ! 2.2 +Profile_Panels3_xaxis_reversed = .true. + + +Profile_Panels3_txt_scale = 0.7 + +!Profile_Panels3_xaxis_name = 'zone' +!Profile_Panels3_xmin = 800 +!Profile_Panels3_xmax = 1100 +!Profile_Panels3_xaxis_reversed = .true. + +!Profile_Panels3_show_grid = .true. +Profile_Panels3_show_mix_regions_on_xaxis = .true. + +!------------------------------------------------------------------------------------ + +!Profile_Panels1_win_flag = .true. +!Profile_Panels1_file_flag = .true. + Profile_Panels1_file_dir = 'png' + Profile_Panels1_file_prefix = 'profile_panels1_' + Profile_Panels1_file_interval = 1 + Profile_Panels1_file_width = -1 + Profile_Panels1_file_aspect_ratio = -1 + +Profile_Panels1_title = '' + +Profile_Panels1_txt_scale = 0.7 +Profile_Panels1_num_panels = 4 + +Profile_Panels1_yaxis_name(1) = 'Eq' +!Profile_Panels1_dymin(1) = 0.14 +Profile_Panels1_other_yaxis_name(1) = 'Uq'!'lum_conv' +!Profile_Panels1_other_dymin(1) = 0.14 + +Profile_Panels1_yaxis_name(2) = 'logT'!'logdq'!'radius'!'entropy' +Profile_Panels1_other_yaxis_name(2) = 'mlt_Y_face'! 'Lc_div_L'!'log_dt_cs_div_dr'!'pgas_div_p' +Profile_Panels1_other_yaxis_log(2) = .false. + +!Profile_Panels1_ymax(2) = 210 +!Profile_Panels1_ymin(2) = 160 + +Profile_Panels1_yaxis_name(3) = 'Lc_div_L'!'gradT' +Profile_Panels1_other_yaxis_name(3) = 'conv_vel'!'lum_div_Ledd'!'grada' +Profile_Panels1_same_yaxis_range(3) = .false. +Profile_Panels1_other_dymin(3) = 0.08 +!Profile_Panels1_yaxis_log(3) = .false. +Profile_Panels1_ymax(3) =-101d0 + +Profile_Panels1_yaxis_name(4) = 'log_opacity' +Profile_Panels1_ymin(4) = 0 +Profile_Panels1_dymin(4) = 0.14 +Profile_Panels1_other_yaxis_name(4) = 'gradr' +Profile_Panels1_other_dymin(4) = 0.14 + +! x-axis limits and properties +Profile_Panels1_xaxis_name = 'logtau'!'zone' +Profile_Panels1_xmin = -101d0!-101d0 +Profile_Panels1_xmax = 5.5d0!-101d0!9d0 !-101d0 !8.1 +Profile_Panels1_xaxis_reversed = .true. + +!Profile_Panels1_xaxis_name = 'zone' +!Profile_Panels1_xmin = 15 +!Profile_Panels1_xmax = 270 +!Profile_Panels1_xaxis_reversed = .true. + +!Profile_Panels1_show_grid = .true. +Profile_Panels1_show_mix_regions_on_xaxis = .true. + +!------------------------------------------------------------------------------------ + + +!TRho_Profile_win_flag = .true. +TRho_Profile_win_width = 8 +TRho_Profile_win_aspect_ratio = 0.75 ! aspect_ratio = height/width + +! file output +!TRho_Profile_file_flag = .true. +TRho_Profile_file_dir = 'TRho' +TRho_Profile_file_prefix = 'trho_' +TRho_Profile_file_interval = 10 ! output when `mod(model_number,TRho_Profile_file_interval)==0` +TRho_Profile_file_width = -1 ! (inches) negative means use same value as for window +TRho_Profile_file_aspect_ratio = -1 ! negative means use same value as for window + +TRho_Profile_xleft = 0.15 +TRho_Profile_xright = 0.85 +TRho_Profile_ybot = 0.15 +TRho_Profile_ytop = 0.85 +TRho_Profile_txt_scale = 0.7 +TRho_Profile_title = ' ' + +TRho_switch_to_Column_Depth = .false. +TRho_switch_to_mass = .false. + +show_TRho_Profile_legend = .false. + TRho_Profile_legend_coord = 0.07 + TRho_Profile_legend_fjust = 0.0 + TRho_Profile_legend_disp1 = -2.0 + TRho_Profile_legend_del_disp = -1.3 + TRho_Profile_legend_txt_scale = 1.1 + + +show_TRho_Profile_text_info = .false. + TRho_Profile_text_info_xfac = 0.77 ! controls x location + TRho_Profile_text_info_dxfac = 0.02 ! controls x spacing to value from text + TRho_Profile_text_info_yfac = 0.6 ! controls y location of 1st line + TRho_Profile_text_info_dyfac = -0.04 ! controls line spacing + +show_TRho_Profile_mass_locs = .true. +show_TRho_accretion_mesh_borders = .false. +show_TRho_Profile_kap_regions = .false. +show_TRho_Profile_gamma1_4_3rd = .true. +show_TRho_Profile_eos_regions = .true. +show_TRho_Profile_degeneracy_line = .true. +show_TRho_Profile_Pgas_Prad_line = .true. +show_TRho_Profile_burn_lines = .true. +show_TRho_Profile_burn_labels = .true. + +! axis limits +TRho_Profile_xmin = -15.0 +TRho_Profile_xmax = 0!5d0!10.0 +TRho_Profile_ymin = 2.5 +TRho_Profile_ymax = 7.5!8.5d0!10.0 + +! these are shown if show_TRho_Profile_mass_locs = .true. +! set all the entries +profile_mass_point_q = -1 +profile_mass_point_color_index = 1 +profile_mass_point_symbol = -6 +profile_mass_point_symbol_scale = 1.7 +profile_mass_point_str = '' +profile_mass_point_str_clr = 1 +profile_mass_point_str_scale = 1.0 + +! set defaults +num_profile_mass_points = 3 ! max is defined in star_def (max_num_profile_mass_points) + +profile_mass_point_q(1) = 0.5 +profile_mass_point_color_index(1) = 1 +profile_mass_point_symbol(1) = -6 +profile_mass_point_str(1) = ' 0.5 M\d\(0844)\u' +profile_mass_point_str_clr(1) = 1 + +profile_mass_point_q(2) = 0.95 +profile_mass_point_color_index(2) = 1 +profile_mass_point_symbol(2) = -6 +profile_mass_point_str(2) = ' 0.95 M\d\(0844)\u' +profile_mass_point_str_clr(3) = 1 + +profile_mass_point_q(3) = 0.999 +profile_mass_point_color_index(3) = 1 +profile_mass_point_symbol(3) = -6 +profile_mass_point_str(3) = ' 0.999 M\d\(0844)\u' +profile_mass_point_str_clr(3) = 1 + +!------------------------------------------------------------------------------------ + + +! Text_Summary windows + +Text_Summary1_win_flag = .false. +Text_Summary1_win_width = 10 +Text_Summary1_win_aspect_ratio = 0.15 + +Text_Summary1_xleft = 0.01 +Text_Summary1_xright = 0.99 +Text_Summary1_ybot = 0.0 +Text_Summary1_ytop = 1.0 +Text_Summary1_txt_scale = 0.95 +Text_Summary1_title = '' + +Text_Summary1_num_rows = 6 ! <= 20 +Text_Summary1_num_cols = 5 ! <= 20 +Text_Summary1_name(:,:) = '' + + +Text_Summary1_name(1,1) = 'model_number' +Text_Summary1_name(1,2) = 'log_dt' +Text_Summary1_name(1,3) = 'Mass' +Text_Summary1_name(1,4) = 'H_cntr' +Text_Summary1_name(1,5) = 'H_rich' + +Text_Summary1_name(2,1) = 'non_fe_core_infall' +Text_Summary1_name(2,2) = 'star_age' +Text_Summary1_name(2,3) = 'lg_Mdot' +Text_Summary1_name(2,4) = 'He_cntr' +Text_Summary1_name(2,5) = 'He_core' + +Text_Summary1_name(3,1) = 'KE_growth_avg' +Text_Summary1_name(3,2) = 'growth' +Text_Summary1_name(3,3) = 'eta_cntr' +Text_Summary1_name(3,4) = 'C_cntr' +Text_Summary1_name(3,5) = 'CO_core' + +Text_Summary1_name(4,1) = 'period'!'log_max_T' +Text_Summary1_name(4,2) = 'log_LH' +Text_Summary1_name(4,3) = 'lg_Lnuc_tot' +Text_Summary1_name(4,4) = 'O_cntr' +Text_Summary1_name(4,5) = 'radius' + +Text_Summary1_name(5,1) = 'num_periods' +Text_Summary1_name(5,2) = 'log_LHe' +Text_Summary1_name(5,3) = 'lg_Lneu' +Text_Summary1_name(5,4) = 'Ne_cntr' +Text_Summary1_name(5,5) = 'zones' + +Text_Summary1_name(6,1) = 'log_cntr_Rho' +Text_Summary1_name(6,2) = 'log_LZ' +Text_Summary1_name(6,3) = 'lg_Lphoto' +Text_Summary1_name(6,4) = 'retries' +Text_Summary1_name(6,5) = 'log_cntr_T' + + +!------------------------------------------------------------------------------------ + +! Abundance profile plot + +Abundance_win_flag = .false. + +! window properties +Abundance_win_width = 10 +Abundance_win_aspect_ratio = 0.75 + +Abundance_xleft = 0.15 +Abundance_xright = 0.85 +Abundance_ybot = 0.15 +Abundance_ytop = 0.85 +Abundance_txt_scale = 1.1 +Abundance_title = '' + +! isotopes to plot + +Abundance_num_isos_to_show = 20 + +Abundance_which_isos_to_show(1) = 'h1' +Abundance_which_isos_to_show(2) = 'he3' +Abundance_which_isos_to_show(3) = 'he4' +Abundance_which_isos_to_show(4) = 'c12' +Abundance_which_isos_to_show(5) = 'n14' +Abundance_which_isos_to_show(6) = 'o16' +Abundance_which_isos_to_show(7) = 'ne20' +Abundance_which_isos_to_show(8) = 'mg24' +Abundance_which_isos_to_show(9) = 'si28' +Abundance_which_isos_to_show(10) = 's32' +Abundance_which_isos_to_show(11) = 'ar36' +Abundance_which_isos_to_show(12) = 'ca40' +Abundance_which_isos_to_show(13) = 'ti44' +Abundance_which_isos_to_show(14) = 'cr48' +Abundance_which_isos_to_show(15) = 'cr56' +Abundance_which_isos_to_show(16) = 'fe52' +Abundance_which_isos_to_show(17) = 'fe54' +Abundance_which_isos_to_show(18) = 'fe56' +Abundance_which_isos_to_show(19) = 'ni56' +Abundance_which_isos_to_show(20) = 'neut' +!Abundance_which_isos_to_show(22) = 'ne22' + + + +! number and size of isotope labels along curves +num_abundance_line_labels = 4 +Abundance_line_txt_scale_factor = 1.1 + + +! number and size of isotopes on legend +Abundance_legend_max_cnt = 10 +Abundance_legend_txt_scale_factor = 1.3 + +! yaxis limits +Abundance_log_mass_frac_min = -4!-6.4 ! -3.5 +Abundance_log_mass_frac_max = 0.3 + +! file output +Abundance_file_flag = .false. +Abundance_file_dir = 'Abundance' +Abundance_file_prefix = 'abund_' +Abundance_file_width = -1 ! (inches) negative means use same value as for window +Abundance_file_aspect_ratio = -1 ! negative means use same value as for window + + +!------------------------------------------------------------------------------------ + +! power plot + +Power_win_flag = .false. +Power_win_width = 10 +Power_win_aspect_ratio = 0.75 +Power_title = '' + +Power_xleft = 0.15 +Power_xright = 0.85 +Power_ybot = 0.15 +Power_ytop = 0.85 +Power_txt_scale = 1.1 +Power_title = ' ' + +Power_legend_max_cnt = 10 +Power_legend_txt_scale_factor = 1.3 ! relative to other text + +! power yaxis limits -- to override system default selections +Power_ymin = -5.0 ! -101d0 ! only used if /= -101d0 +Power_ymax = 25.0 ! -101d0 ! only used if /= -101d0 + +! file output +Power_file_flag = .false. +Power_file_dir = 'png' +Power_file_prefix = 'power_' +Power_file_interval = 5 ! output when mod(model_number,Power_file_interval)==0 +Power_file_width = -1 ! (inches) negative means use same value as for window +Power_file_aspect_ratio = -1 ! negative means use same value as for window + + +!------------------------------------------------------------------------------------ + +! mixing plot + +Mixing_xmin = 0.0 +Mixing_xmax = 1.6 ! -101d0 +Mixing_legend_txt_scale_factor = 1.4 ! relative to other text + +Mixing_show_rotation_details = .false. + +!Mixing_win_flag = .true. +!Mixing_file_flag = .true. +Mixing_file_dir = 'png' +Mixing_file_prefix = 'mixing_' +Mixing_file_interval = 1 ! output when `mod(model_number,Mixing_file_interval)==0` +Mixing_file_width = -1 ! (inches) negative means use same value as for window +Mixing_file_aspect_ratio = -1 ! negative means use same value as for window + + +!----------------------------------------------------------------------- + +! TRho window + ! history of central temperature vs. density + + TRho_txt_scale = 0.7 + TRho_title = '' + + TRho_logT_min = -101d0 + TRho_logT_max = -101d0 + TRho_logRho_min = -101d0 + TRho_logRho_max = -101d0 + show_TRho_degeneracy_line = .true. + + + +!----------------------------------------------------------------------- + + !# HR window + ! history of `lg_L` vs. `lg_Teff` + + HR_win_flag = .true. + + HR_win_width = 12 + HR_win_aspect_ratio = 0.75 ! aspect_ratio = height/width + + HR_xleft = 0.15 + HR_xright = 0.85 + HR_ybot = 0.15 + HR_ytop = 0.85 + HR_txt_scale = 0.7 !1.0 + HR_title = '' + + ! axis limits -- to override system default selections + ! HR_logT_min = -101d0 ! only used if /= -101d0 + ! HR_logT_max = -101d0 ! only used if /= -101d0 + ! HR_logL_min = -101d0 ! only used if /= -101d0 + ! HR_logL_max = -101d0 ! only used if /= -101d0 + + + + History_Panels1_xaxis_name = 'yr_since_coll' + + + ! axis limits -- to override system default selections + HR_logT_min = -101d0!3.3 !-101d0 ! only used if /= -101d0 + HR_logT_max = -101d0!3.9!-101d0 ! only used if /= -101d0 + HR_logL_min = -101d0!4.4!-101d0 ! only used if /= -101d0 + HR_logL_max = -101d0!5.5!-101d0 ! only used if /= -101d0 + + ! axis limits -- to override system default selections + HR_logT_min = -101d0 ! only used if /= -101d0 + HR_logT_max = -101d0 ! only used if /= -101d0 + HR_logL_min = -101d0 ! only used if /= -101d0 + HR_logL_max = -101d0 ! only used if /= -101d0 + + HR_logL_margin = 0.1 + HR_logT_margin = 0.1 + HR_dlogT_min = -1 + HR_dlogL_min = -1 + + HR_step_min = -1 ! only plot models with model number >= this + HR_step_max = -1 ! only plot models with model number <= this + + show_HR_classical_instability_strip = .true. + show_HR_Mira_instability_region = .false. + show_HR_WD_instabilities = .false. + + show_HR_target_box = .false. + HR_target_n_sigma = -3 ! -n means show sig 1..n + HR_target_logL = 0 + HR_target_logL_sigma = 0 + HR_target_logT = 0 + HR_target_logT_sigma = 0 + + show_HR_annotation1 = .false. + show_HR_annotation2 = .false. + show_HR_annotation3 = .false. + + HR_fname = '' ! file name for extra HR data + + ! Enables calling a subroutine to add extra information to a plot + ! see `$MESA_DIR/star/other/pgstar_decorator.f90` + HR_use_decorator = .false. + + + ! file output + HR_file_flag = .false. + HR_file_dir = 'hr_png' + HR_file_prefix = 'hr_' + HR_file_interval = 10 ! output when `mod(model_number,HR_file_interval)==0` + HR_file_width = 27 ! (inches) negative means use same value as for window + HR_file_aspect_ratio = -1 ! negative means use same value as for window + +!----------------------------------------------------------------------- + + History_Panels1_title = '' + + History_Panels1_xaxis_name = 'day'!'model_number' + History_Panels1_max_width = 50! 10000 + + !History_Panels1_xaxis_name = 'star_age' + !History_Panels1_max_width = 10 + + History_Panels1_txt_scale = 0.75 + History_Panels1_xmin = -101d0!1300!200!500 + History_Panels1_xmax = -101d0 + History_Panels1_dxmin = -1 + History_Panels1_xaxis_reversed = .false. + History_Panels1_xaxis_log = .false. + History_Panels1_xmargin = 0.0 + + ! :: + + History_Panels1_num_panels = 4 + + ! :: + + History_Panels1_yaxis_name(1) = 'log_L' + History_Panels1_yaxis_reversed(1) = .false. + History_Panels1_ymin(1) = -101d0 + History_Panels1_ymax(1) = -101d0 + History_Panels1_dymin(1) = 0.14 + + ! :: + + History_Panels1_other_yaxis_name(1) = 'log_Teff' + History_Panels1_other_yaxis_reversed(1) = .false. + History_Panels1_other_ymin(1) = -101d0 + History_Panels1_other_ymax(1) = -101d0 + History_Panels1_other_dymin(1) = 0.14 + + ! :: + + History_Panels1_yaxis_name(2) = 'growth'!'lum_div_Ledd' + History_Panels1_yaxis_reversed(2) = .false. + History_Panels1_ymin(2) = -101d0 + History_Panels1_ymax(2) = -101d0 + !History_Panels1_dymin(2) = 0.14 + + ! :: + + History_Panels1_other_yaxis_name(2) = 'luminosity'!'log_max_T' ! 'v_surf_km_s' + History_Panels1_other_yaxis_reversed(2) = .false. + History_Panels1_other_ymin(2) = -101d0 + History_Panels1_other_ymax(2) = -101d0 + History_Panels1_other_dymin(2) = 0.14 + + ! :: + + History_Panels1_yaxis_name(3) = 'radius' + History_Panels1_yaxis_reversed(3) = .false. + History_Panels1_ymin(3) = -101d0 + History_Panels1_ymax(3) = -101d0 + History_Panels1_dymin(3) = 0.14 + + ! :: + + History_Panels1_other_yaxis_name(3) = 'v_surf_km_s'!'log_cntr_Rho' + History_Panels1_other_yaxis_reversed(3) = .false. + History_Panels1_other_ymin(3) = -101d0 + History_Panels1_other_ymax(3) = -101d0 + History_Panels1_other_dymin(3) = 0.14 + ! :: + + History_Panels1_yaxis_name(4) = 'KE_growth_avg'!'log_dt' + History_Panels1_yaxis_reversed(4) = .false. + History_Panels1_ymin(4) = -101d0 + History_Panels1_ymax(4) = -101d0 + !History_Panels1_dymin(4) = 0.14 + + ! :: + + History_Panels1_other_yaxis_name(4) = 'time_step_sec' + History_Panels1_other_yaxis_reversed(4) = .false. + History_Panels1_other_ymin(4) = -101d0 + History_Panels1_other_ymax(4) = -101d0 + History_Panels1_other_dymin(4) = 0.14 + + +!----------------------------------------------------------------------- + +! some global grid plot settings + +pgstar_grid_show_title = .true. +pgstar_grid_title_scale = 1.0 +pgstar_grid_title_lw = 3 +pgstar_grid_title_disp = 2.5 ! 1.8 +pgstar_grid_title_coord = 0.5 +pgstar_grid_title_fjust = 0.5 + +pgstar_age_scale = 0.8 +pgstar_age_disp = 3.0 +pgstar_age_coord = 0.0 +pgstar_age_fjust = 0.0 + +pgstar_xaxis_label_scale = 1.3 +pgstar_left_yaxis_label_scale = 1.3 +pgstar_xaxis_label_disp = 2.2 +pgstar_left_yaxis_label_disp = 3.1 +pgstar_right_yaxis_label_disp = 4.1 + +pgstar_model_scale = 0.8 +pgstar_model_disp = 3.0 +pgstar_model_coord = 1.0 +pgstar_model_fjust = 1.0 + +! white_on_black flags -- true means white foreground color on black background +file_white_on_black_flag = .true. +file_device = 'png' ! options 'png' and 'vcps' for png and postscript respectively + + +!file_white_on_black_flag = .false. +!file_device = 'vcps' ! options 'png' and 'vcps' for png and postscript respectively + + +kipp_win_flag=.false. +kipp_file_flag=.false. +Kipp_mix_interval = 1 +Kipp_show_luminosities = .true. + + + +! history tracks for pulsations + + +! history tracks + History_Track1_file_flag = .false. + History_Track2_file_flag = .false. + + +History_Track1_win_flag = .true. +History_Track1_file_interval = 50 +History_Track1_win_width = 12 +History_Track1_win_aspect_ratio = 0.75 + +History_Track1_xname = 'v_surf_km_s' +History_Track1_yname = 'log_L' +History_Track1_xaxis_label = 'Vsurf' +History_Track1_yaxis_label = 'log L/L\d\(2281)' +History_Track1_reverse_xaxis = .false. + + +!History_Track1_xmin = -50d0 +!History_Track1_xmax = 50d0 +!History_Track1_ymin = 3.50d0 +!History_Track1_ymax = 3.98d0 + + +History_Track2_win_flag = .true. +History_Track2_file_interval = 50 + +History_Track2_win_width = 12 +History_Track2_win_aspect_ratio = 0.75 + +History_Track2_xname = 'radius' !'v_surf_km_s' +History_Track2_yname = 'log_L' +History_Track2_xaxis_label = 'Radius' +History_Track2_yaxis_label = 'log L/L\d\(2281)' +History_Track2_reverse_xaxis = .false. + +!History_Track2_xmin = 72d0 +!History_Track2_xmax = 96d0 +!History_Track2_ymin = 3.50d0 +!History_Track2_ymax = 3.98d0 + +/ ! end of pgstar namelist + diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses new file mode 100644 index 000000000..e2b38cf9e --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses @@ -0,0 +1,245 @@ +&kap +cubic_interpolation_in_X = .false. +cubic_interpolation_in_Z = .false. + +kap_file_prefix = 'a09' ! 'gs98' 'a09' 'OP_a09' 'OP_gs98' +kap_CO_prefix = 'a09_co' ! 'gs98_co' 'a09_co' +kap_lowT_prefix = 'lowT_fa05_a09p' +use_Type2_opacities = .false. ! if envelope model only +Zbase = 0.004d0 + +/ + + +&eos +/ + +&star_job + + save_model_when_terminate = .true. + save_model_filename = 'final.mod' + !required_termination_code_string = 'Successful test: evolve through 5 pulsation cycles.' + + load_saved_model = .true. + load_model_filename = 'rsp_cepheid_9M_cycle40.mod' + +! turn off RSP and turn on v_flag in mesa star. + + change_initial_RSP_flag = .true. + new_RSP_flag = .false. + + change_v_flag = .true. + new_v_flag = .true. + + relax_to_this_tau_factor = 1d-3 + dlogtau_factor = 0.1d0 + relax_tau_factor = .false. + + set_initial_dt = .true. + years_for_initial_dt = -1 + seconds_for_initial_dt = 1d2 + + set_initial_cumulative_energy_error = .true. + new_cumulative_energy_error = 0d0 + + set_initial_age = .true. + initial_age = 0 + + set_initial_model_number = .true. + initial_model_number = 0 + + pgstar_flag = .true. + +! on first pass, uncomment below if you are loading from and evolution model. + !remove_initial_center_by_temperature = 2d6 + !remove_center_set_zero_v_center = .true. ! set center v = 0 + +/ !end of star_job namelist + + +&controls + tol_max_correction = 1d99 + + ! let the rse know we are in inlist_pulses, useful for multi_inlist setups. + x_logical_ctrl(22) = .true. ! flag for in inlist_pulses + + + terminal_show_age_units = 'days' + terminal_show_timestep_units = 'secs' + terminal_show_log_dt = .false. + terminal_show_log_age = .false. + + +! GYRE output controls, make square with other things below. + !write_pulse_data_with_profile = .true. + pulse_data_format = 'GYRE' + + x_logical_ctrl(37) = .true. ! if true, then run GYRE + + x_integer_ctrl(1) = 1000 ! output GYRE info at this step interval + x_logical_ctrl(1) = .false. ! save GYRE info whenever save profile + + x_integer_ctrl(2) = 3 ! max number of modes to output per call + x_logical_ctrl(2) = .false. ! output eigenfunction files + + x_integer_ctrl(3) = 0 ! mode l (e.g. 0 for p modes, 1 for g modes) + ! should match gyre.in mode l + x_integer_ctrl(4) = 1 ! order + x_ctrl(1) = 0.158d-05 ! freq ~ this (Hz) + x_ctrl(2) = 0.33d+03 ! growth < this (days) + + + ! limit max model number as part of test suite. + !max_model_number = 3000 + + ! controls for analyzing pulsations using GYRE in MESA + x_integer_ctrl(1) = 1000 ! gyre interval to check + + x_logical_ctrl(7) = .true. ! doing pulses + x_integer_ctrl(7) = -1 ! 3 ! which period to check (<= 0 means don't check any) + x_ctrl(7) = 12d0 ! expected period (in days) + x_ctrl(8) = -1 ! min_deltaR_for_periods (Rsun) + x_ctrl(9) = 1d0 ! KE_growth_avg_abs_frac_new ! for averaging growth rates across steps. + x_ctrl(10) = 0.1 ! min_period_div_target + + + ! new rsp style meshing, thanks to Bill P. + x_logical_ctrl(23) = .false. ! .true. = Remesh for TDC + TDC_hydro_use_mass_interp_face_values = .false. + TDC_hydro_nz = 150 + TDC_hydro_nz_outer = 40 + TDC_hydro_T_anchor = 11d3 + TDC_hydro_dq_1_factor = 2d0 + remesh_for_TDC_pulsations_log_core_zoning = .false. ! .false means do rsp style core + + okay_to_remesh = .false. ! freeze mesh after initial remesh. + x_logical_ctrl(24) = .true. ! if true turn off remesh at the following model number + x_ctrl(12) = 200 ! model number to turn off remesh ( only if if okay_to_remesh = .true.) + + P_function_weight = 0 + min_surface_cell_dq = 1d-8 + max_surface_cell_dq = 1d0 + max_num_merge_surface_cells = 5 + +! GYRE set starting velocities, kick! +! kick when true and not restarting. + x_logical_ctrl(5) = .false. ! to turn on gyre kick + x_ctrl(11) = 200! kick model at this model number + + x_ctrl(4) = 0d0 ! fraction_1st_overtone (order 2) + x_ctrl(5) = 0d0 ! fraction_2nd_overtone (order 3) + x_ctrl(6) = 1d0 ! initial vsurf (kms) + + +! turn off burning and mixing, if evolving envelope model + eps_nuc_factor = 0 + non_nuc_neu_factor = 0 + dxdt_nuc_factor = 0 + mix_factor = 0 + +! timesteps for saturation + + ! TDC Pulsation timestepping. + x_ctrl(13) = 100! model number to drop timestep + x_ctrl(17) = 2d3 ! dt before pulse, seconds + x_ctrl(18) = 4.5d3 ! After a pulse begins, limit the timestep to this (in seconds). + + ! have used these values to do run to saturation, but may not be necessary ~ Bill P. + dt_div_min_dr_div_cs_limit = 2d0! set less than 1d0 in high L/M stars. + dt_div_min_dr_div_cs_hard_limit = 100d0! i don't like hard limits ~ EbF + min_abs_u_div_cs_for_dt_div_min_dr_div_cs_limit = 0.8d0 + min_q_for_dt_div_min_dr_div_cs_limit = 0d0 + max_q_for_dt_div_min_dr_div_cs_limit = 1d0 + min_k_for_dt_div_min_dr_div_cs_limit = 1 + min_abs_du_div_cs_for_dt_div_min_dr_div_cs_limit = 0.001d0 + + ! artificial viscosity if necessary, v_flag only + use_Pvsc_art_visc = .true. + Pvsc_cq = 4.0d0 + Pvsc_zsh = 0.1d0 + + ! velocity time centering for v_flag only. + steps_before_use_velocity_time_centering = 300 ! no v centering when commented + use_P_d_1_div_rho_form_of_work_when_time_centering_velocity = .true. + + include_P_in_velocity_time_centering = .true. ! set to false for u_flag + P_theta_for_velocity_time_centering = 0.5d0 + + include_L_in_velocity_time_centering = .true. + L_theta_for_velocity_time_centering = 0.5d0 + + include_mlt_in_velocity_time_centering = .false. + + set_rho_to_dm_div_dV = .false. + +! OUTER BC for TDC Pulsations + use_RSP_L_eqn_outer_BC = .true. ! uses RSP2_Lsurf_factor + RSP2_Lsurf_factor = 0.5d0 + use_zero_Pgas_outer_BC = .true. + use_compression_outer_BC = .false. + use_momentum_outer_BC = .false. ! adopt this if not using rsp and zero P bc. + +! Convection model + steps_before_use_TDC = 0 + MLT_option = 'TDC' + include_mlt_corr_to_TDC = .false. ! true K. 1986 model, no mlt limiting + use_face_values_eos_and_kap_mlt_tdc = .true. ! build smarter interpolant for face quantities + TDC_include_eturb_in_energy_equation = .true. + use_rsp_form_of_scale_height = .true. + mixing_length_alpha = 1.5d0 + TDC_alpha_M = 0.25d0 + use_ledoux_criterion = .true. + alt_scale_height_flag = .false. ! ignore eggleton, not compatible with rsp_form_of_Hp + TDC_num_innermost_cells_forced_nonturbulent = 2 ! for envelope models only. + +! controls for shock capturing, relaxed for pulsations + ! main purpose is to force radiative in shock face + max_abs_du_div_cs_for_convection = 10d0 + max_v_div_cs_for_convection = 1d2 + max_v_for_convection = 1d4 + +! output + log_directory = 'LOGS_pulsation' + + photo_digits = 8 + photo_interval = 1000 + profile_interval = 10000 + history_interval = 1 + terminal_interval = 10 + max_num_profile_models = 1000000 ! 100 ! RECOMMENDED 10000 + +! terminal output + num_trace_history_values = 2 + trace_history_value_name(1) = 'log_rel_run_E_err' + trace_history_value_name(2) = 'rel_E_err' + warn_when_large_rel_run_E_err = 1d-2 + +! solver, relax solver hard for summer school + use_gold2_tolerances = .true. + !gold_iter_for_resid_tol2 = 3 ! default is 5 + !gold_tol_residual_norm3 = 1d-4 + !gold_tol_max_residual3= 1d-2 + !make_gradr_sticky_in_solver_iters = .true. + +! Debugging + report_solver_progress = .false. + report_ierr = .false. ! if true, produce terminal output when have some internal error + +/ ! end of controls namelist + +&pgstar + +Grid1_file_dir = 'png_pulsation' + +pgstar_interval = 100 + + +! axis limits -- to override system default selections +!HR_logT_min = 3.6 !-101d0 ! only used if /= -101d0 +!HR_logT_max = 3.75!-101d0 ! only used if /= -101d0 +!HR_logL_min = 3.85!-101d0 ! only used if /= -101d0 +!HR_logL_max = 3.6!-101d0 ! only used if /= -101d0 + +HR_file_interval = 50 ! output when `mod(model_number,HR_file_interval)==0` + +/ ! end of pgstar namelist diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses_header b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses_header new file mode 100644 index 000000000..be75026dd --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses_header @@ -0,0 +1,50 @@ + +&star_job + + read_extra_star_job_inlist(1) = .true. + extra_star_job_inlist_name(1) = 'inlist_pulses' + +/ ! end of star_job namelist + + +&eos + + read_extra_eos_inlist(2) = .true. + extra_eos_inlist_name(2) = 'inlist_pulses' + +/ ! end of eos namelist + + +&kap + + read_extra_kap_inlist(2) = .true. + extra_kap_inlist_name(2) = 'inlist_pulses' + +/ ! end of kap namelist + + +&colors + + read_extra_colors_inlist(1) = .false. + extra_colors_inlist_name(1) = 'inlist_pulses' + +/ ! end of colors namelist + + +&controls + + read_extra_controls_inlist(1) = .true. + extra_controls_inlist_name(1)= 'inlist_pulses' + +/ ! end of controls namelist + + +&pgstar + + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1)= 'inlist_pulses' + + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1)= 'inlist_pgstar' + +/ ! end of pgstar namelist diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/profile_columns.list b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/profile_columns.list new file mode 100644 index 000000000..7087d449c --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/profile_columns.list @@ -0,0 +1,966 @@ +! profile_columns.list -- determines the contents of star model profiles +! you can use a non-standard version by setting profile_columns_file in your inlist + +! units are cgs unless otherwise noted. + +! reorder the following names as desired to reorder columns. +! comment out the name to omit a column (fewer columns => less IO => faster running). +! remove '!' to restore a column. + +! if you have a situation where you want a non-standard set of columns, +! make a copy of this file, edit as desired, and give the new filename in your inlist +! as profile_columns_file. if you are just adding columns, you can 'include' this file, +! and just list the additions in your file. note: to include the standard default +! version, use include '' -- the 0 length string means include the default file. + +! if you need to have something added to the list of options, let me know.... + +! the first few lines of the profile contain general info about the model. +! for completeness, those items are described at the end of this file. + + +! note: you can include another list by doing +! include 'filename' +! include '' means include the default standard list file + + +! the following lines of the profile contain info for 1 zone per row, surface to center. + +! minimal set of enabled columns: + + zone ! numbers start with 1 at the surface + mass ! m/Msun. mass coordinate of outer boundary of cell. + logR ! log10(radius/Rsun) at outer boundary of zone + logT ! log10(temperature) at center of zone + logRho ! log10(density) at center of zone + logP ! log10(pressure) at center of zone + x_mass_fraction_H + y_mass_fraction_He + z_mass_fraction_metals + + +! everything below this line is deactivated + + +!# Structure + !logM ! log10(m/Msun) + !log_mass + !dm ! cell mass (grams) + !dm_bar ! boundary mass (grams) average of adjacent dm's + logdq ! log10(dq) + !log_dq + dq_ratio ! dq(k-1)/dq(k) + q ! fraction of star mass interior to outer boundary of this zone + log_q ! log10(q) + !xq + + !grav ! gravitational acceleration (cm sec^2) + !log_g ! log10 gravitational acceleration (cm sec^2) + !g_div_r ! grav/radius (sec^2) + !r_div_g ! radius/grav (sec^-2) + !cgrav_factor ! = cgrav(k)/standard_cgrav + vel_km_per_s ! velocity at outer boundary of zone (km/s) -- 0 if no velocity variable + + radius ! radius at outer boundary of zone (in Rsun units) + !radius_cm ! radius at outer boundary of zone (in centimeters) + !radius_km ! radius at outer boundary of zone (in kilometers) + !logR_cm ! log10 radius at outer boundary of zone (in centimeters) + !rmid ! radius at center by mass of zone (in Rsun units) + !r_div_R ! fraction of total radius + + velocity ! velocity at outer boundary of zone (cm/s) -- 0 if no velocity variable + !v_div_r ! velocity divided by radius + !v_times_t_div_r + !rho_times_r3 ! at face + !log_rho_times_r3 ! at face + !scale_height ! in Rsun units + pressure_scale_height ! in Rsun units + + !m_div_r ! gm/cm + !dmbar_m_div_r + !log_dmbar_m_div_r + !mass_grams ! mass coordinate of outer boundary of cell in grams + !mmid ! mass at midpoint of cell (average of mass coords of the cell boundaries) Msun units. + + !m_grav ! total enclosed gravitational mass. Msun units. + !m_grav_div_m_baryonic ! mass_gravitational/mass at cell boundary + !mass_correction_factor ! dm_gravitational/dm (dm is baryonic mass of cell) + + !xm ! mass exterior to point (Msun units) + dq ! mass of zone as a fraction of total star mass + !logxq ! log10(1-q) + !logxm ! log10(xm) + + !xr ! radial distance from point to surface (Rsun) + !xr_cm ! radial distance from point to surface (cm) + !xr_div_R ! radial distance from point to surface in units of star radius + !log_xr ! log10 radial distance from point to surface (Rsun) + !log_xr_cm ! log10 radial distance from point to surface (cm) + !log_xr_div_R ! log10 radial distance from point to surface in units of star radius + + !dr ! r(outer edge) - r(inner edge); radial extent of cell in cm. + !log_dr ! log10 cell width (cm) + !dv ! v(inner edge) - v(outer edge); rate at which delta_r is shrinking (cm/sec). + + dt_dv_div_dr ! dt*dv/dr; need to have this << 1 for every cell + !dr_div_R ! cell width divided by star R + !log_dr_div_R ! log10 cell width divided by star R + !dr_div_rmid ! cell width divided by rmid + !log_dr_div_rmid ! log(dr_div_rmid) + + !dr_div_cs ! cell sound crossing time (sec) + !log_dr_div_cs ! log10 cell sound crossing time (sec) + dr_div_cs_yr ! cell sound crossing time (years) + !log_dr_div_cs_yr ! log10 cell sound crossing time (years) + + !acoustic_radius ! sound time from center to outer cell boundary (sec) + !log_acoustic_radius ! log10(acoustic_radius) (sec) + !acoustic_depth ! sound time from surface to outer cell boundary (sec) + !log_acoustic_depth ! log10(acoustic_depth) (sec) + !acoustic_r_div_R_phot + + !cell_collapse_time ! only set if doing explicit hydro + ! time (seconds) for cell inner edge to catch cell outer edge at current velocities + ! 0 if distance between inner and outer is increasing + !log_cell_collapse_time ! log of cell_collapse_time + + !compression_gradient + + + +!# Thermodynamics + !temperature ! temperature at center of zone + !logT_face ! log10(temperature) at outer boundary of zone + !logT_bb ! log10(black body temperature) at outer boundary of zone + !logT_face_div_logT_bb + + energy ! internal energy (ergs/g) + !logE ! log10(specific internal energy) at center of zone + !rho ! density + !density ! rho + + entropy ! specific entropy divided by (avo*kerg) + !logS ! log10(specific entropy) + !logS_per_baryon ! log10(specific entropy per baryon / kerg) + + !pressure ! total pressure at center of zone (pgas + prad) + !prad ! radiation pressure at center of zone + !pgas ! gas pressure at center of zone (electrons and ions) + logPgas ! log10(pgas) + pgas_div_ptotal ! pgas/pressure + + eta ! electron degeneracy parameter (eta >> 1 for significant degeneracy) + mu ! mean molecular weight per gas particle (ions + free electrons) + + grada ! dlnT_dlnP at constant S + !dE_dRho ! at constant T + !cv ! specific heat at constant volume + !cp ! specific heat at constant total pressure + + !log_CpT + gamma1 ! dlnP_dlnRho at constant S + !gamma3 ! gamma3 - 1 = dlnT_dlnRho at constant S + !gam ! plasma interaction parameter (> 160 or so means starting crystallization) + free_e ! free_e is mean number of free electrons per nucleon + !logfree_e ! log10(free_e), free_e is mean number of free electrons per nucleon + !chiRho ! dlnP_dlnRho at constant T + !chiT ! dlnP_dlnT at constant Rho + + csound ! sound speed + log_csound + !csound_face ! sound speed (was previously called csound_at_face) + !cs_at_cell_bdy ! sound speed at cell boundary (csound is at cell center) + !v_div_cs ! velocity divided by sound speed + v_div_csound ! velocity divided by sound speed + !div_v + + !thermal_time_to_surface ! in seconds + !log_thermal_time_to_surface + !t_rad + !log_t_rad + !log_t_sound + !log_t_thermal + + !eos_phase + !eos_frac_OPAL_SCVH + !eos_frac_HELM + !eos_frac_Skye + !eos_frac_PC + !eos_frac_FreeEOS + !eos_frac_CMS + !eos_frac_ideal + + !pgas_div_p + !prad_div_pgas + !prad_div_pgas_div_L_div_Ledd + !pressure_scale_height_cm + + !eps_grav_composition_term + eps_grav_plus_eps_mdot + + !chiRho_for_partials + !chiT_for_partials + !rel_diff_chiRho_for_partials + !rel_diff_chiT_for_partials + + !latent_ddlnRho + !latent_ddlnT + + !log_P_face + !log_Ptrb + !log_cp_T_div_t_sound + + !QQ + + +!# Mass accretion + eps_grav ! -T*ds/dt (negative for expansion) + !log_abs_eps_grav_dm_div_L + !log_abs_v ! log10(abs(velocity)) (cm/s) + !log_mdot_cs + !log_mdot_v + eps_mdot + !env_eps_grav + !xm_div_delta_m + !log_xm_div_delta_m + + +!# Nuclear energy generation + !signed_log_eps_grav ! sign(eps_grav)*log10(max(1,abs(eps_grav))) + !signed_log_eps_nuc + net_nuclear_energy ! erg/gm/s from nuclear reactions minus all neutrino losses + ! The value plotted is net_nuclear_energy = sign(val)*log10(max(1,abs(val))) + ! where val = net nuclear energy minus all neutrino losses. + net_energy ! net_energy + eps_grav. + ! The value plotted is net_energy = sign(val)*log10(max(1,abs(val))) + ! where val = net nuclear energy plus eps_grav minus all neutrino losses. + eps_nuc_plus_nuc_neu + !eps_nuc_minus_non_nuc_neu + !eps_nuc_start + + eps_nuc ! ergs/g/sec from nuclear reactions (including losses to reaction neutrinos) + !log_abs_eps_nuc + !d_lnepsnuc_dlnd + !d_epsnuc_dlnd + !deps_dlnd_face + ! (was previously called deps_dlnd_at_face) + !d_lnepsnuc_dlnT + !d_epsnuc_dlnT + !deps_dlnT_face + ! (was previously called deps_dlnT_at_face) + !eps_nuc_neu_total ! erg/gm/sec as neutrinos from nuclear reactions + + non_nuc_neu ! non-nuclear-reaction neutrino losses + !nonnucneu_plas ! plasmon neutrinos (for collective reactions like gamma_plasmon => nu_e + nubar_e) + !nonnucneu_brem ! bremsstrahlung (for reactions like e- + (z,a) => e- + (z,a) + nu + nubar) + !nonnucneu_phot ! photon neutrinos (for reactions like e- + gamma => e- + nu_e + nubar_e) + !nonnucneu_pair ! pair production (for reactions like e+ + e- => nu_e + nubar_e) + !nonnucneu_reco ! recombination neutrinos (for reactions like e- (continuum) => e- (bound) + nu_e + nubar_e) + + ! ergs/g/sec for reaction categories + add_reaction_categories ! this adds all the reaction categories + ! NOTE: you can list specific categories by giving their names (from chem_def) + pp + cno + tri_alpha + !c_alpha + !n_alpha + !o_alpha + !ne_alpha + !na_alpha + !mg_alpha + !si_alpha + !s_alpha + !ar_alpha + !ca_alpha + !ti_alpha + !fe_co_ni + !c12_c12 + !c12_o16 + !o16_o16 + !photo + !pnhe4 + !other + + ! adds columns for all of the reactions that are in the current net + ! Note that if using op_split_burn=.true. then zones which have been split will report 0 for thier rates + !add_raw_rates ! raw reaction rates, reactions/second + !add_screened_rates ! screened reaction rates reactions/second + !add_eps_nuc_rates ! Nuclear energy (minus neutrino losses) released erg/s + !add_eps_neu_rates ! Neutrino losses erg/s + + ! individual reactions (as many as desired) + ! use list_net_reactions = .true. in star_job to list all reactions in the current net + ! reactions/second + !raw_rate r_h1_h1_ec_h2 + !raw_rate r_h1_h1_wk_h2 + + !burn_num_iters ! Number of split_burn iterations taken + !burn_avg_epsnuc + !log_burn_avg_epsnuc + +!# Composition + !x_mass_fraction_H + !y_mass_fraction_He + !z_mass_fraction_metals + abar ! average atomic weight (g/mole) + !zbar ! average charge + !z2bar ! average charge^2 + ye ! average charge per baryon = proton fraction + + x ! hydrogen mass fraction + !log_x + y ! helium mass fraction + !log_y + z ! metallicity + !log_z ! metallicity + + add_abundances ! this adds all of the isos that are in the current net + ! NOTE: you can list specific isotopes by giving their names (from chem_def) + !h1 + !he3 + !he4 + !c12 + !n14 + !o16 + + !add_log_abundances ! this adds log10 of all of the isos that are in the current net + ! NOTE: you can list specific isotopes by giving their names (from chem_def) + !log h1 + !log he3 + !log he4 + !log c12 + !log n14 + !log o16 + + ! log concentration of species + ! concentration = number density / number density of electrons + ! Ci = (Xi/Ai) / sum(Zi*Xi/Ai) [see Thoul et al, ApJ 421:828-842, 1994] + !log_concentration h1 + !log_concentration he4 + + + ! typical charge for given species + ! (used by diffusion) + !typical_charge he4 + !typical_charge c12 + !typical_charge fe52 + + ! ionization state for given species + ! (same as typical charge, except that it's unsmoothed) + !ionization he4 + !ionization c12 + !ionization fe52 + + !cno_div_z ! abundance of c12, n14, and o16 as a fraction of total z + + + + +!# Opacity + !opacity ! opacity measured at center of zone + log_opacity ! log10(opacity) + dkap_dlnrho_face ! partial derivative of opacity wrt. ln rho (at T=const) at outer edge of cell + ! (was previously called dkap_dlnrho_at_face) + dkap_dlnT_face ! partial derivative of opacity wrt. ln T (at rho=const) at outer edge of cell + ! (was previously called dkap_dlnT_at_face) + kap_frac_lowT ! fraction of opacity from lowT tables + kap_frac_highT ! fraction of opacity from highT tables + kap_frac_Type2 ! fraction of opacity from Type2 tables + kap_frac_Compton ! fraction of opacity from Compton_Opacity + kap_frac_op_mono ! fraction of opacity from OP mono + + !log_kap + !log_kap_times_factor + + !log_c_div_tau + !xtau + !xlogtau + !logtau_sub_xlogtau + +!# Luminosity + luminosity ! luminosity at outer boundary of zone (in Lsun units) + !logL ! log10(max(1d-2,L/Lsun)) + !log_Lrad + log_Ledd ! log10(Leddington/Lsun) -- local Ledd, 4 pi clight G m / kap + !log_L_div_Ledd ! log10(max(1d-12,L/Leddington)) + log_Lrad_div_Ledd + !log_Lrad_div_L + !signed_log_power ! sign(L)*log10(max(1,abs(L))) + + !lum_adv + lum_conv + !lum_conv_MLT + lum_div_Ledd + !lum_erg_s + !lum_plus_lum_adv + lum_rad + + !log_L_div_CpTMdot + !log_abs_lum_erg_s + + !L + !Lc + Lc_div_L + !Lr + !Lr_div_L + !Lt + !Lt_div_L + +!# Energetics + !total_energy ! specific total energy of cell (ergs/g). internal+potential+kinetic+rotation. + !cell_specific_IE + !cell_specific_KE + !cell_IE_div_IE_plus_KE + !cell_KE_div_IE_plus_KE + + !cell_ie_div_star_ie + !cell_internal_energy_fraction + !cell_internal_energy_fraction_start + !cell_specific_PE + dwork_dm + + !log_cell_ie_div_star_ie + !log_cell_specific_IE + + ergs_eps_grav_plus_eps_mdot + ergs_error + !ergs_error_integral + ergs_mdot + !ergs_rel_error_integral + !dm_eps_grav + + !dE + + !etrb + log_etrb + !extra_grav + log_rel_E_err + + !total_energy_sign + +!# Convection + !mlt_mixing_length ! mixing length for mlt (cm) + mlt_mixing_type ! value returned by mlt + mlt_Pturb + !alpha_mlt + + conv_vel ! convection velocity (cm/sec) + log_conv_vel ! log10 convection velocity (cm/sec) + + !conv_L_div_L + log_conv_L_div_L + !lum_conv_div_lum_rad + !lum_rad_div_L_Edd + !lum_conv_div_lum_Edd + lum_conv_div_L + lum_rad_div_L + Frad_div_cUrad ! Frad/(C*Urad), must be < 1 to not violate c. + !flux_limit_lambda + !flux_limit_R + !lum_rad_div_L_Edd_sub_fourPrad_div_PchiT ! density increases outward if this is > 0 + ! see Joss, Salpeter, and Ostriker, "Critical Luminosity", ApJ 181:429-438, 1973. + + gradT ! mlt value for required temperature gradient dlnT/dlnP + + gradr ! dlnT/dlnP required for purely radiative transport + !grad_temperature ! smoothed dlnT/dlnP at cell boundary + !grad_density ! smoothed dlnRho/dlnP at cell boundary + + gradL ! gradient for Ledoux criterion for convection + !sch_stable ! 1 if grada > gradr, 0 otherwise + !ledoux_stable ! 1 if gradL > gradr, 0 otherwise + + !grada_sub_gradT + gradT_sub_grada ! gradT-grada at cell boundary + gradT_div_grada ! gradT/grada at cell boundary + + !gradr_sub_gradT + !gradT_sub_gradr ! gradT-gradr at cell boundary + !gradT_div_gradr ! gradT/gradr at cell boundary + + !log_gradT_div_gradr ! log10 gradT/gradr at cell boundary + log_mlt_Gamma ! convective efficiency + conv_vel_div_csound ! convection velocity divided by sound speed + !conv_vel_div_L_vel ! L_vel is velocity needed to carry L by convection; L = 4*pi*r^2*rho*vel**3 + log_mlt_D_mix ! log10 diffusion coefficient for mixing from mlt (cm^2/sec) + + !gradr_div_grada ! gradr/grada_face; > 1 => Schwarzschild unstable for convection + !gradr_sub_grada ! gradr - grada_face; > 0 => Schwarzschild unstable for convection + + !gradL_sub_gradr + !gradP_div_rho + !gradT_excess_effect + !gradT_rel_err + !gradT_sub_a + !grada_face + !grada_sub_gradr + !diff_grads + !log_diff_grads + + !mlt_D + !mlt_Gamma + mlt_Y_face + !mlt_Zeta + !mlt_gradT + !mlt_log_abs_Y + mlt_vc + !log_mlt_vc + !dvc_dt_TDC_div_g + + !superad_reduction_factor + !conv_vel_div_mlt_vc + + !log_Lconv + !log_Lconv_div_L + +!# Mixing + mixing_type ! mixing types are defined in mesa/const/public/const_def + log_D_mix ! log10 diffusion coefficient for mixing in units of cm^2/second (Eulerian) + !log_D_mix_non_rotation + !log_D_mix_rotation + + log_D_conv ! D_mix for regions where mix_type = convective_mixing + !log_D_leftover ! D_mix for regions where mix_type = leftover_convective_mixing + log_D_semi ! D_mix for regions where mix_type = semiconvective_mixing + log_D_ovr ! D_mix for regions where mix_type = overshoot_mixing + log_D_thrm ! D_mix for regions where mix_type = thermohaline_mixing + !log_D_minimum ! D_mix for regions where mix_type = minimum_mixing + !log_D_rayleigh_taylor ! D_mix for regions where mix_type = rayleigh_taylor_mixing + !log_D_anon ! D_mix for regions where mix_type = anonymous_mixing + !log_D_omega + + !log_sig_mix ! sig(k) is mixing flow across face k in (gm sec^1) + ! sig(k) = D_mix*(4*pi*r(k)**2*rho_face)**2/dmavg + + !dominant_isoA_for_thermohaline + !dominant_isoZ_for_thermohaline + !gradL_composition_term + + !mix_type + + + +!# Optical Depth + tau ! optical depth + !log_column_depth ! log10 column depth, exterior mass / area (g cm^-2) + !log_radial_depth ! log10 radial distance to surface (cm) + logtau ! log10(optical depth) at cell face + !tau_eff ! tau that gives the local P == P_atm if this location at surface + ! tau_eff = kap*(P/g - Pextra_factor*(L/M)/(6*pi*clight*cgrav)) + !tau_eff_div_tau + + + +!# Rotation + omega ! angular velocity = j_rot/i_rot + !log_omega + log_j_rot + !log_J_div_M53 ! J is j*1e-15 integrated from center; M53 is m^(5/3) + log_J_inside ! J_inside is j_rot integrated from center + !shear ! -dlnomega/dlnR + !log_abs_shear ! log10(abs(dlnomega/dlnR)) + !richardson_number + i_rot ! specific moment of inertia at cell boundary + !j_rot ! specific angular momentum at cell boundary + !v_rot ! rotation velocity at cell boundary (km/sec) + !w_div_w_crit_roche !ratio of rotational velocity to keplerian at the equator + !without the contribution from the Eddington factor + fp_rot ! rotation factor for pressure + ft_rot ! rotation factor for temperature + !ft_rot_div_fp_rot ! gradr factor + + !log_am_nu_non_rot ! log10(am_nu_non_rot) + !log_am_nu_rot ! log10(am_nu_rot) + log_am_nu ! log10(am_nu_non_rot + am_nu_rot) + + !r_polar ! (Rsun) + !log_r_polar ! log10 (Rsun) + !r_equatorial ! (Rsun) + !log_r_equatorial ! log10 (Rsun) + !r_e_div_r_p ! equatorial/r_polar + !omega_crit ! breakup angular velocity = sqrt(G M / equatorial^3) + !omega_div_omega_crit + + !am_log_nu_omega ! for diffusion of omega + !am_log_nu_j ! for diffusion of angular momentum + + !am_log_nu_rot ! diffusion of angular momentum driven by rotation + !am_log_nu_non_rot ! diffusion driven by other sources, e.g. convection + + !am_log_sig_omega ! for diffusion of omega + !am_log_sig_j ! for diffusion of angular momentum + !am_log_sig ! == am_log_sig_omega + + !am_log_D_visc ! diffusion coeff for kinematic viscosity + !am_log_D_DSI ! diffusion coeff for dynamical shear instability + !am_log_D_SH ! diffusion coeff for Solberg-Hoiland instability + !am_log_D_SSI ! diffusion coeff for secular shear instability + !am_log_D_ES ! diffusion coeff for Eddington-Sweet circulation + !am_log_D_GSF ! diffusion coeff for Goldreich-Schubert-Fricke instability + !am_log_D_ST ! Spruit dynamo mixing diffusivity + !am_log_nu_ST ! Spruit dynamo effective viscosity + + !dynamo_log_B_r ! (Gauss) + !dynamo_log_B_phi ! (Gauss) + + !am_domega_dlnR + !log_abs_dlnR_domega + + !w_div_w_crit_roche2 + + +!# Diffusion + ! electric field from element diffusion calculation + !e_field + !log_e_field + + ! gravitational field from element diffusion calculation + !g_field_element_diffusion + !log_g_field_element_diffusion + + !eE_div_mg_element_diffusion + !log_eE_div_mg_element_diffusion + + ! element diffusion velocity for species + !edv h1 + !edv he4 + !edv o16 + + ! Energy generated by Ne22 sedimentation. + !eps_WD_sedimentation + !log_eps_WD_sedimentation + + !eps_diffusion + !log_eps_diffusion + + !diffusion_D h1 ! self diffusion coeff + !diffusion_dX h1 ! change in h1 mass fraction from diffusion + !diffusion_dX he4 ! change in he4 mass fraction from diffusion + !diffusion_dX n20 ! change in n20 mass fraction from diffusion + + !v_rad h1 ! velocity from radiative levitation + !v_rad he4 ! velocity from radiative levitation + !v_rad ne20 ! velocity from radiative levitation + + !log_g_rad h1 ! log10 acceleration from radiative levitation + !log_g_rad he4 ! log10 acceleration from radiative levitation + !log_g_rad ne20 ! log10 acceleration from radiative levitation + +!# Phase Separation + !eps_phase_separation + +!# Oscillations + brunt_N2 ! brunt-vaisala frequency squared + brunt_N2_structure_term + brunt_N2_composition_term + !log_brunt_N2_structure_term + !log_brunt_N2_composition_term + !brunt_A ! = N^2*r/g + !brunt_A_div_x2 ! x = r(k)/r(1) + !brunt_N2_dimensionless ! N2 in units of 3GM/R^3 + !brunt_N_dimensionless ! N in units of sqrt(3GM/R^3) + !brunt_frequency ! cycles per day + !brunt_N ! sqrt(abs(brunt_N2)) + !log_brunt_N ! log10(brunt_N) + !log_brunt_N2 ! log10(brunt_N2) + !log_brunt_N2_dimensionless ! log10(brunt_N2_dimensionless) + + !brunt_B ! smoothed numerical difference + !brunt_nonB ! = grada - gradT + !log_brunt_B ! smoothed numerical difference + !log_brunt_nonB ! = grada - gradT + + !sign_brunt_N2 ! sign of brunt_N2 (+1 for Ledoux stable; -1 for Ledoux unstable) + !brunt_nu ! brunt_frequency in microHz + !log_brunt_nu ! brunt_frequency in microHz + + !lamb_S ! lamb frequency for l=1: S = sqrt(2)*csound/r (rad/s) + !lamb_S2 ! squared lamb frequency for l=1: S2 = 2*(csound/r)^2 (rad^2/s^2) + + !lamb_Sl1 ! lamb frequency for l=1; = sqrt(2)*csound/r (microHz) + !lamb_Sl2 ! lamb frequency for l=2; = sqrt(6)*csound/r (microHz) + !lamb_Sl3 ! lamb frequency for l=3; = sqrt(12)*csound/r (microHz) + !lamb_Sl10 ! lamb frequency for l=10; = sqrt(110)*csound/r (microHz) + + !log_lamb_Sl1 ! log10(lamb_Sl1) + !log_lamb_Sl2 ! log10(lamb_Sl2) + !log_lamb_Sl3 ! log10(lamb_Sl3) + !log_lamb_Sl10 ! log10(lamb_Sl10) + + !brunt_N_div_r_integral ! integral from center of N*dr/r + !k_r_integral ! integral from center of k_r*dr + !brunt_N2_sub_omega2 + !sl2_sub_omega2 + + +!# RSP + + !rsp_Chi ! dlnP_dlnRho + !rsp_Et ! Specific turbulent energy + !rsp_logEt ! Log specific turbulent energy + !rsp_erad ! Specific internal (radiative) energy + !rsp_log_erad ! Log specific internal (radiative) energy + !rsp_Hp_face ! Pressure scale height at cell face + !rsp_Lc ! Convective luminosity + !rsp_Lc_div_L ! Convective luminosity div total luminosity + !rsp_Lr ! Radiative luminosity + !rsp_Lr_div_L ! Radiative luminosity div total luminosity + !rsp_Lt ! Turbulent luminosity + !rsp_Lt_div_L ! Turbulent luminosity div total luminosity + !rsp_Pt ! Turbulent pressure, p_t, see Table 1 in MESA5 + !rsp_Uq ! Viscous momentum transfer rate, U_q, see Table 1 in MESA5 + !rsp_Eq ! Viscous energy transfer rate, epsilon_q, see Table 1 in MESA5 + !rsp_Pvsc ! Artificial viscosity, p_av, see Table 1 in MESA5 + !rsp_gradT ! Temperature gradient + !rsp_Y_face ! Superadiabatic gradient at cell face, Y_sag, see Table 1 in MESA5 + !rsp_damp ! Turbulent dissipation, D, see Table 1 in MESA5 + !rsp_dampR ! Radiative cooling, D_r, see Table 1 in MESA5 + !rsp_sink ! Sum of turbulent dissipation and radiative cooling terms + !rsp_src ! Source function, S, see Table 1 in MESA5 + !rsp_src_snk ! Convective coupling, C, see Table 1 in MESA5 + !rsp_heat_exchange_timescale ! 1d0/(clight * opacity * density) + !rsp_log_heat_exchange_timescale + !rsp_log_dt_div_heat_exchange_timescale ! Ratio of time step to heat exchange timescale + !w + !log_w + + !COUPL + !DAMP + !DAMPR + !SOURCE + !Chi + Eq + !Hp_face + !PII_face + !Ptrb + Pvsc + Uq + !Y_face + +!# RTI + + !RTI_du_diffusion_kick + !alpha_RTI + !boost_for_eta_RTI + !dedt_RTI + !dudt_RTI + !eta_RTI + !log_alpha_RTI + !log_boost_for_eta_RTI + !log_eta_RTI + !log_etamid_RTI + !log_lambda_RTI_div_Hrho + !log_sig_RTI + !log_sigmid_RTI + !log_source_RTI + !log_source_minus_alpha_RTI + !log_source_plus_alpha_RTI + !source_minus_alpha_RTI + !source_plus_alpha_RTI + !lambda_RTI + +!# Hydrodynamics + + + !v + !v_div_v_escape + !v_div_vesc + !v_kms + !log_v_escape + + !u + !u_face + + !P_face + + +!# Extras + !extra_heat + !extra_L ! extra_heat integrated from center (Lsun) + !log_extra_L ! log10 integrated from center (Lsun) + !log_irradiation_heat + + !extra_jdot ! set in other_torque routine + !extra_omegadot ! set in other_torque routine + + !extra_opacity_factor ! set in other_opacity_factor routine + + ! diffusion factor profile for species, set in other_diffusion_factor routine + !extra_diffusion_factor h1 + !extra_diffusion_factor he4 + !extra_diffusion_factor o16 + + + +!# Miscellaneous + + !dlog_h1_dlogP ! (log(h1(k)) - log(h1(k-1)))/(log(P(k)) - log(P(k-1))) + !dlog_he3_dlogP + !dlog_he4_dlogP + !dlog_c12_dlogP + !dlog_c13_dlogP + !dlog_n14_dlogP + !dlog_o16_dlogP + !dlog_ne20_dlogP + !dlog_mg24_dlogP + !dlog_si28_dlogP + + !dlog_pp_dlogP + !dlog_cno_dlogP + !dlog_3alf_dlogP + + !dlog_burn_c_dlogP + !dlog_burn_n_dlogP + !dlog_burn_o_dlogP + + !dlog_burn_ne_dlogP + !dlog_burn_na_dlogP + !dlog_burn_mg_dlogP + + !dlog_cc_dlogP + !dlog_co_dlogP + !dlog_oo_dlogP + + !dlog_burn_si_dlogP + !dlog_burn_s_dlogP + !dlog_burn_ar_dlogP + !dlog_burn_ca_dlogP + !dlog_burn_ti_dlogP + !dlog_burn_cr_dlogP + !dlog_burn_fe_dlogP + + !dlog_pnhe4_dlogP + !dlog_photo_dlogP + !dlog_other_dlogP + + !logR_kap ! logR = logRho - 3*logT + 18 ; used in kap tables + !logW ! logW = logPgas - 4*logT + !logQ ! logQ = logRho - 2*logT + 12 + !logV ! logV = logRho - 0.7*logE + 20 + + !log_CpT_absMdot_div_L ! log10(s% Cp(k)*s% T(k)*abs(s% mstar_dot)/s% L(k)) + + !delta_r ! r - r_start, change during step + !delta_L ! L - L_start, change during step + !delta_cell_vol ! cell_vol - cell_vol_start, change during step + !delta_entropy ! entropy - entropy_start, change during step (does not include effects of diffusion) + !delta_T ! T - T_start, change during step + !delta_rho ! rho - rho_start, change during step + !delta_eps_nuc ! eps_nuc - eps_nuc_start, change during step + !delta_mu ! mu - mu_start, change during step + + !zFe ! mass fraction of "Fe" = Fe+Co+Ni + !log_zFe + !dPdr_dRhodr_info + !log_sig_raw_mix + + !d_u_div_rmid + !d_u_div_rmid_start + !d_v_div_r_dm + !d_v_div_r_dr + + !dlnP_dlnR + !dlnRho_dlnR + !dlnRho_dr + !dlnX_dr + !dlnY_dr + !dlogR + !dPdr_div_grav + !dPdr_info + !dRhodr_info + !dRstar_div_dr + !dr_ratio + !dm_eps_grav + !dr_ratio + !dt_cs_div_dr + !dt_div_tau_conv + !dt_times_conv_vel_div_mixing_length + log_dt_cs_div_dr + !log_dt_div_tau_conv + !log_dt_times_conv_vel_div_mixing_length + !log_du_kick_div_du + !du + !dvdt_dPdm + !dvdt_grav + + !tau_conv + !tau_cool + !tau_epsnuc + !tau_qhse + + !max_abs_xa_corr + + tdc_num_iters + + !k + + +! the first few lines of the profile contain general info about the model. +! for completeness, those items are described here. + + ! initial mass and Z + ! initial_mass + ! initial_z + ! general properties of the current state + ! model_number + ! num_zones + ! star_age + ! time_step + ! properties at the photosphere + ! Teff + ! photosphere_L + ! photosphere_r + ! properties at the outermost zone of the model + ! log_surface_L + ! log_surface_radius + ! log_surface_temp + ! properties near the center of the model + ! log_center_temp + ! log_center_density + ! log_center_P + ! center_eta + ! abundances near the center + ! center_h1 + ! center_he3 + ! center_he4 + ! center_c12 + ! center_n14 + ! center_o16 + ! center_ne20 + ! information about total mass + ! star_mass + ! star_mdot + ! star_mass_h1 + ! star_mass_he3 + ! star_mass_he4 + ! star_mass_c12 + ! star_mass_n14 + ! star_mass_o16 + ! star_mass_ne20 + ! locations of abundance transitions + ! he_core_mass + ! c_core_mass + ! o_core_mass + ! si_core_mass + ! fe_core_mass + ! location of optical depths 10 and 100 + ! tau10_mass + ! tau10_radius + ! tau100_mass + ! tau100_radius + ! time scales + ! dynamic_time + ! kh_timescale + ! nuc_timescale + ! various kinds of total power + ! power_nuc_burn + ! power_h_burn + ! power_he_burn + ! power_neu + ! a few control parameter values + ! h1_boundary_limit + ! he4_boundary_limit + ! c12_boundary_limit + ! burn_min1 + ! burn_min2 diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re new file mode 100755 index 000000000..7093783a3 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +shopt -u expand_aliases + +photo_directory=photos + +function most_recent_photo { + ls -tp "$photo_directory" | grep -v / | head -1 +} + +if [ $# -eq 0 ] +then + photo=$(most_recent_photo) +else + photo=$1 +fi + +if [ -z "$photo" ] || ! [ -f "$photo_directory/$photo" ] +then + echo "specified photo ($photo) does not exist" + exit 1 +fi + +echo "restart from $photo" +if ! cp "$photo_directory/$photo" restart_photo +then + echo "failed to copy photo ($photo)" + exit 1 +fi + +make run diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re_nomodfiles b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re_nomodfiles new file mode 100755 index 000000000..d447f6665 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/re_nomodfiles @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +#echo $# +#echo $1 +#echo $2 + +photo_directory=photos + +function most_recent_photo { + ls -t "$photo_directory" | head -1 +} + +if [ "$#" -ne 2 ] +then + echo "must pass two arguments, photo string and inlist name" + exit 1 +fi + +if [ $1 = "." ] +then + photo=$(most_recent_photo) +else + photo=$1 +fi + +if [ -z "$photo" ] || ! [ -f "$photo_directory/$photo" ] +then + echo "specified photo does not exist" + exit 1 +fi + +echo "restart from $photo" +if ! cp "$photo_directory/$photo" restart_photo +then + echo "failed to copy photo" + exit 1 +fi + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" +./star $2 +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn new file mode 100755 index 000000000..910c56f82 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# this provides the definition of do_one (run one part of test) +# do_one [inlist] [output model] [LOGS directory] +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +do_one inlist_pulses_header final.mod + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +echo 'finished' + diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn1 b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn1 new file mode 100755 index 000000000..7eb455c6e --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn1 @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +rm -f restart_photo + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" +./build/bin/star +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn_nomodfiles b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn_nomodfiles new file mode 100755 index 000000000..f2217502a --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rn_nomodfiles @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +rm -f restart_photo +echo $1 + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" +./build/bin/star $1 +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rsp_cepheid_9M_cycle40.mod b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rsp_cepheid_9M_cycle40.mod new file mode 100644 index 000000000..c5ca7a952 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/rsp_cepheid_9M_cycle40.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1504617dac77bedac0a5f6e99edb7c60f52fe209f3633ea74811f2724a315206 +size 80845 diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run.f90 b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run.f90 new file mode 100644 index 000000000..76d423f1a --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run.f90 @@ -0,0 +1,15 @@ +program run + use run_star_support, only: do_read_star_job + use run_star, only: do_run_star + + implicit none + + integer :: ierr + + ierr = 0 + call do_read_star_job('inlist', ierr) + if (ierr /= 0) stop 1 + + call do_run_star + +end program run diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 new file mode 100644 index 000000000..4a5ed56cc --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 @@ -0,0 +1,321 @@ +! *********************************************************************** +! +! Copyright (C) 2010-2025 The MESA Team +! +! This program is free software: you can redistribute it and/or modify +! it under the terms of the GNU Lesser General Public License +! as published by the Free Software Foundation, +! either version 3 of the License, or (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +! See the GNU Lesser General Public License for more details. +! +! You should have received a copy of the GNU Lesser General Public License +! along with this program. If not, see . +! +! *********************************************************************** + +module run_star_extras + + use star_lib + use star_def + use const_def + use math_lib + use auto_diff + use chem_def + use utils_lib + use gyre_mesa_m + + use interp_1d_def, only: pm_work_size + use interp_1d_lib, only: interp_pm, interp_values, interp_value + + implicit none + + include 'run_star_extras_TDC_pulsation_defs.inc' + + logical :: dbg = .false. + + !!!!!!!!!!!!!!!!!!!!!!!!! + ! These variables are loaded up from x_ctrl, x_integer_ctrl and x_logical_ctrl + ! values specified on inlist_common, inlist_pulses + !!!!!!!!!!!!!!!!!!!!!!!!! + + logical :: in_inlist_pulses, remesh_for_envelope_model, turn_off_remesh + integer :: kick_model_number, timestep_drop_model_number, turn_off_remesh_model_number + integer :: initial_model_number + real(dp) :: max_dt_before_pulse, max_dt_during_pulse + +contains + + include 'run_star_extras_TDC_pulsation.inc' + + subroutine extras_controls(id, ierr) + integer, intent(in) :: id + integer, intent(out) :: ierr + type(star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + s%extras_startup => extras_startup + s%extras_start_step => extras_start_step + s%extras_check_model => extras_check_model + s%extras_finish_step => extras_finish_step + s%extras_after_evolve => extras_after_evolve + s%how_many_extra_history_columns => how_many_extra_history_columns + s%data_for_extra_history_columns => data_for_extra_history_columns + s%how_many_extra_profile_columns => how_many_extra_profile_columns + s%data_for_extra_profile_columns => data_for_extra_profile_columns + + ! pulsation info + s%other_photo_write => photo_write + s%other_photo_read => photo_read + + ! store user provided options from the inlist + + in_inlist_pulses = s%x_logical_ctrl(22) + max_dt_before_pulse = s%x_ctrl(17) + max_dt_during_pulse = s%x_ctrl(18) + remesh_for_envelope_model = s%x_logical_ctrl(23) + turn_off_remesh = s%x_logical_ctrl(24) + kick_model_number = s%x_ctrl(11) + timestep_drop_model_number = s%x_ctrl(13) + turn_off_remesh_model_number = s%x_ctrl(12) + end subroutine extras_controls + + + subroutine extras_startup(id, restart, ierr) + integer, intent(in) :: id + logical, intent(in) :: restart + integer, intent(out) :: ierr + type(star_info), pointer :: s + include 'formats' + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + call TDC_pulsation_extras_startup(id, restart, ierr) + + ! Initialize GYRE + + call init('gyre.in') + + ! Set constants + + call set_constant('G_GRAVITY', standard_cgrav) + call set_constant('C_LIGHT', clight) + call set_constant('A_RADIATION', crad) + + call set_constant('M_SUN', Msun) + call set_constant('R_SUN', Rsun) + call set_constant('L_SUN', Lsun) + + call set_constant('GYRE_DIR', TRIM(mesa_dir)//'/build/gyre/src') + + if (.not. restart .and. in_inlist_pulses) then + initial_model_number = s% model_number + end if + !initial_model_number = 0 ! since we are setting model # to 0 in inlist_pulses + + ! for rsp style mesh + if (.not. restart .and. in_inlist_pulses .and. remesh_for_envelope_model) then + call remesh_for_TDC_pulsation(id, ierr) + end if + end subroutine extras_startup + + subroutine extras_after_evolve(id, ierr) + integer, intent(in) :: id + integer, intent(out) :: ierr + type(star_info), pointer :: s + real(dp) :: dt + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + if (.not. s%x_logical_ctrl(37)) return + call final() + end subroutine extras_after_evolve + + ! returns either keep_going, retry, or terminate. + integer function extras_check_model(id) + integer, intent(in) :: id + integer :: ierr, k + real(dp) :: max_v + type(star_info), pointer :: s + include 'formats' + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + extras_check_model = keep_going + + end function extras_check_model + + integer function how_many_extra_history_columns(id) + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + how_many_extra_history_columns = TDC_pulsation_how_many_extra_history_columns(id) + end function how_many_extra_history_columns + + subroutine data_for_extra_history_columns(id, n, names, vals, ierr) + integer, intent(in) :: id, n + character(len=maxlen_history_column_name) :: names(n) + real(dp) :: vals(n), v_esc + integer, intent(out) :: ierr + type(star_info), pointer :: s + integer :: k, k0 + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + call TDC_pulsation_data_for_extra_history_columns(id, n, names, vals, ierr) + end subroutine data_for_extra_history_columns + + integer function how_many_extra_profile_columns(id) + use star_def, only: star_info + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + how_many_extra_profile_columns = TDC_pulsation_how_many_extra_profile_columns(id) + + end function how_many_extra_profile_columns + + subroutine data_for_extra_profile_columns(id, n, nz, names, vals, ierr) + use star_def, only: star_info, maxlen_profile_column_name + use const_def, only: dp + integer, intent(in) :: id, n, nz + character(len=maxlen_profile_column_name) :: names(n) + real(dp) :: vals(nz, n) + integer, intent(out) :: ierr + type(star_info), pointer :: s + integer :: k + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + call TDC_pulsation_data_for_extra_profile_columns(id, n, nz, names, vals, ierr) + + end subroutine data_for_extra_profile_columns + + integer function extras_start_step(id) + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + include 'formats' + extras_start_step = terminate + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + ! we want to ignore T gradient equation for a few steps after remesh + if (s%model_number < initial_model_number + 10 .and. in_inlist_pulses) then + s%convergence_ignore_equL_residuals = .true. + else if (in_inlist_pulses) then + s%convergence_ignore_equL_residuals = .false. + end if + + if (s%model_number == kick_model_number .and. in_inlist_pulses & + .and. s%x_logical_ctrl(5)) then + + ! if v= 0, turn on v so we can kick + if (.not. s%v_flag .and. .not. s%u_flag) then + call star_set_v_flag(id, .true., ierr) + write (*,*) 'turning on v_flag hydro for kick' + end if + + call gyre_in_mesa_extras_set_velocities(s, .false., ierr) + write (*, *) 'kick' + write (*, *) 'kick' + write (*, *) 'kick' + write (*, *) 'kick' + write (*, *) 'kick' + + end if + + call my_before_struct_burn_mix(s%id, s%dt, extras_start_step) + + extras_start_step = keep_going + end function extras_start_step + + subroutine my_before_struct_burn_mix(id, dt, res) + use const_def, only: dp + use star_def + integer, intent(in) :: id + real(dp), intent(in) :: dt + integer, intent(out) :: res ! keep_going, redo, retry, terminate + real(dp) :: power_photo, v_esc + integer :: ierr, k + type(star_info), pointer :: s + include 'formats' + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + if (in_inlist_pulses) then + if (s%model_number > timestep_drop_model_number) then + s%max_timestep = max_dt_during_pulse + else + s%max_timestep = max_dt_before_pulse + end if + + ! time step control on pulsations + if (period > 0d0 .and. period/s%max_timestep < 600 .and. & + s%model_number > timestep_drop_model_number) then + s%max_timestep = period/600d0 + end if + + if (s%model_number > turn_off_remesh_model_number .and. turn_off_remesh) then + s%okay_to_remesh = .false. + end if + end if + + res = keep_going + end subroutine my_before_struct_burn_mix + + subroutine null_binary_controls(id, binary_id, ierr) + integer, intent(in) :: id, binary_id + integer, intent(out) :: ierr + ierr = 0 + end subroutine null_binary_controls + + ! returns either keep_going or terminate. + integer function extras_finish_step(id) + use run_star_support + use math_lib + integer, intent(in) :: id + integer :: ierr, k + real(dp) :: max_vel_inside, vesc_for_cell, vesc_surf !check_avg_v_div_vesc + type(star_info), pointer :: s + include 'formats' + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + extras_finish_step = keep_going + extras_finish_step = TDC_pulsation_extras_finish_step(id) + +! if (.not. s% x_logical_ctrl(37)) return +! extras_finish_step = gyre_in_mesa_extras_finish_step(id) + + if (extras_finish_step == terminate) s%termination_code = t_extras_finish_step + + end function extras_finish_step + + + subroutine photo_write(id, iounit) + integer, intent(in) :: id, iounit + call TDC_pulsation_photo_write(id, iounit) + end subroutine photo_write + + subroutine photo_read(id, iounit, ierr) + integer, intent(in) :: id, iounit + integer, intent(out) :: ierr + call TDC_pulsation_photo_read(id, iounit, ierr) + end subroutine photo_read + +end module run_star_extras diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation.inc b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation.inc new file mode 100644 index 000000000..e1d2ca8ca --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation.inc @@ -0,0 +1,383 @@ + + + subroutine TDC_pulsation_photo_write(id, iounit) + integer, intent(in) :: id, iounit + write(iounit) num_periods, run_num_steps_end_prev, & + run_num_iters_end_prev, run_num_retries_end_prev, & + period, KE_growth, KE_growth_avg, prev_KE_max, & + delta_R_growth, delta_R_growth_avg, prev_delta_R, & + period_max_v_div_vesc, period_max_v_div_cs, period_delta_R, & + period_delta_Teff, period_delta_logTeff, & + period_delta_logL, period_delta_Mag, & + time_started, v_div_cs_max, v_div_vesc_max, & + KE_min, KE_max, R_min, R_max, L_min, L_max, T_min, T_max, & + best_period, best_model_number, best_order, best_cycles_to_double + end subroutine TDC_pulsation_photo_write + + + subroutine TDC_pulsation_photo_read(id, iounit, ierr) + integer, intent(in) :: id, iounit + integer, intent(out) :: ierr + ierr = 0 + read(iounit, iostat=ierr) num_periods, run_num_steps_end_prev, & + run_num_iters_end_prev, run_num_retries_end_prev, & + period, KE_growth, KE_growth_avg, prev_KE_max, & + delta_R_growth, delta_R_growth_avg, prev_delta_R, & + period_max_v_div_vesc, period_max_v_div_cs, period_delta_R, & + period_delta_Teff, period_delta_logTeff, & + period_delta_logL, period_delta_Mag, & + time_started, v_div_cs_max, v_div_vesc_max, & + KE_min, KE_max, R_min, R_max, L_min, L_max, T_min, T_max, & + best_period, best_model_number, best_order, best_cycles_to_double + end subroutine TDC_pulsation_photo_read + + + subroutine TDC_pulsation_extras_startup(id, restart, ierr) + integer, intent(in) :: id + logical, intent(in) :: restart + integer, intent(out) :: ierr + type (star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + if (.not. restart) then + num_periods = 0 + run_num_steps_end_prev = 0 + run_num_iters_end_prev = 0 + run_num_retries_end_prev = 0 + period = 0 + KE_growth = 0 + KE_growth_avg = 0 + prev_KE_max = 0 + delta_R_growth = 0 + delta_R_growth_avg = 0 + prev_delta_R = 0 + period_max_v_div_cs = 0 + period_max_v_div_vesc = 0 + period_delta_R = 0 + period_delta_Teff = 0 + period_delta_logTeff = 0 + period_delta_logL = 0 + period_delta_Mag = 0 + time_started = 0 + v_div_cs_max = 0 + v_div_vesc_max = 0 + KE_min = 0 + KE_max = 0 + R_min = 0 + R_max = 0 + L_min = 0 + L_max = 0 + T_min = 0 + T_max = 0 + best_period = 0 + best_model_number = 0 + best_order = 0 + best_cycles_to_double = 0 + end if + end subroutine TDC_pulsation_extras_startup + + + integer function TDC_pulsation_extras_finish_step(id) + use chem_def + integer, intent(in) :: id + type (star_info), pointer :: s + integer :: ierr, gyre_interval, test_period + real(dp) :: target_period + logical :: doing_pulses + include 'formats' + + TDC_pulsation_extras_finish_step = terminate + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + TDC_pulsation_extras_finish_step = keep_going + + gyre_interval = s% x_integer_ctrl(1) + if (gyre_interval > 0) then + if (MOD(s% model_number, gyre_interval) == 0) & + call get_gyre_info_for_this_step + if (TDC_pulsation_extras_finish_step == terminate) & + s% termination_code = t_extras_finish_step + if (TDC_pulsation_extras_finish_step /= keep_going) return + end if + + doing_pulses = s% x_logical_ctrl(7) + if (.not. doing_pulses) return + target_period = s% x_ctrl(7) + if (target_period <= 0d0) return + if (.not. get_period_info()) return + + test_period = s% x_integer_ctrl(7) + if (num_periods < test_period .or. test_period <= 0) return + + ! have finished test run + call report_test_results + TDC_pulsation_extras_finish_step = terminate + + contains + + subroutine get_gyre_info_for_this_step + integer :: i + TDC_pulsation_extras_finish_step = gyre_in_mesa_extras_finish_step(id) + if (s% ixtra3_array(1) > 0) then ! unpack the GYRE results + do i=1,s% ixtra3_array(1) + if (s% xtra1_array(i) == 0d0 .or. & + (s% ixtra1_array(i) /= s% x_integer_ctrl(4) .and. s% x_integer_ctrl(4) > 0)) cycle + if (s% xtra3_array(i) > 0d0 .and. & + (best_cycles_to_double == 0d0 .or. s% xtra3_array(i) < best_cycles_to_double)) then + !best_growth = s% xtra1_array(i) + best_period = 1d0/s% xtra2_array(i) ! xtra2_array = freq (s^-1) + best_period = best_period/(24*3600) ! change to days + best_cycles_to_double = s% xtra3_array(i) + best_order = s% ixtra1_array(i) + best_model_number = s% model_number + end if + end do + end if + end subroutine get_gyre_info_for_this_step + + logical function get_period_info() + real(dp) :: v_surf, v_surf_start, KE, min_period, time_ended, & + delta_R, min_deltaR_for_periods, growth_avg_frac_new, & + min_period_div_target, cs, vesc + include 'formats' + get_period_info = .false. + + if (s% r(1) < R_min) R_min = s% r(1) + if (s% r(1) > R_max) R_max = s% r(1) + if (s% L(1) < L_min) L_min = s% L(1) + if (s% L(1) > L_max) L_max = s% L(1) + if (s% Teff < T_min) T_min = s% Teff + if (s% Teff > T_max) T_max = s% Teff + KE = s% total_radial_kinetic_energy_end + if (KE > KE_max) KE_max = KE + if (KE < KE_min) KE_min = KE + + if (s% v_flag) then + v_surf = s% v(1) + v_surf_start = s% v_start(1) + else if (s% u_flag) then + v_surf = s% u(1) ! s% u_face_val(1) + v_surf_start = s% u_start(1) ! s% u_face_start(1) + else ! + v_surf = 0d0 + v_surf_start = 0d0 + !stop 'TDC_pulsation_extras_finish_step: both v_flag and u_flag are false' + end if + cs = s% csound(1) + if (v_surf > v_div_cs_max*cs) v_div_cs_max = v_surf/cs + vesc = sqrt(2*s% cgrav(1)*s% m(1)/(s% r(1))) + if (v_surf > v_div_vesc_max*vesc) v_div_vesc_max = v_surf/vesc + + ! period is completed when v_surf goes from positive to negative during step + if (v_surf > 0d0 .or. v_surf_start < 0d0) return + + if (time_started == 0) then ! start of 1st cycle + time_started = s% time + run_num_steps_end_prev = s% model_number + run_num_iters_end_prev = s% total_num_solver_iterations + run_num_retries_end_prev = s% num_retries + prev_KE_max = 0d0 + call init_min_max_info + write(*,*) 'first maximum radius, period calculations starting at model, day', & + s% model_number, s% time/(24*3600) + return + end if + + delta_R = R_max - R_min + min_deltaR_for_periods = s% x_ctrl(8)*Rsun + if (min_deltaR_for_periods > 0d0) then + if (delta_R < min_deltaR_for_periods) return ! filter out glitches + end if + + time_ended = s% time + if (abs(v_surf - v_surf_start) > 1d-10) & ! tweak the end time to match when v_surf == 0 + time_ended = s% time - v_surf*s% dt/(v_surf - v_surf_start) + min_period_div_target = s% x_ctrl(10) + min_period = target_period*(24*3600)*min_period_div_target + if (min_period > 0d0 .and. & + time_ended - time_started < min_period) return ! filter out glitches + + period = time_ended - time_started + num_periods = num_periods + 1 + + if (num_periods > 1) then + growth_avg_frac_new = s% x_ctrl(9) + KE_growth = (KE_max - prev_KE_max)/prev_KE_max + KE_growth_avg = growth_avg_frac_new*KE_growth + & + (1d0 - growth_avg_frac_new)*KE_growth_avg + delta_R_growth = (delta_R - prev_delta_R)/prev_delta_R + delta_R_growth_avg = growth_avg_frac_new*delta_R_growth + & + (1d0 - growth_avg_frac_new)*delta_R_growth_avg + end if + + period_delta_Teff = T_max - T_min + period_delta_logTeff = log10(T_max/T_min) + period_delta_R = R_max - R_min + period_delta_logL = log10(L_max/L_min) + period_delta_Mag = 2.5d0*period_delta_logL + period_max_v_div_cs = v_div_cs_max + period_max_v_div_vesc = v_div_vesc_max + prev_KE_max = KE_max + prev_delta_R = period_delta_R + ! 1 2 3 4 5 6 7 8 9 + write(*,'(i4,a14,i6,a13,f8.3,a13,f9.3,a9,f9.4,a15,f10.4,a13,f9.4,a13,f10.4,a11,f9.4,a13,f9.4)') & + num_periods, & + 'steps/cycle', s% model_number - run_num_steps_end_prev, & ! 1 a14,i6 + 'iters/step', & + dble(s% total_num_solver_iterations - run_num_iters_end_prev)/ & + dble(s% model_number - run_num_steps_end_prev), & ! 2 a13,f8.3 + 'period (d)', period/(24*3600), & ! 3 a13,f9.3 + 'growth', delta_R_growth_avg, & ! 4 a9,f9.4 + 'delta R/Rsun', period_delta_R/Rsun, & ! 5 a15,f10.4 + 'delta logL', period_delta_logL, & ! 6 a13,f9.4 + 'delta Teff', period_delta_Teff, & ! 7 a13,f10.4 + 'max v/cs', period_max_v_div_cs, & ! 8 a11,f9.4 + 'max v/vesc', period_max_v_div_vesc ! 9 a13,f9.4 + + time_started = time_ended + run_num_steps_end_prev = s% model_number + run_num_iters_end_prev = s% total_num_solver_iterations + run_num_retries_end_prev = s% num_retries + call init_min_max_info + get_period_info = .true. + + end function get_period_info + + subroutine init_min_max_info + v_div_cs_max = 0d0 + v_div_vesc_max = 0d0 + KE_min = 1d99 + KE_max = -1d99 + R_min = 1d99 + R_max = -1d99 + L_min = 1d99 + L_max = -1d99 + T_min = 1d99 + T_max = -1d99 + end subroutine init_min_max_info + + subroutine report_test_results + real(dp) :: rel_run_E_err + write(*,*) + write(*,*) + write(*,*) + rel_run_E_err = s% cumulative_energy_error/s% total_energy + write(*,*) 'rel_run_E_err', rel_run_E_err + if (s% total_energy /= 0d0 .and. abs(rel_run_E_err) > 1d-5) then + write(*,*) '*** BAD rel_run_E_error ***', & + s% cumulative_energy_error/s% total_energy + else if (abs(period/(24*3600) - target_period) > 1d-2) then + write(*,*) '*** BAD period ***', period/(24*3600) - target_period, & + period/(24*3600), target_period + else + write(*,*) 'good match for period', & + period/(24*3600), target_period + end if + write(*,*) + write(*,*) + write(*,*) + end subroutine report_test_results + + end function TDC_pulsation_extras_finish_step + + + include 'gyre_in_mesa_extras_finish_step.inc' + + + subroutine TDC_pulsation_extras_after_evolve(id, ierr) + integer, intent(in) :: id + integer, intent(out) :: ierr + ierr = 0 + call final() + end subroutine TDC_pulsation_extras_after_evolve + + + integer function TDC_pulsation_how_many_extra_history_columns(id) + integer, intent(in) :: id + integer :: ierr + type (star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + TDC_pulsation_how_many_extra_history_columns = 11 + end function TDC_pulsation_how_many_extra_history_columns + + + subroutine TDC_pulsation_data_for_extra_history_columns(id, n, names, vals, ierr) + integer, intent(in) :: id, n + character (len=maxlen_history_column_name) :: names(n) + real(dp) :: vals(n) + integer, intent(out) :: ierr + type (star_info), pointer :: s + integer :: i + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + i = 1 + names(i) = 'num_periods'; vals(i) = num_periods; i=i+1 + names(i) = 'period'; vals(i) = period/(24*3600); i=i+1 + names(i) = 'growth'; vals(i) = delta_R_growth_avg; i=i+1 + names(i) = 'max_v_div_cs'; vals(i) = period_max_v_div_cs; i=i+1 + names(i) = 'max_v_div_vesc'; vals(i) = period_max_v_div_vesc; i=i+1 + names(i) = 'delta_R'; vals(i) = period_delta_R/Rsun; i=i+1 + names(i) = 'delta_Teff'; vals(i) = period_delta_Teff; i=i+1 + names(i) = 'delta_logTeff'; vals(i) = period_delta_logTeff; i=i+1 + names(i) = 'delta_logL'; vals(i) = period_delta_logL; i=i+1 + names(i) = 'delta_Mag'; vals(i) = period_delta_Mag; i=i+1 + names(i) = 'KE_growth_avg'; vals(i) = KE_growth_avg; i = i+1 + + end subroutine TDC_pulsation_data_for_extra_history_columns + + + integer function TDC_pulsation_how_many_extra_profile_columns(id) + use star_def, only: star_info + integer, intent(in) :: id + integer :: ierr + type (star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + TDC_pulsation_how_many_extra_profile_columns = 0 ! 6 + end function TDC_pulsation_how_many_extra_profile_columns + + + subroutine TDC_pulsation_data_for_extra_profile_columns(id, n, nz, names, vals, ierr) + use star_def, only: star_info, maxlen_profile_column_name + use const_def, only: dp + integer, intent(in) :: id, n, nz + character (len=maxlen_profile_column_name) :: names(n) + real(dp) :: vals(nz,n) + integer, intent(out) :: ierr + type (star_info), pointer :: s + integer :: k + ierr = 0 + return + + + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + names(1) = 'xtra1' + names(2) = 'xtra2' + names(3) = 'xtra3' + names(4) = 'xtra4' + names(5) = 'xtra5' + names(6) = 'xtra6' + + do k=1,nz + vals(k,1) = s% xtra1_array(k) + vals(k,2) = s% xtra2_array(k) + vals(k,3) = s% xtra3_array(k) + vals(k,4) = s% xtra4_array(k) + vals(k,5) = s% xtra5_array(k) + vals(k,6) = s% xtra6_array(k) + end do + + end subroutine TDC_pulsation_data_for_extra_profile_columns + + + include 'gyre_in_mesa_extras_set_velocities.inc' + + diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation_defs.inc b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation_defs.inc new file mode 100644 index 000000000..b7b6e47b6 --- /dev/null +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras_TDC_pulsation_defs.inc @@ -0,0 +1,16 @@ + + ! GYRE "best" info + real(dp) :: best_period, best_cycles_to_double + integer :: best_model_number, best_order + + ! summary info at time of recently completely period + integer :: num_periods, run_num_steps_end_prev, & + run_num_iters_end_prev, run_num_retries_end_prev + real(dp) :: period, KE_growth, KE_growth_avg, prev_KE_max, & + delta_R_growth, delta_R_growth_avg, prev_delta_R, & + period_max_v_div_vesc, period_max_v_div_cs, period_delta_R, & + period_delta_Teff, period_delta_logTeff, & + period_delta_logL, period_delta_Mag + ! info for period in progress + real(dp) :: time_started, v_div_cs_max, v_div_vesc_max, & + KE_min, KE_max, R_min, R_max, L_min, L_max, T_min, T_max diff --git a/star/private/adjust_mesh_split_merge.f90 b/star/private/adjust_mesh_split_merge.f90 index e8f3bbe10..58b4ec6c7 100644 --- a/star/private/adjust_mesh_split_merge.f90 +++ b/star/private/adjust_mesh_split_merge.f90 @@ -20,7 +20,7 @@ module adjust_mesh_split_merge use star_private_def - use const_def, only: dp, ln10, pi4, four_thirds_pi + use const_def, only: dp, qp, ln10, pi4, four_thirds_pi use chem_def, only: ih1, ihe3, ihe4 use utils_lib use auto_diff_support @@ -832,6 +832,7 @@ subroutine do_split(s, i_split, species, tau_center, grad_xa, new_xa, ierr) grad_alpha, f, new_alphaL, new_alphaR, v_R, v_C, v_L, min_dm, & mlt_vcL, mlt_vcR, tauL, tauR, etrb, etrb_L, etrb_C, etrb_R, grad_etrb, & j_rot_new, dmbar_old, dmbar_p1_old, dmbar_new, dmbar_p1_new, dmbar_p2_new, J_old + real(qp) :: L_inner, dLdq_parent logical :: done, use_new_grad_rho include 'formats' @@ -1281,12 +1282,27 @@ subroutine do_split(s, i_split, species, tau_center, grad_xa, new_xa, ierr) end if if (s% i_lum /= 0) then - if (ip < nz_old) then - s% xh(s% i_lum,ip) = & - 0.5d0*(s% xh(s% i_lum,i) + s% xh(s% i_lum,ip+1)) + ! Keep the legacy split-face average unless the conservative L remap + ! option is enabled. + if (.not. s% use_conservative_L_remesh) then + if (ip < nz_old) then + s% xh(s% i_lum,ip) = & + 0.5d0*(s% xh(s% i_lum,i) + s% xh(s% i_lum,ip+1)) + else + s% xh(s% i_lum,ip) = & + 0.5d0*(s% xh(s% i_lum,i) + s% L_center) + end if else - s% xh(s% i_lum,ip) = & - 0.5d0*(s% xh(s% i_lum,i) + s% L_center) + if (ip < nz_old) then + L_inner = real(s% xh(s% i_lum,ip+1), qp) + else + L_inner = real(s% L_center, qp) + end if + ! Preserve the parent cell luminosity increment across the two + ! child cells instead of inserting the new face by averaging. + dLdq_parent = (real(s% xh(s% i_lum,i), qp) - L_inner)/ & + real(s% dq(i) + s% dq(ip), qp) + s% xh(s% i_lum,ip) = real(L_inner + dLdq_parent*real(s% dq(ip), qp), dp) end if end if diff --git a/star/private/ctrls_io.f90 b/star/private/ctrls_io.f90 index f9cae2aaa..16004f3de 100644 --- a/star/private/ctrls_io.f90 +++ b/star/private/ctrls_io.f90 @@ -111,7 +111,11 @@ module ctrls_io TDC_use_density_form_for_eddy_viscosity, & TDC_num_innermost_cells_forced_nonturbulent, TDC_num_outermost_cells_forced_nonturbulent, & include_mlt_Pturb_in_thermodynamic_gradients, & - include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, TDC_include_eturb_in_energy_equation, & + include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, & + TDC_arnett_growth_target, use_TDC_acceleration_limit, use_TDC_Af_split, & + use_conservative_L_remesh, & + use_face_values_eos_and_kap_mlt_tdc, & + TDC_include_eturb_in_energy_equation, & use_rsp_form_of_scale_height, include_mlt_in_velocity_time_centering, & TDC_hydro_use_mass_interp_face_values, TDC_hydro_nz, TDC_hydro_nz_outer, TDC_hydro_T_anchor, TDC_hydro_dq_1_factor, & @@ -2097,6 +2101,12 @@ subroutine store_controls(s, ierr) s% include_mlt_Pturb_in_thermodynamic_gradients = include_mlt_Pturb_in_thermodynamic_gradients s% include_mlt_corr_to_TDC = include_mlt_corr_to_TDC s% use_TDC_enthalpy_flux_limiter = use_TDC_enthalpy_flux_limiter + s% use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure + s% TDC_arnett_growth_target = TDC_arnett_growth_target + s% use_TDC_acceleration_limit = use_TDC_acceleration_limit + s% use_TDC_Af_split = use_TDC_Af_split + s% use_conservative_L_remesh = use_conservative_L_remesh + s% use_face_values_eos_and_kap_mlt_tdc = use_face_values_eos_and_kap_mlt_tdc s% TDC_include_eturb_in_energy_equation = TDC_include_eturb_in_energy_equation s% use_rsp_form_of_scale_height = use_rsp_form_of_scale_height s% include_mlt_in_velocity_time_centering = include_mlt_in_velocity_time_centering @@ -3808,6 +3818,12 @@ subroutine set_controls_for_writing(s, ierr) include_mlt_Pturb_in_thermodynamic_gradients = s% include_mlt_Pturb_in_thermodynamic_gradients include_mlt_corr_to_TDC = s% include_mlt_corr_to_TDC use_TDC_enthalpy_flux_limiter = s% use_TDC_enthalpy_flux_limiter + use_TDC_arnett_velocity_closure = s% use_TDC_arnett_velocity_closure + TDC_arnett_growth_target = s% TDC_arnett_growth_target + use_TDC_acceleration_limit = s% use_TDC_acceleration_limit + use_TDC_Af_split = s% use_TDC_Af_split + use_conservative_L_remesh = s% use_conservative_L_remesh + use_face_values_eos_and_kap_mlt_tdc = s% use_face_values_eos_and_kap_mlt_tdc TDC_include_eturb_in_energy_equation = s% TDC_include_eturb_in_energy_equation use_rsp_form_of_scale_height = s% use_rsp_form_of_scale_height include_mlt_in_velocity_time_centering = s% include_mlt_in_velocity_time_centering diff --git a/star/private/mesh_adjust.f90 b/star/private/mesh_adjust.f90 index 3e939771a..7cae5b44f 100644 --- a/star/private/mesh_adjust.f90 +++ b/star/private/mesh_adjust.f90 @@ -19,7 +19,7 @@ module mesh_adjust - use const_def, only: dp, ln10, one_third, four_thirds_pi + use const_def, only: dp, qp, ln10, one_third, four_thirds_pi use star_private_def use chem_def use interp_1d_def, only: pm_work_size @@ -170,7 +170,7 @@ subroutine do_mesh_adjust( & if (dbg) write(*,*) 'call do_L' call do_L( & s, nz, nz_old, nzlo, nzhi, comes_from, & - xh, xh_old, xq, xq_old_plus1, xq_new, & + xh, xh_old, dq, dq_old, xq, xq_old_plus1, xq_new, & work, tmp1, tmp2, ierr) if (failed('do_L')) return @@ -697,7 +697,7 @@ end subroutine do_xh_pt_var subroutine do_L( & s, nz, nz_old, nzlo, nzhi, comes_from, xh, xh_old, & - xq, xq_old_plus1, xq_new, work, L_old_plus1, L_new, ierr) + dq, dq_old, xq, xq_old_plus1, xq_new, work, old_dLdq, new_dLdq, ierr) use interp_1d_def use interp_1d_lib type (star_info), pointer :: s @@ -705,52 +705,97 @@ subroutine do_L( & real(dp), dimension(:,:), pointer :: xh, xh_old real(dp), dimension(:), pointer :: work real(dp), dimension(:) :: & - xq, xq_old_plus1, L_old_plus1, L_new, xq_new + dq, dq_old, xq, xq_old_plus1, old_dLdq, new_dLdq, xq_new integer, intent(out) :: ierr - integer :: n, i_lum, k + integer :: n, i_lum, k, k_old + real(qp) :: dLdq_integral, L_face include 'formats' ierr = 0 i_lum = s% i_lum if (i_lum == 0) return - n = nzhi - nzlo + 1 - do k=1,nz_old - L_old_plus1(k) = xh_old(i_lum,k) - end do - L_old_plus1(nz_old+1) = s% L_center + ! Preserve the historical face-L remap unless the new option is enabled. + if (.not. s% use_conservative_L_remesh) then + n = nzhi - nzlo + 1 - call interpolate_vector( & - nz_old+1, xq_old_plus1, n, xq_new, & - L_old_plus1, L_new, interp_pm, nwork, work, & - 'mesh_adjust do_L', ierr) - if (ierr /= 0) then - return + do k=1,nz_old + old_dLdq(k) = xh_old(i_lum,k) + end do + old_dLdq(nz_old+1) = s% L_center - write(*,*) 'interpolate_vector failed in do_L for remesh' - call mesa_error(__FILE__,__LINE__,'debug: mesh adjust: do_L') - end if + call interpolate_vector( & + nz_old+1, xq_old_plus1, n, xq_new, & + old_dLdq, new_dLdq, interp_pm, nwork, work, & + 'mesh_adjust do_L', ierr) + if (ierr /= 0) then + return - do k=nzlo,nzhi - xh(i_lum,k) = L_new(k+1-nzlo) - end do + write(*,*) 'interpolate_vector failed in do_L for remesh' + call mesa_error(__FILE__,__LINE__,'debug: mesh adjust: do_L') + end if - n = nzlo - 1 - if (n > 0) then - do k=1,n - xh(i_lum,k) = xh_old(i_lum,k) + do k=nzlo,nzhi + xh(i_lum,k) = new_dLdq(k+1-nzlo) end do - end if - if (nzhi < nz) then - n = nz - nzhi - 1 ! nz-n = nzhi+1 - do k=0,n - xh(i_lum,nz-k) = xh_old(i_lum,nz_old-k) - end do + n = nzlo - 1 + if (n > 0) then + do k=1,n + xh(i_lum,k) = xh_old(i_lum,k) + end do + end if + + if (nzhi < nz) then + n = nz - nzhi - 1 ! nz-n = nzhi+1 + do k=0,n + xh(i_lum,nz-k) = xh_old(i_lum,nz_old-k) + end do + end if + + return end if + ! Conservative option: remap the cell quantity dL/dq, then rebuild the + ! cumulative face luminosity profile from the center outward. + do k=1,nz_old + if (k < nz_old) then + old_dLdq(k) = (xh_old(i_lum,k) - xh_old(i_lum,k+1))/dq_old(k) + else + old_dLdq(k) = (xh_old(i_lum,k) - s% L_center)/dq_old(k) + end if + end do + + do k=1,nz + k_old = comes_from(k) + if (k_old < 1 .or. k_old > nz_old) then + ierr = -1 + return + end if + new_dLdq(k) = old_dLdq(k_old) + end do + + do k=nzlo,nzhi + k_old = comes_from(k) + if (k_old < 1 .or. k_old > nz_old) then + ierr = -1 + return + end if + call get_old_value_integral_qp( & + k, k_old, nz_old, xq_old_plus1, dq_old, xq(k), dq(k), & + old_dLdq, dLdq_integral, dbg, ierr) + if (ierr /= 0) return + new_dLdq(k) = real(dLdq_integral/real(dq(k),qp), dp) + end do + + L_face = real(s% L_center, qp) + do k=nz,1,-1 + L_face = L_face + real(new_dLdq(k),qp)*real(dq(k),qp) + xh(i_lum,k) = real(L_face, dp) + end do + end subroutine do_L @@ -1527,6 +1572,99 @@ subroutine get_old_value_integral( & end subroutine get_old_value_integral + subroutine get_old_value_integral_qp( & + k_new, k_old_in, nz_old, xq_old, dq_old, xq_outer, dq_range, & + value_old, integral, dbg, ierr) + integer, intent(in) :: k_new, k_old_in, nz_old + real(dp), intent(in) :: xq_old(:), dq_old(:), xq_outer, dq_range + real(dp), intent(in), dimension(:) :: value_old + real(qp), intent(out) :: integral + logical, intent(in) :: dbg + integer, intent(out) :: ierr + + integer :: k, k_old + real(qp) :: xq_inner, sum_dqs, old_xq_outer, old_xq_inner, & + dq_overlap, val, xq_outer_qp, dq_range_qp + + include 'formats' + + ! Use qp for the overlap geometry and accumulation because sign-changing + ! luminosity shells can make the reconstructed face L a small residual. + ierr = 0 + k_old = k_old_in + xq_outer_qp = real(xq_outer, qp) + dq_range_qp = real(dq_range, qp) + + do + if (k_old <= 1) exit + if (xq_old(k_old) <= xq_outer) exit + k_old = k_old - 1 + end do + + xq_inner = xq_outer_qp + dq_range_qp + old_xq_inner = real(xq_old(k_old), qp) + sum_dqs = 0.0_qp + integral = 0.0_qp + + if (dbg) write(*,*) + if (dbg) write(*,3) 'k_new k_old xq_outer xq_inner dq_range', & + k_new, k_old, xq_outer_qp, xq_inner, dq_range_qp + + do k = k_old, nz_old + + if (dq_range_qp <= sum_dqs) exit + old_xq_outer = old_xq_inner + if (k == nz_old) then + old_xq_inner = 1.0_qp + else + old_xq_inner = real(xq_old(k+1), qp) + end if + + if (dbg) write(*,3) 'k_new k_old old_xq_outer old_xq_inner', & + k_new, k, old_xq_outer, old_xq_inner + + val = real(value_old(k), qp) + + if (old_xq_inner <= xq_inner .and. old_xq_outer >= xq_outer_qp) then + + if (dbg) write(*,1) 'entire old cell is in new range' + + sum_dqs = sum_dqs + real(dq_old(k), qp) + integral = integral + val*real(dq_old(k), qp) + + else if (old_xq_inner >= xq_inner .and. old_xq_outer <= xq_outer_qp) then + + if (dbg) write(*,1) 'entire new range is in this old cell' + + sum_dqs = dq_range_qp + integral = val*dq_range_qp + + else + + if (xq_inner <= old_xq_inner) then + + if (dbg) write(*,1) 'last part of the new range' + + integral = integral + val*(dq_range_qp - sum_dqs) + sum_dqs = dq_range_qp + + else + + dq_overlap = max(0.0_qp, old_xq_inner - xq_outer_qp) + sum_dqs = sum_dqs + dq_overlap + integral = integral + val*dq_overlap + + if (dbg) write(*,1) 'partial overlap' + + end if + + end if + + end do + + end subroutine get_old_value_integral_qp + + subroutine get_old_integral( & k_new, k_old_in, nz_old, xq_old, dq_old, xq_outer, dq_range, & value_old, xh_old, integral, dbg, ierr) diff --git a/star/private/mlt_tdc_face_support.f90 b/star/private/mlt_tdc_face_support.f90 new file mode 100644 index 000000000..2dea8b1b4 --- /dev/null +++ b/star/private/mlt_tdc_face_support.f90 @@ -0,0 +1,354 @@ +! *********************************************************************** +! +! Copyright (C) 2010-2025 The MESA Team +! +! This program is free software: you can redistribute it and/or modify +! it under the terms of the GNU Lesser General Public License +! as published by the Free Software Foundation, +! either version 3 of the License, or (at your option) any later version. +! +! This program is distributed in the hope that it will be useful, +! but WITHOUT ANY WARRANTY; without even the implied warranty of +! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +! See the GNU Lesser General Public License for more details. +! +! You should have received a copy of the GNU Lesser General Public License +! along with this program. If not, see . +! +! *********************************************************************** + +module mlt_tdc_face_support + + use star_private_def + use const_def, only: dp, ln10, pi4, clight, crad + use auto_diff + use kap_support, only: get_kap + + implicit none + + private + public :: get_mlt_face_state_ad + public :: get_face_eos_kap_ad + public :: get_face_scale_height_ad + +contains + + ! Returns the MLT/TDC face thermodynamic state as + ! auto_diff_real_star_order1 quantities, either from recomputed face + ! EOS/opacity data or from the stored face quantities. + subroutine get_mlt_face_state_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, & + opacity_face, scale_height_face, gradr_face, ierr) + use star_utils, only: get_T_face, get_Peos_face, get_kap_face, get_rho_face, & + get_ChiRho_face, get_ChiT_face, get_Cp_face, get_grada_face, get_scale_height_face, get_gradr_face + + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: & + T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, & + opacity_face, scale_height_face, gradr_face + integer, intent(out) :: ierr + + ierr = 0 + if (s%use_face_values_eos_and_kap_mlt_tdc) then + call get_face_eos_kap_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face, ierr) + if (ierr /= 0) return + call set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) + call set_gradr_from_face_state(s, k, P_face, opacity_face, T_face, gradr_face) + else + T_face = get_T_face(s, k) + P_face = get_Peos_face(s, k) + opacity_face = get_kap_face(s, k) + rho_face = get_rho_face(s, k) + ChiRho_face = get_ChiRho_face(s, k) + ChiT_face = get_ChiT_face(s, k) + Cp_face = get_Cp_face(s, k) + grada_face = get_grada_face(s, k) + scale_height_face = get_scale_height_face(s, k) + gradr_face = get_gradr_face(s, k) + end if + end subroutine get_mlt_face_state_ad + + subroutine get_face_composition(s, k, use_starting_comp, zbar_face, xa_face, ierr) + use star_utils, only: get_face_weights + + type(star_info), pointer :: s + integer, intent(in) :: k + logical, intent(in) :: use_starting_comp + real(dp), intent(out) :: zbar_face + real(dp), intent(out) :: xa_face(:) + integer, intent(out) :: ierr + + real(dp) :: alfa, beta, sum_xa + + ierr = 0 + if (k == 1) then + alfa = 1d0 + beta = 0d0 + else + call get_face_weights(s, k, alfa, beta) + end if + + if (use_starting_comp) then + zbar_face = alfa*s%zbar_start(k) + beta*s%zbar_start(max(1, k-1)) + xa_face(1:s%species) = alfa*s%xa_start(1:s%species, k) + if (k > 1) xa_face(1:s%species) = xa_face(1:s%species) + beta*s%xa_start(1:s%species, k-1) + else + zbar_face = alfa*s%zbar(k) + beta*s%zbar(max(1, k-1)) + xa_face(1:s%species) = alfa*s%xa(1:s%species, k) + if (k > 1) xa_face(1:s%species) = xa_face(1:s%species) + beta*s%xa(1:s%species, k-1) + end if + + sum_xa = sum(xa_face) + if (sum_xa <= 0d0) then + ierr = -1 + return + end if + xa_face = xa_face/sum_xa + end subroutine get_face_composition + + + subroutine get_face_eos_inputs( & + s, k, T_face, rho_face, eos_res, d_dlnd, d_dlnT, ierr) + use eos_support, only: get_eos + use eos_def, only: num_eos_basic_results, num_eos_d_dxa_results + use star_utils, only: get_rho_face, get_T_face + + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: T_face, rho_face + real(dp), intent(out) :: eos_res(num_eos_basic_results), d_dlnd(num_eos_basic_results), d_dlnT(num_eos_basic_results) + integer, intent(out) :: ierr + + real(dp) :: log10_T, log10_rho, zbar_face + real(dp) :: eos_xa_face(s%species) + real(dp) :: d_dxa(num_eos_d_dxa_results, s%species) + + ierr = 0 + T_face = get_T_face(s, k) + rho_face = get_rho_face(s, k) + if (T_face%val <= 0d0 .or. rho_face%val <= 0d0) then + ierr = -1 + return + end if + + call get_face_composition(s, k, .false., zbar_face, eos_xa_face, ierr) + if (ierr /= 0) return + + log10_T = log10(T_face%val) + log10_rho = log10(rho_face%val) + + call get_eos( & + s, k, eos_xa_face, rho_face%val, log10_rho, T_face%val, log10_T, & + eos_res, d_dlnd, d_dlnT, d_dxa, ierr) + if (ierr /= 0) return + end subroutine get_face_eos_inputs + + + subroutine get_face_opacity_factor(s, k, log10_T, opacity_factor_face) + use star_utils, only: get_face_weights + + type(star_info), pointer :: s + integer, intent(in) :: k + real(dp), intent(in) :: log10_T + real(dp), intent(out) :: opacity_factor_face + + real(dp) :: alfa, beta + + if (k == 1) then + alfa = 1d0 + beta = 0d0 + else + call get_face_weights(s, k, alfa, beta) + end if + + opacity_factor_face = alfa*s%extra_opacity_factor(k) + if (k > 1) opacity_factor_face = opacity_factor_face + beta*s%extra_opacity_factor(k-1) + if (s%min_logT_for_opacity_factor_off > 0) then + if (log10_T >= s%max_logT_for_opacity_factor_off .or. & + log10_T <= s%min_logT_for_opacity_factor_off) then + opacity_factor_face = 1d0 + else if (log10_T > s%max_logT_for_opacity_factor_on) then + opacity_factor_face = 1d0 + (opacity_factor_face - 1d0)* & + (log10_T - s%max_logT_for_opacity_factor_off)/ & + (s%max_logT_for_opacity_factor_on - s%max_logT_for_opacity_factor_off) + else if (log10_T < s%min_logT_for_opacity_factor_on) then + opacity_factor_face = 1d0 + (opacity_factor_face - 1d0)* & + (log10_T - s%min_logT_for_opacity_factor_off)/ & + (s%min_logT_for_opacity_factor_on - s%min_logT_for_opacity_factor_off) + end if + end if + end subroutine get_face_opacity_factor + + + subroutine set_face_ad_from_value(value, dvalue_dlnd, dvalue_dlnT, T_face, rho_face, quantity_ad) + type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face + real(dp), intent(in) :: value, dvalue_dlnd, dvalue_dlnT + type(auto_diff_real_star_order1), intent(out) :: quantity_ad + type(auto_diff_real_star_order1) :: lnT_face, lnd_face + integer :: j + + lnd_face = log(rho_face) + lnT_face = log(T_face) + quantity_ad = 0d0 + quantity_ad%val = value + do j = 1, size(quantity_ad%d1Array) + quantity_ad%d1Array(j) = dvalue_dlnd*lnd_face%d1Array(j) + dvalue_dlnT*lnT_face%d1Array(j) + end do + end subroutine set_face_ad_from_value + + + subroutine set_face_ad_from_log(log_value, dlog_dlnd, dlog_dlnT, T_face, rho_face, quantity_ad) + type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face + real(dp), intent(in) :: log_value, dlog_dlnd, dlog_dlnT + type(auto_diff_real_star_order1), intent(out) :: quantity_ad + real(dp) :: value + + value = exp(log_value) + call set_face_ad_from_value(value, value*dlog_dlnd, value*dlog_dlnT, T_face, rho_face, quantity_ad) + end subroutine set_face_ad_from_log + + + ! Recomputes the face EOS and opacity state as + ! auto_diff_real_star_order1 quantities for the MLT/TDC solve, + ! instead of using the stored face quantities. + subroutine get_face_eos_kap_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face, ierr) + use eos_def, only: num_eos_basic_results, i_lnPgas, i_grad_ad, i_gamma1, i_Cp, i_chiRho, i_chiT, i_eta, i_lnfree_e + use kap_def, only: num_kap_fracs + + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face + integer, intent(out) :: ierr + + real(dp) :: log10_T, log10_rho, kap_zbar_face, opacity_factor_face + real(dp) :: eos_res(num_eos_basic_results), d_dlnd(num_eos_basic_results), d_dlnT(num_eos_basic_results) + real(dp) :: kap, dlnkap_dlnd, dlnkap_dlnT + real(dp) :: kap_fracs(num_kap_fracs), kap_xa_face(s%species) + type(auto_diff_real_star_order1) :: Pgas_face, gamma1_face, mlt_Pturb_ad, alpha + + ierr = 0 + call get_face_eos_inputs( & + s, k, T_face, rho_face, eos_res, d_dlnd, d_dlnT, ierr) + if (ierr /= 0) return + log10_T = log10(T_face%val) + log10_rho = log10(rho_face%val) + + call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), T_face, rho_face, Pgas_face) + P_face = Pgas_face + crad*pow4(T_face)/3d0 + call set_face_ad_from_value(eos_res(i_Cp), d_dlnd(i_Cp), d_dlnT(i_Cp), T_face, rho_face, Cp_face) + call set_face_ad_from_value(eos_res(i_chiRho), d_dlnd(i_chiRho), d_dlnT(i_chiRho), T_face, rho_face, ChiRho_face) + call set_face_ad_from_value(eos_res(i_chiT), d_dlnd(i_chiT), d_dlnT(i_chiT), T_face, rho_face, ChiT_face) + call set_face_ad_from_value(eos_res(i_grad_ad), d_dlnd(i_grad_ad), d_dlnT(i_grad_ad), T_face, rho_face, grada_face) + call set_face_ad_from_value(eos_res(i_gamma1), d_dlnd(i_gamma1), d_dlnT(i_gamma1), T_face, rho_face, gamma1_face) + + call get_face_composition(s, k, s% use_starting_composition_for_kap, kap_zbar_face, kap_xa_face, ierr) + if (ierr /= 0) return + call get_face_opacity_factor(s, k, log10_T, opacity_factor_face) + + call get_kap( & + s, k, kap_zbar_face, kap_xa_face, log10_rho, log10_T, & + eos_res(i_lnfree_e), d_dlnd(i_lnfree_e), d_dlnT(i_lnfree_e), & + eos_res(i_eta), d_dlnd(i_eta), d_dlnT(i_eta), & + kap_fracs, kap, dlnkap_dlnd, dlnkap_dlnT, ierr) + if (ierr /= 0 .or. is_bad_num(kap) .or. kap <= 0d0) return + + kap = kap*opacity_factor_face + if (s%opacity_max > 0d0 .and. kap > s%opacity_max) then + kap = s%opacity_max + dlnkap_dlnd = 0d0 + dlnkap_dlnT = 0d0 + end if + if (s%opacity_min > 0d0 .and. kap < s%opacity_min) then + kap = s%opacity_min + dlnkap_dlnd = 0d0 + dlnkap_dlnT = 0d0 + end if + call set_face_ad_from_value(kap, kap*dlnkap_dlnd, kap*dlnkap_dlnT, T_face, rho_face, opacity_face) + + if (s% have_mlt_vc .and. s% okay_to_set_mlt_vc .and. s% include_mlt_Pturb_in_thermodynamic_gradients & + .and. s% mlt_Pturb_factor > 0d0 .and. k > 1) then + mlt_Pturb_ad = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*rho_face/3d0 + alpha = mlt_Pturb_ad/(P_face*gamma1_face) + grada_face = grada_face*(P_face + mlt_Pturb_ad)/(P_face*(1d0 + alpha)) + end if + end subroutine get_face_eos_kap_ad + + + ! Recomputes the face pressure scale height as an + ! auto_diff_real_star_order1 quantity from the recomputed face state. + subroutine get_face_scale_height_ad(s, k, scale_height_face, ierr) + use eos_def, only: num_eos_basic_results, i_lnPgas + + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: scale_height_face + integer, intent(out) :: ierr + + real(dp) :: eos_res(num_eos_basic_results), d_dlnd(num_eos_basic_results), d_dlnT(num_eos_basic_results) + type(auto_diff_real_star_order1) :: T_face, rho_face, Pgas_face, P_face + + ierr = 0 + call get_face_eos_inputs( & + s, k, T_face, rho_face, eos_res, d_dlnd, d_dlnT, ierr) + if (ierr /= 0) return + + call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), T_face, rho_face, Pgas_face) + P_face = Pgas_face + crad*pow4(T_face)/3d0 + + call set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) + end subroutine get_face_scale_height_ad + + + subroutine set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) + use auto_diff_support, only: wrap_r_00 + + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(in) :: P_face, rho_face + type(auto_diff_real_star_order1), intent(out) :: scale_height_face + + real(dp) :: G + type(auto_diff_real_star_order1) :: grav, scale_height2 + + G = s%cgrav(k) + grav = G*s%m_grav(k)/pow2(wrap_r_00(s,k)) + scale_height_face = P_face/(grav*rho_face) + if (s%alt_scale_height_flag) then + scale_height2 = sqrt(P_face/G)/rho_face + if (scale_height2 < scale_height_face) scale_height_face = scale_height2 + end if + end subroutine set_scale_height_from_face_state + + + subroutine set_gradr_from_face_state(s, k, P_face, opacity_face, T_face, gradr_face) + use auto_diff_support, only: wrap_L_00 + + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(in) :: P_face, opacity_face, T_face + type(auto_diff_real_star_order1), intent(out) :: gradr_face + + real(dp) :: L_theta + type(auto_diff_real_star_order1) :: L_face, Pr_face + + if (s%include_mlt_in_velocity_time_centering) then + if (s%using_velocity_time_centering .and. & + s%include_L_in_velocity_time_centering .and. & + s%lnT(k) <= s%max_logT_for_include_P_and_L_in_velocity_time_centering*ln10) then + L_theta = s%L_theta_for_velocity_time_centering + else + L_theta = 1d0 + end if + L_face = L_theta*wrap_L_00(s, k) + (1d0 - L_theta)*s%L_start(k) + else + L_face = wrap_L_00(s, k) + end if + + Pr_face = crad*pow4(T_face)/3d0 + gradr_face = P_face*opacity_face*L_face/(4d0*pi4*clight*s%m_grav(k)*s%cgrav(k)*Pr_face) + end subroutine set_gradr_from_face_state + +end module mlt_tdc_face_support diff --git a/star/private/struct_burn_mix.f90 b/star/private/struct_burn_mix.f90 index 387bda8d2..c7f150ca4 100644 --- a/star/private/struct_burn_mix.f90 +++ b/star/private/struct_burn_mix.f90 @@ -305,6 +305,7 @@ subroutine save_start_values(s, ierr) s% u_face_start(k) = 0d0 ! s% u_face_ad(k)%val s% P_face_start(k) = -1d0 ! mark as unset s% P_face_ad(k)%val s% L_start(k) = s% L(k) + s% Y_face_start(k) = s% Y_face(k) s% omega_start(k) = s% omega(k) s% ye_start(k) = s% ye(k) s% j_rot_start(k) = s% j_rot(k) @@ -1209,5 +1210,3 @@ end subroutine burn1_zone end module struct_burn_mix - - diff --git a/star/private/tdc_hydro.f90 b/star/private/tdc_hydro.f90 index 3b10b394c..4258fdb61 100644 --- a/star/private/tdc_hydro.f90 +++ b/star/private/tdc_hydro.f90 @@ -26,6 +26,7 @@ module tdc_hydro use auto_diff_support use accurate_sum_auto_diff_star_order1 use star_utils + use mlt_tdc_face_support, only: get_face_scale_height_ad implicit none @@ -60,7 +61,8 @@ subroutine set_viscosity_vars_TDC(s, ierr) ! Hp_face(k) <= 0 means it needs to be set. e.g., after read file if (s%Hp_face(k) <= 0) then ! this scale height for face is already calculated in TDC - s%Hp_face(k) = get_scale_height_face_val(s, k) ! because this is called before s% scale_height(k) is updated in mlt_vars. + s%Hp_face(k) = get_TDC_alpha_M_Hp_face_val(s, k, op_err) ! because this is called before s% scale_height(k) is updated in mlt_vars. + if (op_err /= 0) ierr = op_err end if end do !$OMP END PARALLEL DO @@ -104,14 +106,48 @@ subroutine get_TDC_alfa_beta_face_weights(s, k, alfa, beta) end subroutine get_TDC_alfa_beta_face_weights + function get_TDC_alpha_M_Hp_face(s, k, ierr) result(Hp_face) + type(star_info), pointer :: s + integer, intent(in) :: k + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: Hp_face + + ierr = 0 + if (s%use_face_values_eos_and_kap_mlt_tdc) then + call get_face_scale_height_ad(s, k, Hp_face, ierr) + else + Hp_face = get_scale_height_face(s, k) + end if + end function get_TDC_alpha_M_Hp_face + + + real(dp) function get_TDC_alpha_M_Hp_face_val(s, k, ierr) result(Hp_face) + type(star_info), pointer :: s + integer, intent(in) :: k + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: Hp_face_ad + + Hp_face_ad = get_TDC_alpha_M_Hp_face(s, k, ierr) + if (ierr /= 0) then + Hp_face = -1d0 + else + Hp_face = Hp_face_ad%val + end if + end function get_TDC_alpha_M_Hp_face_val + + function wrap_Hp_cell(s, k) result(Hp_cell) ! cm , different than rsp2 type(star_info), pointer :: s integer, intent(in) :: k + integer :: ierr type(auto_diff_real_star_order1) :: Hp1, Hp0, Hp_cell - Hp0 = get_scale_height_face(s,k) + ierr = 0 + Hp0 = get_TDC_alpha_M_Hp_face(s, k, ierr) + if (ierr /= 0) return Hp1 = 0d0 if (k+1 < s%nz) then - Hp1 = shift_p1(get_scale_height_face(s,k+1)) + Hp1 = shift_p1(get_TDC_alpha_M_Hp_face(s, k+1, ierr)) + if (ierr /= 0) return end if Hp_cell = 0.5d0*(Hp0 + Hp1) !0.5d0*(wrap_Hp_00(s, k) + wrap_Hp_p1(s, k)) @@ -256,7 +292,7 @@ function compute_Chi_div_w_face(s, k, ierr) result(Chi_face) k > s%nz - s% TDC_num_innermost_cells_forced_nonturbulent) then Chi_face = 0d0 else - Hp_face = get_scale_height_face(s,k) !Hp_cell_for_Chi(s, k, ierr) + Hp_face = get_TDC_alpha_M_Hp_face(s, k, ierr) !Hp_cell_for_Chi(s, k, ierr) if (ierr /= 0) return if (s%TDC_use_density_form_for_eddy_viscosity) then ! new density derivative form @@ -451,7 +487,7 @@ function compute_d_v_div_r(s, k, ierr) result(d_v_div_r) ! s^-1 integer, intent(in) :: k type(auto_diff_real_star_order1) :: d_v_div_r integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: v_00, v_p1, r_00, r_p1, term1, term2 + type(auto_diff_real_star_order1) :: v_00, v_p1, r_00, r_p1 logical :: dbg include 'formats' ierr = 0 @@ -472,6 +508,8 @@ function compute_d_v_div_r(s, k, ierr) result(d_v_div_r) ! s^-1 end if end function compute_d_v_div_r + ! Currently unused. Kept as the cell-centered opt-time-centered counterpart + ! to the face version below in case that path is revived later. function compute_d_v_div_r_opt_time_center(s, k, ierr) result(d_v_div_r) ! s^-1 type(star_info), pointer :: s integer, intent(in) :: k @@ -580,7 +618,7 @@ function compute_d_v_div_r_face(s, k, ierr) result(d_v_div_r) ! s^-1 integer, intent(in) :: k type(auto_diff_real_star_order1) :: d_v_div_r integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1, term1, term2 + type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1 logical :: dbg include 'formats' ierr = 0 @@ -620,7 +658,7 @@ function compute_d_v_div_r_opt_time_center_face(s, k, ierr) result(d_v_div_r) ! integer, intent(in) :: k type(auto_diff_real_star_order1) :: d_v_div_r integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1, term1, term2 + type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1 logical :: dbg include 'formats' ierr = 0 diff --git a/star/private/turb_info.f90 b/star/private/turb_info.f90 index 52913e5e8..583e45b56 100644 --- a/star/private/turb_info.f90 +++ b/star/private/turb_info.f90 @@ -22,6 +22,7 @@ module turb_info use star_private_def use const_def, only: dp, i8, ln10, pi4, no_mixing, convective_mixing, crystallized, phase_separation_mixing + use mlt_tdc_face_support, only: get_mlt_face_state_ad use num_lib use utils_lib use auto_diff_support @@ -90,7 +91,8 @@ subroutine do1_mlt_2(s, k, & real(dp) :: crystal_pad logical :: no_mix type(auto_diff_real_star_order1) :: & - grada_face_ad, scale_height_ad, gradr_ad, rho_face_ad, & + T_face_ad, P_face_ad, opacity_face_ad, rho_face_ad, chiRho_face_ad, chiT_face_ad, Cp_face_ad, & + grada_face_ad, scale_height_ad, gradr_ad, & gradT_ad, Y_face_ad, mlt_vc_ad, D_ad, Gamma_ad include 'formats' @@ -118,9 +120,14 @@ subroutine do1_mlt_2(s, k, & gradL_composition_term = 0d0 end if - grada_face_ad = get_grada_face(s,k) - scale_height_ad = get_scale_height_face(s,k) - gradr_ad = get_gradr_face(s,k) + ! Assemble the full face-state thermo bundle for the MLT/TDC solve. + ! This helper either computes EOS and kap on faces directly or + ! recomputes them from face wrapped primitives, and returns consistent + ! T, P, rho, kap, Cp, chiRho, chiT, grada, gradr, and scale height values. + call get_mlt_face_state_ad( & + s, k, T_face_ad, rho_face_ad, P_face_ad, Cp_face_ad, chiRho_face_ad, chiT_face_ad, & + grada_face_ad, opacity_face_ad, scale_height_ad, gradr_ad, ierr) + if (ierr /= 0) return if (s% rotation_flag .and. s% mlt_use_rotation_correction) then gradr_factor = s% ft_rot(k)/s% fp_rot(k)*s% gradr_factor(k) @@ -223,6 +230,7 @@ subroutine do1_mlt_2(s, k, & end if call do1_mlt_eval(s, k, s% MLT_option, gradL_composition_term, & + T_face_ad, P_face_ad, opacity_face_ad, rho_face_ad, chiRho_face_ad, chiT_face_ad, Cp_face_ad, & gradr_ad, grada_face_ad, scale_height_ad, mixing_length_alpha, & mixing_type, gradT_ad, Y_face_ad, mlt_vc_ad, D_ad, Gamma_ad, ierr) if (ierr /= 0) then diff --git a/star/private/turb_support.f90 b/star/private/turb_support.f90 index af4758200..6cc0db478 100644 --- a/star/private/turb_support.f90 +++ b/star/private/turb_support.f90 @@ -110,6 +110,7 @@ end subroutine get_gradT subroutine do1_mlt_eval( & s, k, MLT_option, gradL_composition_term, & + T_in, P_in, opacity_in, rho_in, chiRho_in, chiT_in, Cp_in, & gradr_in, grada, scale_height, mixing_length_alpha, & mixing_type, gradT, Y_face, mlt_vc, D, Gamma, ierr) use chem_def, only: ih1 @@ -118,7 +119,9 @@ subroutine do1_mlt_eval( & type (star_info), pointer :: s integer, intent(in) :: k character (len=*), intent(in) :: MLT_option - type(auto_diff_real_star_order1), intent(in) :: gradr_in, grada, scale_height + type(auto_diff_real_star_order1), intent(in) :: & + T_in, P_in, opacity_in, rho_in, chiRho_in, chiT_in, Cp_in, & + gradr_in, grada, scale_height real(dp), intent(in) :: gradL_composition_term, mixing_length_alpha integer, intent(out) :: mixing_type type(auto_diff_real_star_order1), intent(out) :: & @@ -133,7 +136,7 @@ subroutine do1_mlt_eval( & ierr = 0 - P = get_Peos_face(s,k) ! if u_flag, should this be P_face_ad? (time centered in riemann) + P = P_in ! if u_flag, should this be P_face_ad? (time centered in riemann) if (s% include_mlt_in_velocity_time_centering) then ! could be cleaner with a wrapper for time_centered P and L if (s% using_velocity_time_centering .and. & @@ -161,14 +164,14 @@ subroutine do1_mlt_eval( & gradr = gradr_in cgrav = s% cgrav(k) m = s% m_grav(k) - T = get_T_face(s,k) - opacity = get_kap_face(s,k) - rho = get_rho_face(s,k) + T = T_in + 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. - chiRho = get_ChiRho_face(s,k) - chiT = get_ChiT_face(s,k) - Cp = get_Cp_face(s,k) + chiRho = chiRho_in + chiT = chiT_in + Cp = Cp_in energy = get_e_face(s,k) iso = s% dominant_iso_for_thermohaline(k) XH1 = s% xa(s% net_iso(ih1),k) @@ -222,8 +225,7 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg real(dp) :: Gamma_limit, scale_value1, scale_value2, diff_grads_limit, reduction_limit, lambda_limit type(auto_diff_real_star_order1) :: Lrad_div_Ledd, Gamma_inv_threshold, Gamma_factor, alfa0, & diff_grads_factor, Gamma_term, exp_limit, grad_scale, gradr_scaled, Eq_div_w, check_Eq, mlt_Pturb, Ptot - logical :: test_partials, using_TDC - logical, parameter :: report = .false. + logical :: test_partials, using_TDC, report include 'formats' ! check if this particular k can be done with TDC @@ -233,6 +235,8 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg if (k <= 0 .or. s%dt <= 0d0) using_TDC = .false. if (using_TDC) using_TDC = .not. check_if_must_fall_back_to_MLT(s, k) + report = .false. + ! Pre-calculate some things. Eq_div_w = 0d0 if ((s% v_flag .or. s% u_flag) .and. k > 0 ) then ! only include Eq_div_w if v_flag or u_flag is true. @@ -316,7 +320,6 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg else conv_vel_start = s% mlt_vc(k) end if - ! Set scale for judging the TDC luminosity equation Q(Y)=0. ! Q has units of a luminosity, so the scale should be a luminosity. if (s% solver_iter == 0) then @@ -326,12 +329,14 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg end if call set_TDC(& - conv_vel_start, mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & + conv_vel_start, s%Y_face_start(k), mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & s%dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr, r, Ptot, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & - s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, energy, ierr) + s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & + s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, s% TDC_arnett_growth_target, & + energy, ierr) s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt if (ierr /= 0) then @@ -347,12 +352,14 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg call set_superad_reduction if (Gamma_factor > 1d0) then call set_TDC(& - conv_vel_start, mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & + conv_vel_start, s%Y_face_start(k), mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & s%dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr_scaled, r, Ptot, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & - s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, energy, ierr) + s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & + s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, s% TDC_arnett_growth_target, & + energy, ierr) s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt if (ierr /= 0) then if (s% report_ierr) write(*,*) 'ierr from set_TDC when using superad_reduction' diff --git a/star_data/private/star_controls_dev.inc b/star_data/private/star_controls_dev.inc index 4b8d983e1..5ef3ca8fb 100644 --- a/star_data/private/star_controls_dev.inc +++ b/star_data/private/star_controls_dev.inc @@ -4,6 +4,12 @@ logical :: TDC_use_density_form_for_eddy_viscosity logical :: include_mlt_Pturb_in_thermodynamic_gradients logical :: use_TDC_enthalpy_flux_limiter + logical :: use_TDC_arnett_velocity_closure + logical :: use_TDC_acceleration_limit + logical :: use_TDC_Af_split + logical :: use_conservative_L_remesh + logical :: use_face_values_eos_and_kap_mlt_tdc + integer :: TDC_arnett_growth_target logical :: include_mlt_in_velocity_time_centering logical :: use_hydro_merge_limits_in_mesh_plan diff --git a/turb/Makefile b/turb/Makefile index 1f168d2d6..4ace0bc5f 100644 --- a/turb/Makefile +++ b/turb/Makefile @@ -9,7 +9,8 @@ SRCS := public/turb.f90 \ private/tdc.f90 \ private/thermohaline.f90 \ private/semiconvection.f90 -SRCS_CHECK := test/src/test_turb.f90 +SRCS_CHECK := test/src/test_time_dependence_support.f90 \ + test/src/test_turb.f90 INTERNAL_DEPENDS_ON := const utils auto_diff num chem # Test dependency INTERNAL_DEPENDS_ON += math diff --git a/turb/private/tdc.f90 b/turb/private/tdc.f90 index d8bfa7daa..e4d61cb0a 100644 --- a/turb/private/tdc.f90 +++ b/turb/private/tdc.f90 @@ -210,6 +210,7 @@ subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_ite ! Process Y into the various outputs. call compute_Q(info, Y, Q, Af) + if (info%use_TDC_acceleration_limit) call apply_postsolve_TDC_acceleration_limit(info, Y, Af) Y_face = unconvert(Y) conv_vel = sqrt_2_div_3*unconvert(Af) diff --git a/turb/private/tdc_support.f90 b/turb/private/tdc_support.f90 index 99d02e5b7..4eec995db 100644 --- a/turb/private/tdc_support.f90 +++ b/turb/private/tdc_support.f90 @@ -26,6 +26,10 @@ module tdc_support implicit none +integer, parameter :: TDC_arnett_growth_target_mlt = 0 +integer, parameter :: TDC_arnett_growth_target_tdc_no_mlt_corr = 1 +integer, parameter :: TDC_arnett_growth_target_tdc_with_mlt_corr = 2 + private public :: set_Y public :: Q_bisection_search @@ -38,6 +42,10 @@ module tdc_support public :: eval_Af public :: eval_xis public :: compute_Q +public :: apply_postsolve_TDC_acceleration_limit +public :: TDC_arnett_growth_target_mlt +public :: TDC_arnett_growth_target_tdc_no_mlt_corr +public :: TDC_arnett_growth_target_tdc_with_mlt_corr !> Stores the information which is required to evaluate TDC-related quantities and which !! do not depend on Y. @@ -63,13 +71,62 @@ module tdc_support !! @param Gamma Gamma is the MLT Gamma efficiency parameter, which we evaluate in steady state from MLT. type tdc_info logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter + logical :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split + integer :: TDC_arnett_growth_target real(dp) :: mixing_length_alpha, TDC_alpha_C, TDC_alpha_S, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, e - type(auto_diff_real_tdc) :: A0, c0, L, L0, gradL, grada - type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h + type(auto_diff_real_tdc) :: A0, A_mlt, c0, L, L0, gradL, grada, Y_start + type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h, grav, chiT, chiRho end type tdc_info contains + subroutine eval_Af_state(dt, A0, xi0, xi1, xi2, Af) + type(auto_diff_real_tdc), intent(in) :: dt, A0, xi0, xi1, xi2 + type(auto_diff_real_tdc), intent(out) :: Af + + type(auto_diff_real_tdc) :: J, J2, Jt4, num, den, y_for_atan, root + + if (dt%val <= 0d0) then + Af = A0 + return + end if + + J2 = pow2(xi1) - 4d0 * xi0 * xi2 + + if (J2 > 0d0) then + J = sqrt(abs(J2)) + Jt4 = 0.25d0 * dt * J + num = safe_tanh(Jt4) * (2d0 * xi0 + A0 * xi1) + A0 * J + den = safe_tanh(Jt4) * (xi1 + 2d0 * A0 * xi2) - J + Af = num / den + if (Af < 0d0) Af = -Af + else if (J2 < 0d0) then + J = sqrt(abs(J2)) + Jt4 = 0.25d0 * dt * J + + y_for_atan = xi1 + 2d0 * A0 * xi2 + root = atan(xi1 / J) - atan(y_for_atan / J) + + if (root > pi) then + root = root - pi + else if (root < -pi) then + root = root + 2d0*pi + else if (root < 0d0) then + root = root + pi + end if + + if (Jt4 < root) then + num = -xi1 + J * tan(Jt4 + atan(y_for_atan / J)) + den = 2d0 * xi2 + Af = num / den + else + Af = 0d0 + end if + else + Af = A0 + end if + end subroutine eval_Af_state + !> Y = +- exp(Z) !! If Y > 0, Y = exp(Z) !! If Y < 0, Y = -exp(Z) @@ -446,9 +503,100 @@ type(auto_diff_real_star_order1) function unconvert(K_in) result(K) K%d1Array = K_in%d1Array(1:SIZE(K%d1Array)) end function unconvert + type(auto_diff_real_tdc) function eval_A_target_arnett_growth(info, Y) result(A_target) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: Y + + select case (info%TDC_arnett_growth_target) + case (TDC_arnett_growth_target_mlt) + A_target = info%A_mlt + case (TDC_arnett_growth_target_tdc_no_mlt_corr) + A_target = eval_Af_tdc_steady_state(info, Y, .false.) + case (TDC_arnett_growth_target_tdc_with_mlt_corr) + A_target = eval_Af_tdc_steady_state(info, Y, .true.) + case default + call mesa_error(__FILE__,__LINE__,'bad TDC_arnett_growth_target') + end select + end function eval_A_target_arnett_growth + + type(auto_diff_real_tdc) function eval_Af_single_state(info, Y, A_start, dt_step) result(Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: Y, A_start, dt_step + type(auto_diff_real_tdc) :: xi0, xi1, xi2, Y_env, A_target + + if (dt_step%val <= 0d0) then + Af = A_start + return + end if + + if (info%use_TDC_arnett_velocity_closure) then + if (Y > 0d0) then + A_target = eval_A_target_arnett_growth(info, Y) + Af = eval_Af_arnett_growth_to_target_step(info, dt_step, A_start, A_target) + else + Af = eval_Af_arnett_decay_from_state_step(info, dt_step, Y, A_start) + end if + else + if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then + Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) + else + Y_env = Y + end if + call eval_xis(info, Y_env, xi0, xi1, xi2) + Af = eval_Af_ad(dt_step, A_start, xi0, xi1, xi2) + end if + end function eval_Af_single_state + + type(auto_diff_real_tdc) function eval_Af_split(info, Y) result(Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: Y + type(auto_diff_real_tdc) :: dt_full, dt1, dt2, A1 + real(dp), parameter :: tiny = 1d-30 + + dt_full = info%dt + + ! Exact-boundary cases are handled by the limiting split: + ! if Y_start = 0, the crossing is at t = 0 and the end-state branch + ! applies for the full step; if Y = 0, the crossing is at t = dt and + ! the start-state branch applies for the full step. + if (abs(info%Y_start%val) <= tiny) then + Af = eval_Af_single_state(info, Y, info%A0, dt_full) + return + else if (abs(Y%val) <= tiny) then + Af = eval_Af_single_state(info, info%Y_start, info%A0, dt_full) + return + end if + + if ((info%Y_start > 0d0 .and. Y > 0d0) .or. (info%Y_start < 0d0 .and. Y < 0d0)) then + Af = eval_Af_single_state(info, Y, info%A0, dt_full) + return + end if + + dt1 = dt_full * info%Y_start / (info%Y_start - Y) + dt2 = dt_full - dt1 + + if (dt1%val <= tiny) then + Af = eval_Af_single_state(info, Y, info%A0, dt2) + return + else if (dt2%val <= tiny) then + Af = eval_Af_single_state(info, info%Y_start, info%A0, dt1) + return + end if + + if (info%Y_start < 0d0 .and. Y > 0d0) then + A1 = eval_Af_single_state(info, info%Y_start, info%A0, dt1) + Af = eval_Af_single_state(info, Y, A1, dt2) + else if (info%Y_start > 0d0 .and. Y < 0d0) then + A1 = eval_Af_single_state(info, info%Y_start, info%A0, dt1) + Af = eval_Af_single_state(info, Y, A1, dt2) + else + Af = eval_Af_single_state(info, Y, info%A0, dt_full) + end if + end function eval_Af_split + !> Q is the residual in the TDC equation, namely: !! - !! Q = (L - L0 * gradL) - (L0 + c0 * Af) * Y + !! Q = (L - L0 * gradL) - L0 * Y - c0 * Af * Y_env !! !! @param info tdc_info type storing various quantities that are independent of Y. !! @param Y superadiabaticity @@ -458,8 +606,7 @@ subroutine compute_Q(info, Y, Q, Af) type(tdc_info), intent(in) :: info type(auto_diff_real_tdc), intent(in) :: Y type(auto_diff_real_tdc), intent(out) :: Q, Af - type(auto_diff_real_tdc) :: xi0, xi1, xi2, Y_env - real(dp), parameter :: x_ALFAS = (1.d0/2.d0)*sqrt_2_div_3 + type(auto_diff_real_tdc) :: Y_env, dt_step ! Y = grad-gradL ! Gamma=(grad-gradE)/(gradE-gradL) @@ -470,15 +617,18 @@ subroutine compute_Q(info, Y, Q, Af) ! We only use Y_env /= Y when Y > 0 (i.e. the system is convectively unstable) ! because we only have a Gamma from MLT in that case. ! so when Y < 0 we just use Y_env = Y. - if (Y > 0 .and. info%include_mlt_corr_to_TDC) then + if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) else Y_env = Y end if + dt_step = info%dt - ! Y_env sets the acceleration of blobs. - call eval_xis(info, Y_env, xi0, xi1, xi2) - Af = eval_Af(info%dt, info%A0, xi0, xi1, xi2) + if (info%use_TDC_Af_split) then + Af = eval_Af_split(info, Y) + else + Af = eval_Af_single_state(info, Y, info%A0, dt_step) + end if ! Y_env sets the convective flux but not the radiative flux. Q = (info%L - info%L0*info%gradL) - info%L0 * Y - info%c0*Af*Y_env @@ -630,52 +780,180 @@ function eval_Af(dt, A0, xi0, xi1, xi2) result(Af) real(dp), intent(in) :: dt type(auto_diff_real_tdc), intent(in) :: A0, xi0, xi1, xi2 type(auto_diff_real_tdc) :: Af ! output - type(auto_diff_real_tdc) :: J2, J, Jt4, num, den, y_for_atan, root + type(auto_diff_real_tdc) :: dt_ad - J2 = pow2(xi1) - 4d0 * xi0 * xi2 + dt_ad = dt + Af = eval_Af_ad(dt_ad, A0, xi0, xi1, xi2) + end function eval_Af - if (J2 > 0d0) then ! Hyperbolic branch - J = sqrt(abs(J2)) ! Only compute once we know J2 is not 0 - Jt4 = 0.25d0 * dt * J - num = safe_tanh(Jt4) * (2d0 * xi0 + A0 * xi1) + A0 * J - den = safe_tanh(Jt4) * (xi1 + 2d0 * A0 * xi2) - J - Af = num / den - if (Af < 0d0) then - Af = -Af - end if - else if (J2 < 0d0) then ! Trigonometric branch - J = sqrt(abs(J2)) ! Only compute once we know J2 is not 0 - Jt4 = 0.25d0 * dt * J + type(auto_diff_real_tdc) function eval_Af_ad(dt, A0, xi0, xi1, xi2) result(Af) + type(auto_diff_real_tdc), intent(in) :: dt, A0, xi0, xi1, xi2 - ! This branch contains decaying solutions that reach A = 0, at which point - ! they switch onto the 'zero' branch. So we have to calculate the position of - ! the first root to check it against dt. - y_for_atan = xi1 + 2d0 * A0 * xi2 - root = atan(xi1 / J) - atan(y_for_atan / J) + call eval_Af_state(dt, A0, xi0, xi1, xi2, Af) - ! The root enters into a tangent, so we can freely shift it by pi and - ! get another root. We care about the first positive root, and the above prescription - ! is guaranteed to give an answer between (-2*pi,2*pi) because atan produces an answer in [-pi,pi], - ! so we add/subtract a multiple of pi to get the root into [0,pi). - if (root > pi) then - root = root - pi - else if (root < -pi) then - root = root + 2d0*pi - else if (root < 0d0) then - root = root + pi - end if + end function eval_Af_ad - if (Jt4 < root) then - num = -xi1 + J * tan(Jt4 + atan(y_for_atan / J)) - den = 2d0 * xi2 - Af = num / den + !> Calculates the end-of-step convective speed on the unstable side for + !! the Arnett 1969 closure, given a steady-state target speed. + !! + !! @param info tdc_info type storing various quantities that are independent of Y. + !! @param A_target The steady-state target convective speed. + type(auto_diff_real_tdc) function eval_Af_arnett_growth_to_target(info, A_target) result(Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: A_target + type(auto_diff_real_tdc) :: dt_step + + dt_step = info%dt + Af = eval_Af_arnett_growth_to_target_step(info, dt_step, info%A0, A_target) + end function eval_Af_arnett_growth_to_target + + type(auto_diff_real_tdc) function eval_Af_arnett_growth_to_target_step(info, dt_step, A_start, A_target) result(Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: dt_step, A_start, A_target + type(auto_diff_real_tdc) :: Lambda, eta, coeff, disc + real(dp), parameter :: tiny = 1d-30 + + Lambda = convert(info%mixing_length_alpha*info%Hp) + if (Lambda%val <= tiny .or. dt_step%val <= 0d0) then + Af = A_start + return + end if + + eta = dt_step/Lambda + coeff = A_start + eta*pow2(A_target) + if (coeff%val <= 0d0) then + Af = 0d0 + else + disc = sqrt(1d0 + 4d0*eta*coeff) + Af = 2d0*coeff/(1d0 + disc) + end if + end function eval_Af_arnett_growth_to_target_step + + !> Calculates the end-of-step convective speed on the stable side for + !! the Arnett 1969 closure, given a reference buoyancy state and + !! a starting convective speed. + !! + !! @param info tdc_info type storing various quantities that are independent of Y. + !! @param Y_ref Reference superadiabaticity used to set the stable-side decay rate. + !! @param A_start Starting convective speed for the decay step. + type(auto_diff_real_tdc) function eval_Af_arnett_decay_from_state(info, Y_ref, A_start) result(Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: Y_ref + type(auto_diff_real_tdc), intent(in) :: A_start + type(auto_diff_real_tdc) :: dt_step + + dt_step = info%dt + Af = eval_Af_arnett_decay_from_state_step(info, dt_step, Y_ref, A_start) + end function eval_Af_arnett_decay_from_state + + type(auto_diff_real_tdc) function eval_Af_arnett_decay_from_state_step(info, dt_step, Y_ref, A_start) result(Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: dt_step, Y_ref, A_start + type(auto_diff_real_tdc) :: Lambda, eta, coeff, disc, N2, N + real(dp), parameter :: tiny = 1d-30 + + Lambda = convert(info%mixing_length_alpha*info%Hp) + if (Lambda%val <= tiny .or. dt_step%val <= 0d0) then + Af = A_start + return + end if + + eta = dt_step/Lambda + N2 = -Y_ref*convert(info%chiT/info%chiRho*info%grav/info%Hp) + if (N2 > 0d0) then + N = sqrt(N2) + else + N = 0d0 + end if + coeff = 1d0 + dt_step*N + if (A_start%val <= 0d0) then + Af = 0d0 + else + disc = sqrt(pow2(coeff) + 4d0*eta*A_start) + Af = 2d0*A_start/(coeff + disc) + end if + end function eval_Af_arnett_decay_from_state_step + + !> Calculates the steady-state convective speed for the Kuhfuss 1986 + !! closure at fixed Y. + !! + !! @param info tdc_info type storing various quantities that are independent of Y. + !! @param Y Superadiabaticity. + !! @param use_mlt_corr If true, use the MLT Gamma correction when forming Y_env. + type(auto_diff_real_tdc) function eval_Af_tdc_steady_state(info, Y, use_mlt_corr) result(Af_ss) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: Y + logical, intent(in) :: use_mlt_corr + type(auto_diff_real_tdc) :: Y_env, xi0, xi1, xi2, J2, J, root1, root2 + real(dp), parameter :: tiny = 1d-30 + + if (use_mlt_corr) then + if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then + Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) else - Af = 0d0 + Y_env = Y end if - else ! if (J2 == 0d0) then - Af = A0 + else + Y_env = Y end if - end function eval_Af + call eval_xis(info, Y_env, xi0, xi1, xi2) + + Af_ss = 0d0 + if (abs(xi2%val) <= tiny) then + if (abs(xi1%val) > tiny) then + root1 = -xi0/xi1 + if (root1 > Af_ss) Af_ss = root1 + end if + return + end if + + J2 = pow2(xi1) - 4d0*xi0*xi2 + if (J2 <= 0d0) return + + J = sqrt(J2) + root1 = (-xi1 + J)/(2d0*xi2) + root2 = (-xi1 - J)/(2d0*xi2) + if (root1 > Af_ss) Af_ss = root1 + if (root2 > Af_ss) Af_ss = root2 + end function eval_Af_tdc_steady_state + + !> Applies the optional post-solve acceleration limit to the TDC convective + !! speed and then recomputes Y from the luminosity balance at fixed Af. + !! + !! On the growth side the target is evaluated from the end-of-step TDC state. + !! On the decay side the target uses the explicit start-of-step thermal state. + !! + !! @param info tdc_info type storing various quantities that are independent of Y. + !! @param Y On input, the solved superadiabaticity. On output, the value + !! consistent with the limited convective speed. + !! @param Af On input, the solved convective speed variable. On output, the + !! limited convective speed variable. + subroutine apply_postsolve_TDC_acceleration_limit(info, Y, Af) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(inout) :: Y, Af + type(auto_diff_real_tdc) :: Af_bound, Af_target, Af_excess0, numer, denom, Y_env_factor + real(dp), parameter :: tiny = 1d-30 + + Af_target = eval_Af_tdc_steady_state(info, Y, info%include_mlt_corr_to_TDC) + + if (Af_target > info%A0 + tiny) then + Af_bound = eval_Af_arnett_growth_to_target(info, Af_target) + if (Af_bound < Af) Af = max(0d0, Af_bound) + else if (Af_target < info%A0 - tiny) then + Af_excess0 = info%A0 - Af_target + Af_bound = Af_target + eval_Af_arnett_decay_from_state(info, info%Y_start, Af_excess0) + if (Af_bound > Af) Af = max(0d0, Af_bound) + end if + + numer = info%L - info%L0*info%gradL + if (numer > 0d0 .and. info%include_mlt_corr_to_TDC) then + Y_env_factor = convert(info%Gamma/(1d0+info%Gamma)) + else + Y_env_factor = 1d0 + end if + denom = info%L0 + info%c0*Af*Y_env_factor + Y = numer/denom + end subroutine apply_postsolve_TDC_acceleration_limit end module tdc_support diff --git a/turb/public/turb.f90 b/turb/public/turb.f90 index 94b47dadf..c3620e4a1 100644 --- a/turb/public/turb.f90 +++ b/turb/public/turb.f90 @@ -22,6 +22,8 @@ module turb use num_lib use utils_lib use auto_diff + use tdc_support, only: TDC_arnett_growth_target_mlt, TDC_arnett_growth_target_tdc_no_mlt_corr, & + TDC_arnett_growth_target_tdc_with_mlt_corr implicit none @@ -30,6 +32,9 @@ module turb public :: set_mlt public :: set_tdc public :: set_semiconvection + public :: TDC_arnett_growth_target_mlt + public :: TDC_arnett_growth_target_tdc_no_mlt_corr + public :: TDC_arnett_growth_target_tdc_with_mlt_corr contains @@ -81,7 +86,15 @@ end subroutine set_thermohaline !! !! Internally this solves the equation L = L_conv + L_rad. !! + !! When use_TDC_arnett_velocity_closure is enabled, the velocity closure uses + !! the Arnett 1969 closure in the form presented in Renzo et al. 2020 + !! (ADS: https://ui.adsabs.harvard.edu/abs/2020MNRAS.493.4333R/abstract), + !! which points to equation 11 of Arnett 1969 + !! (ADS: https://ui.adsabs.harvard.edu/abs/1969Ap%26SS...5..180A/abstract). + !! !! @param conv_vel_start The convection speed at the start of the step. + !! @param Y_face_start Start-of-step superadiabaticity, used by the optional split-step A_f closure + !! and by the stable-side decay branch of the post-solve acceleration limiter. !! @param mixing_length_alpha The mixing length parameter. !! @param TDC_alpha_D TDC turbulent damping parameter !! @param TDC_alpha_R TDC radiative damping parameter @@ -110,24 +123,31 @@ end subroutine set_thermohaline !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param gradT The temperature gradient dlnT/dlnP (output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. + !! @param use_TDC_Af_split If true, use the split-step A_f closure when the start/end + !! thermal states lie on opposite sides of Y = 0. + !! @param TDC_arnett_growth_target Unstable-side steady-state target for David Arnett's + !! convection model in this implementation. !! @param ierr Tracks errors (output). subroutine set_TDC( & - conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & + conv_vel_start, Y_face_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, & max_conv_vel, Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, & - TDC_alpha_S, use_TDC_enthalpy_flux_limiter, energy, ierr) + TDC_alpha_S, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split, & + TDC_arnett_growth_target, energy, ierr) use tdc use tdc_support - real(dp), intent(in) :: conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt + real(dp), intent(in) :: conv_vel_start, Y_face_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt real(dp), intent(in) :: dt, cgrav, m, scale, max_conv_vel, TDC_alpha_C, TDC_alpha_S type(auto_diff_real_star_order1), intent(in) :: & chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, scale_height, gradL, grada, Eq_div_w, grav, energy logical, intent(in) :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter + logical, intent(in) :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split + integer, intent(in) :: TDC_arnett_growth_target type(auto_diff_real_star_order1),intent(out) :: conv_vel, Y_face, gradT, D integer, intent(out) :: tdc_num_iters, mixing_type, ierr type(tdc_info) :: info - type(auto_diff_real_star_order1) :: L, Lambda, Gamma, h + type(auto_diff_real_star_order1) :: L, Lambda, Gamma real(dp), parameter :: alpha_c = (1d0/2d0)*sqrt_2_div_3 real(dp), parameter :: lower_bound_Z = -1d2 real(dp), parameter :: upper_bound_Z = 1d2 @@ -144,11 +164,13 @@ subroutine set_TDC( & gradr, grada, gradL, & Gamma, gradT, Y_face, conv_vel, D, mixing_type,1d99, ierr) - - ! Pack TDC info info%report = report info%include_mlt_corr_to_TDC = include_mlt_corr_to_TDC info%use_TDC_enthalpy_flux_limiter = use_TDC_enthalpy_flux_limiter + info%use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure + info%use_TDC_acceleration_limit = use_TDC_acceleration_limit + info%use_TDC_Af_split = use_TDC_Af_split + info%TDC_arnett_growth_target = TDC_arnett_growth_target info%mixing_length_alpha = mixing_length_alpha info%TDC_alpha_D = TDC_alpha_D info%TDC_alpha_R = TDC_alpha_R @@ -157,9 +179,11 @@ subroutine set_TDC( & info%L = convert(L) info%gradL = convert(gradL) info%grada = convert(grada) + info%Y_start = Y_face_start info%c0 = convert(TDC_alpha_C * mixing_length_alpha * alpha_c * rho * T * Cp * 4d0 * pi * pow2(r)) info%L0 = convert((16d0*pi*crad*clight/3d0)*cgrav*m*pow4(T)/(P*opacity)) ! assumes QHSE for dP/dm info%A0 = conv_vel_start/sqrt_2_div_3 + info%A_mlt = convert(conv_vel/sqrt_2_div_3) info%h = energy + P/rho ! actual enthalpy info%T = T info%rho = rho @@ -169,6 +193,9 @@ subroutine set_TDC( & info%Hp = scale_height info%Gamma = Gamma info%Eq_div_w = Eq_div_w + info%grav = grav + info%chiT = chiT + info%chiRho = chiRho info%TDC_alpha_C = TDC_alpha_C info%TDC_alpha_S = TDC_alpha_S @@ -180,13 +207,11 @@ subroutine set_TDC( & ! Cap conv_vel at max_conv_vel_div_csound*cs if (conv_vel%val > max_conv_vel) then conv_vel = max_conv_vel - ! if max_conv_vel = csound, - ! L = L0 * (gradL + Y) + c0 * Af * Y_env - ! L = L0 * (gradL + Y) + c0 * sqrt_2_div_3 * csound * (Gamma / (1 + Gamma)) * Y - ! L - L0 * gradL = Y * (L0 + c0 * sqrt_2_div_3 * csound * (Gamma / (1 + Gamma))) + ! If conv_vel is capped, recompute Y_face from the uncapped luminosity balance. if (include_mlt_corr_to_TDC) then Y_face = unconvert(info%L - info%L0 * info%gradL) / & - (unconvert(info%L0) + unconvert(info%c0) * sqrt_2_div_3 * max_conv_vel * (info%Gamma / (1d0 + info%Gamma))) + (unconvert(info%L0) + unconvert(info%c0) * sqrt_2_div_3 * max_conv_vel * & + (info%Gamma / (1d0 + info%Gamma))) else Y_face = unconvert(info%L - info%L0 * info%gradL) / & (unconvert(info%L0) + unconvert(info%c0) * sqrt_2_div_3 * max_conv_vel) diff --git a/turb/test/.gitignore b/turb/test/.gitignore new file mode 100644 index 000000000..6d9b780e5 --- /dev/null +++ b/turb/test/.gitignore @@ -0,0 +1,5 @@ +!/plotter/ +!/plotter/** +/plotter/__pycache__/ +/plotter/*.csv +/plotter/plots/*.pdf diff --git a/turb/test/plotter/mesa.mplstyle b/turb/test/plotter/mesa.mplstyle new file mode 100644 index 000000000..bf1e1ca86 --- /dev/null +++ b/turb/test/plotter/mesa.mplstyle @@ -0,0 +1,46 @@ +# matplotlib style sheet for MESA Instrument Papers + +#figure.figsize : 3.38, 2.535 # 4x3 with width=apjcolwidth +#figure.figsize : 14,14 +lines.markersize : 8 +lines.linewidth : 1.5 +axes.linewidth : 2.0 +text.usetex : True +font.size : 24 +font.family : sans +# Not sure about the right font to use... +font.serif : Computer Modern Roman # Times Roman? +axes.titlesize : large +axes.labelsize : large +legend.fontsize : 18 +legend.frameon : False +figure.dpi : 500 + +# New commandments from Rich for MESA4 +xtick.minor.visible : True +ytick.minor.visible : True + +# Some other things we should agree on. +savefig.bbox : tight # standard +savefig.pad_inches : 0.15 # Padding when bbox is tight. +savefig.dpi : 300 +savefig.format : pdf + +# Tweaks to get rid of some matplotlib 2.0 default changes I don't like. +xtick.direction : in +xtick.top : True +ytick.direction : in +ytick.right : True + +# Miscellanious +axes.formatter.use_mathtext : True +#figure.autolayout : True + +xtick.major.size : 14#10 # major tick size in points +xtick.minor.size : 12#8 # minor tick size in points +xtick.major.width : 1.75 # major tick width in points +xtick.minor.width : 1.5 # minor tick width in points +ytick.major.size : 14#10 # major tick size in points +ytick.minor.size : 10#8 # minor tick size in points +ytick.major.width : 1.75 # major tick width in points +ytick.minor.width : 1.5 # minor tick width in points diff --git a/turb/test/plotter/plot_time_dependence.py b/turb/test/plotter/plot_time_dependence.py new file mode 100644 index 000000000..f55e8454a --- /dev/null +++ b/turb/test/plotter/plot_time_dependence.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python + +import sys + +sys.dont_write_bytecode = True + +import csv +from pathlib import Path + +import matplotlib.pyplot as plt +from matplotlib.ticker import ScalarFormatter + + +HERE = Path(__file__).resolve().parent +CSV_PATH = HERE / "time_dependence.csv" +OUTPUT_DIR = HERE / "plots" +STYLE_PATH = HERE / "mesa.mplstyle" +OUTPUT_PATH = OUTPUT_DIR / "time_dependence_conv_vel_panels.pdf" + +MODE_ORDER = [ + "mlt", + "tdc", + "tdc_with_mlt_corr", + "tdc_with_arnett_closure", + "tdc_with_arnett_closure_tdc_ss", + "tdc_with_arnett_closure_tdc_ss_mlt_corr", + "tdc_with_acceleration_limit", +] + +MODE_LABELS = { + "mlt": "MLT", + "tdc": "plain TDC", + "tdc_with_mlt_corr": "TDC + MLT corr", + "tdc_with_arnett_closure": "TDC + Arnett (MLT steady state)", + "tdc_with_arnett_closure_tdc_ss": "TDC + Arnett (TDC steady state)", + "tdc_with_arnett_closure_tdc_ss_mlt_corr": "TDC + Arnett (TDC steady state, MLT corr)", + "tdc_with_acceleration_limit": "TDC + acceleration limit", +} + +MODE_COLORS = { + "mlt": plt.cm.tab10(0), + "tdc": plt.cm.tab10(1), + "tdc_with_mlt_corr": plt.cm.tab10(2), + "tdc_with_arnett_closure": plt.cm.tab10(3), + "tdc_with_arnett_closure_tdc_ss": plt.cm.tab10(4), + "tdc_with_arnett_closure_tdc_ss_mlt_corr": plt.cm.tab10(5), + "tdc_with_acceleration_limit": "black", +} + +MODE_LINEWIDTHS = { + "mlt": 5.0, + "tdc": 5.0, + "tdc_with_mlt_corr": 4.0, + "tdc_with_arnett_closure": 2.0, + "tdc_with_arnett_closure_tdc_ss": 2.0, + "tdc_with_arnett_closure_tdc_ss_mlt_corr": 2.0, + "tdc_with_acceleration_limit": 3.0, +} + +MODE_LINESTYLES = { + "mlt": "-", + "tdc": "-", + "tdc_with_mlt_corr": "--", + "tdc_with_arnett_closure": "-", + "tdc_with_arnett_closure_tdc_ss": "-", + "tdc_with_arnett_closure_tdc_ss_mlt_corr": "-", + "tdc_with_acceleration_limit": ":", +} + +MODE_ZORDERS = { + "mlt": 1, + "tdc": 1, + "tdc_with_mlt_corr": 2, + "tdc_with_acceleration_limit": 3, + "tdc_with_arnett_closure": 4, + "tdc_with_arnett_closure_tdc_ss": 4, + "tdc_with_arnett_closure_tdc_ss_mlt_corr": 4, +} + +PANEL_GROUPS = [ + "decay_evolution", + "growth_evolution", + "envelope_decay_evolution", + "cburn_growth_evolution", +] + +LINE_ALPHA = 0.8 + + +def read_rows(): + groups = {} + with CSV_PATH.open() as handle: + reader = csv.DictReader(handle) + for row in reader: + group = row["group"] + mode = row["mode"] + row["step"] = int(row["step"]) + row["time"] = float(row["time"]) + row["conv_vel"] = float(row["conv_vel"]) + groups.setdefault(group, {}).setdefault(mode, []).append(row) + + for tracks in groups.values(): + for rows in tracks.values(): + rows.sort(key=lambda row: row["step"]) + + return groups + + +if __name__ == "__main__": + if not CSV_PATH.exists(): + raise SystemExit(f"missing CSV: {CSV_PATH}") + + OUTPUT_DIR.mkdir(exist_ok=True) + + groups = read_rows() + + missing_groups = [group_name for group_name in PANEL_GROUPS if group_name not in groups] + if missing_groups: + raise SystemExit(f"missing groups in CSV: {', '.join(missing_groups)}") + + if STYLE_PATH.exists(): + plt.style.use(str(STYLE_PATH)) + + plt.rcParams["figure.facecolor"] = "white" + plt.rcParams["axes.facecolor"] = "white" + plt.rcParams["savefig.format"] = "pdf" + + fig, axes = plt.subplots(2, 2, figsize=(24.0, 16.0)) + axes = axes.flatten() + + for ax, group_name in zip(axes, PANEL_GROUPS): + tracks = groups[group_name] + + conv_vel_values = [] + for mode in MODE_ORDER: + rows = tracks.get(mode, []) + if not rows: + continue + + x = [row["time"] for row in rows] + y = [row["conv_vel"] for row in rows] + conv_vel_values.extend(y) + + ax.plot( + x, + y, + label=MODE_LABELS[mode], + color=MODE_COLORS[mode], + linewidth=MODE_LINEWIDTHS[mode], + linestyle=MODE_LINESTYLES[mode], + alpha=LINE_ALPHA, + zorder=MODE_ZORDERS[mode], + ) + + ymin = min(conv_vel_values) + ymax = max(conv_vel_values) + if ymax == ymin: + pad = max(1.0, abs(ymax)) * 0.05 + else: + pad = 0.05 * (ymax - ymin) + + ax.set_title( + group_name + .replace("cburn", "carbon burning") + .replace("_evolution", "") + .replace("_", " ") + .title() + ) + ax.set_xlabel("time [s]") + ax.set_ylabel("conv_vel [cm/s]") + ax.set_ylim(ymin - pad, ymax + pad) + ax.grid(True) + + x_formatter = ScalarFormatter(useMathText=True) + x_formatter.set_scientific(True) + x_formatter.set_powerlimits((-3, 3)) + x_formatter.set_useOffset(False) + ax.xaxis.set_major_formatter(x_formatter) + + y_formatter = ScalarFormatter(useMathText=True) + y_formatter.set_scientific(True) + y_formatter.set_powerlimits((-3, 3)) + y_formatter.set_useOffset(False) + ax.yaxis.set_major_formatter(y_formatter) + + axes[0].legend(loc="upper right") + fig.tight_layout(rect=(0.0, 0.0, 1.0, 0.97)) + fig.savefig(OUTPUT_PATH) + plt.close(fig) + + print(f"wrote {OUTPUT_PATH}") diff --git a/turb/test/src/test_time_dependence_support.f90 b/turb/test/src/test_time_dependence_support.f90 new file mode 100644 index 000000000..db348a743 --- /dev/null +++ b/turb/test/src/test_time_dependence_support.f90 @@ -0,0 +1,1049 @@ +module test_time_dependence_support + + use math_lib + use auto_diff + use const_def, only: dp, pi, rsun, lsun, msun, kerg, mp, boltz_sigma, standard_cgrav, sqrt_2_div_3 + use turb, only: set_MLT, set_TDC, TDC_arnett_growth_target_mlt, & + TDC_arnett_growth_target_tdc_no_mlt_corr, TDC_arnett_growth_target_tdc_with_mlt_corr + + implicit none + + type :: tdc_mode_data + character(len=48) :: name + logical :: use_arnett + logical :: use_acceleration_limit + logical :: use_Af_split + logical :: include_mlt_correction + integer :: growth_target + end type tdc_mode_data + + type :: tdc_case_data + real(dp) :: mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt + real(dp) :: cgrav, m, scale, max_conv_vel, TDC_alpha_C, TDC_alpha_S + real(dp) :: conv_vel_start_ref + logical :: report, use_TDC_enthalpy_flux_limiter + type(auto_diff_real_star_order1) :: & + r, L, T, P, opacity, rho, dV, chiRho, chiT, Cp, & + gradr, grada, scale_height, gradL, Eq_div_w, grav, energy + end type tdc_case_data + + integer, parameter :: num_tdc_modes = 7 + type(tdc_mode_data), parameter :: tdc_modes(num_tdc_modes) = [ & + tdc_mode_data('tdc', .false., .false., .false., .false., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_Af_split', .false., .false., .true., .false., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_mlt_corr', .false., .false., .false., .true., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_arnett_closure', .true., .false., .false., .true., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_arnett_closure_tdc_ss', .true., .false., .false., .false., TDC_arnett_growth_target_tdc_no_mlt_corr), & + tdc_mode_data('tdc_with_arnett_closure_tdc_ss_mlt_corr', .true., .false., .false., .true., TDC_arnett_growth_target_tdc_with_mlt_corr), & + tdc_mode_data('tdc_with_acceleration_limit', .false., .true., .false., .false., TDC_arnett_growth_target_mlt) ] + + private + public :: write_time_dependence_csv + public :: check_time_dependence + +contains + + subroutine write_time_dependence_csv(output_path, ierr) + character(len=*), intent(in) :: output_path + integer, intent(out) :: ierr + integer :: io, mode_i + + ierr = 0 + open(newunit=io, file=trim(output_path), status='replace', action='write', iostat=ierr) + if (ierr /= 0) return + + write(io, '(a)') 'mode,group,scenario,step,time,dt,conv_vel_start,L_conv_start,L,gradr,gradL,grada,gradT,Y_face,conv_vel,L_conv_end,L_conv_div_L,tau_phys,ierr' + + do mode_i = 1, num_tdc_modes + call run_mode(io, tdc_modes(mode_i)) + call run_cburn_growth_evolution(io, tdc_modes(mode_i)) + end do + + call run_mlt_evolution(io) + close(io) + end subroutine write_time_dependence_csv + + + subroutine check_time_dependence() + integer :: mode_i + type(tdc_case_data) :: decay_case, growth_case, envelope_decay_case, cburn_case + real(dp), parameter :: decay_gradT_start = 2.5204370043250246d-01 + real(dp), parameter :: cburn_gradT_start = 2.8060983127196415d-01 + real(dp) :: envelope_decay_gradT_start + write(*, '(a)') '' + write(*, '(a)') 'Decay' + write(*, '(a)') '' + call setup_decay_case(decay_case) + call print_case_setup(decay_case, decay_case%conv_vel_start_ref, decay_gradT_start, & + 'Idealized deep-interior decay test with a large inward luminosity; a generic strongly contracting negative-luminosity state.') + + do mode_i = 1, num_tdc_modes + call print_decay_track(tdc_modes(mode_i)) + end do + + write(*, '(a)') '' + write(*, '(a)') 'Growth' + write(*, '(a)') '' + call setup_growth_case(growth_case) + call print_case_setup(growth_case, 0d0, growth_case%gradr%val, & + 'Idealized generic onset test in a dilute, marginally unstable layer initialized on the radiative branch.') + + do mode_i = 1, num_tdc_modes + call print_growth_track(tdc_modes(mode_i)) + end do + + write(*, '(a)') '' + write(*, '(a)') 'Envelope Decay' + write(*, '(a)') '' + call setup_envelope_decay_case(envelope_decay_case, envelope_decay_gradT_start) + call print_case_setup(envelope_decay_case, envelope_decay_case%conv_vel_start_ref, envelope_decay_gradT_start, & + 'Idealized generic envelope decay test in a dilute, slightly stable layer initialized from a nearby unstable convective state.') + + do mode_i = 1, num_tdc_modes + call print_envelope_decay_track(tdc_modes(mode_i)) + end do + + write(*, '(a)') '' + write(*, '(a)') 'Carbon Burning Growth' + write(*, '(a)') '' + call setup_cburn_case(cburn_case) + call print_case_setup(cburn_case, cburn_case%conv_vel_start_ref, cburn_gradT_start, & + '12 Msun pre-core-collapse model at core-carbon depletion; a hot convective carbon-burning zone taken directly from the saved model.') + + do mode_i = 1, num_tdc_modes + call print_cburn_growth_track(tdc_modes(mode_i), mode_i < num_tdc_modes) + end do + end subroutine check_time_dependence + + + subroutine run_mode(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + + call run_decay_memory_sweep(io, mode) + call run_decay_velocity_sweep(io, mode) + call run_growth_sweep(io, mode) + call run_growth_flux_memory_sweep(io, mode) + call run_growth_velocity_sweep(io, mode) + call run_decay_evolution(io, mode) + call run_growth_evolution(io, mode) + call run_envelope_decay_evolution(io, mode) + end subroutine run_mode + + + subroutine print_decay_track(mode) + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: decay_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time + integer :: ierr, j + real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 + integer, parameter :: num_steps = 12 + + call setup_decay_case(decay_case) + conv_vel_start = decay_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) + tau_phys = arnett_relaxation_time(decay_case%mixing_length_alpha * decay_case%scale_height%val, decay_case%grav%val, & + decay_case%scale_height%val, decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, conv_vel_start) + dt = pow(10d0, 2.3d0) + + write(*, '(a)') 'Convection model: ' // trim(mode%name) + call print_mode_controls(mode) + write(*, '(a)') ' step time[s] dt[s] gradT' // & + ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L' + + gradT = gradT_start_old + Y_face = gradT_start_old - decay_case%gradL + conv_vel = conv_vel_start + call print_track_row(0, 0d0, dt, conv_vel_start, decay_case, gradT, Y_face, conv_vel) + + do j = 1, num_steps + call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call print_track_row(j, time, dt, conv_vel_start, decay_case, gradT, Y_face, conv_vel) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT%val) + end do + + write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys + write(*, '(a)') '' + end subroutine print_decay_track + + + subroutine print_growth_track(mode) + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: growth_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys + real(dp) :: time + integer :: ierr, j + integer, parameter :: num_steps = 12 + + call setup_growth_case(growth_case) + call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + if (ierr /= 0) return + + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, eq_conv_vel%val) + call reference_evolution_dt(growth_case, 0d0, 0d0, dt, ierr) + if (ierr /= 0) return + conv_vel_start = 0d0 + L_conv_start = 0d0 + + write(*, '(a)') 'Convection model: ' // trim(mode%name) + call print_mode_controls(mode) + write(*, '(a)') ' step time[s] dt[s] gradT' // & + ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L' + + gradT = growth_case%gradr + Y_face = growth_case%gradr - growth_case%gradL + conv_vel = 0d0 + call print_track_row(0, 0d0, dt, conv_vel_start, growth_case, gradT, Y_face, conv_vel, eq_conv_vel%val) + + do j = 1, num_steps + call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call print_track_row(j, time, dt, conv_vel_start, growth_case, gradT, Y_face, conv_vel, eq_conv_vel%val) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, gradT%val) + end do + + write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys + write(*, '(a,1x,es24.16)') ' conv_vel_eq[cm/s]', eq_conv_vel%val + write(*, '(a)') '' + end subroutine print_growth_track + + + subroutine print_envelope_decay_track(mode) + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: envelope_decay_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time, gradT_start + integer :: ierr, j + integer, parameter :: num_steps = 12 + + call setup_envelope_decay_case(envelope_decay_case, gradT_start) + conv_vel_start = envelope_decay_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT_start) + tau_phys = arnett_relaxation_time(envelope_decay_case%mixing_length_alpha * envelope_decay_case%scale_height%val, & + envelope_decay_case%grav%val, envelope_decay_case%scale_height%val, envelope_decay_case%gradL%val, & + envelope_decay_case%gradr%val, conv_vel_start, 0d0) + call reference_evolution_dt(envelope_decay_case, conv_vel_start, L_conv_start, dt, ierr) + if (ierr /= 0) return + + write(*, '(a)') 'Convection model: ' // trim(mode%name) + call print_mode_controls(mode) + write(*, '(a)') ' step time[s] dt[s] gradT' // & + ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L' + + gradT = gradT_start + Y_face = gradT_start - envelope_decay_case%gradL + conv_vel = conv_vel_start + call print_track_row(0, 0d0, dt, conv_vel_start, envelope_decay_case, gradT, Y_face, conv_vel) + + do j = 1, num_steps + call call_tdc(envelope_decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call print_track_row(j, time, dt, conv_vel_start, envelope_decay_case, gradT, Y_face, conv_vel) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT%val) + end do + + write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys + write(*, '(a)') '' + end subroutine print_envelope_decay_track + + + subroutine print_cburn_growth_track(mode, emit_blank_line) + type(tdc_mode_data), intent(in) :: mode + logical, intent(in), optional :: emit_blank_line + type(tdc_case_data) :: cburn_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time + logical :: do_blank_line + integer :: ierr, j + real(dp), parameter :: gradT_start = 2.8060983127196415d-01 + integer, parameter :: num_steps = 12 + + do_blank_line = .true. + if (present(emit_blank_line)) do_blank_line = emit_blank_line + + call setup_cburn_case(cburn_case) + conv_vel_start = cburn_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT_start) + call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + if (ierr /= 0) return + + tau_phys = arnett_relaxation_time(cburn_case%mixing_length_alpha * cburn_case%scale_height%val, cburn_case%grav%val, & + cburn_case%scale_height%val, cburn_case%gradL%val, cburn_case%gradr%val, conv_vel_start, eq_conv_vel%val) + call reference_evolution_dt(cburn_case, conv_vel_start, L_conv_start, dt, ierr) + if (ierr /= 0) return + + write(*, '(a)') 'Convection model: ' // trim(mode%name) + call print_mode_controls(mode) + write(*, '(a)') ' step time[s] dt[s] gradT' // & + ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L' + + gradT = gradT_start + Y_face = gradT_start - cburn_case%gradL + conv_vel = conv_vel_start + call print_track_row(0, 0d0, dt, conv_vel_start, cburn_case, gradT, Y_face, conv_vel, eq_conv_vel%val) + + do j = 1, num_steps + call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call print_track_row(j, time, dt, conv_vel_start, cburn_case, gradT, Y_face, conv_vel, eq_conv_vel%val) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT%val) + end do + + write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys + write(*, '(a,1x,es24.16)') ' conv_vel_eq[cm/s]', eq_conv_vel%val + if (do_blank_line) write(*, '(a)') '' + end subroutine print_cburn_growth_track + + + subroutine print_track_row(step, time, dt, conv_vel_start, case_data, gradT, Y_face, conv_vel, conv_vel_eq) + integer, intent(in) :: step + real(dp), intent(in) :: time, dt, conv_vel_start + type(tdc_case_data), intent(in) :: case_data + type(auto_diff_real_star_order1), intent(in) :: gradT, Y_face, conv_vel + real(dp), intent(in), optional :: conv_vel_eq + real(dp) :: L_conv_div_L, conv_vel_div_eq + real(dp), parameter :: tiny = 1d-99 + + L_conv_div_L = Lconv_from_gradT(case_data%L%val, case_data%gradr%val, gradT%val) / case_data%L%val + if (present(conv_vel_eq)) then + conv_vel_div_eq = conv_vel%val / max(abs(conv_vel_eq), tiny) + write(*, '(i10,8(1x,es24.16))') step, time, dt, gradT%val, Y_face%val, conv_vel_start, conv_vel%val, & + conv_vel_div_eq, L_conv_div_L + else + write(*, '(i10,7(1x,es24.16))') step, time, dt, gradT%val, Y_face%val, conv_vel_start, conv_vel%val, L_conv_div_L + end if + end subroutine print_track_row + + + subroutine run_decay_memory_sweep(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: decay_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, Lambda, L_conv_ref + integer :: i, j, ierr + real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 + real(dp), parameter :: memory_factors(5) = [0d0, 0.25d0, 0.5d0, 0.75d0, 1d0] + character(len=24), parameter :: names(5) = [character(len=24) :: & + 'zero_memory', 'quarter_memory', 'half_memory', 'three_quarter_memory', 'full_memory'] + + call setup_decay_case(decay_case) + conv_vel_start = decay_case%conv_vel_start_ref + L_conv_ref = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) + Lambda = decay_case%mixing_length_alpha * decay_case%scale_height%val + + do i = 1, size(memory_factors) + L_conv_start = memory_factors(i) * L_conv_ref + do j = 0, 40 + dt = pow(10d0, 2.3d0 + 0.02d0*j) + tau_phys = arnett_relaxation_time(Lambda, decay_case%grav%val, decay_case%scale_height%val, & + decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, conv_vel_start) + call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + call write_row(io, mode%name, 'decay_memory_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + end do + end subroutine run_decay_memory_sweep + + + subroutine run_decay_velocity_sweep(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: decay_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, Lambda, L_conv_ref + integer :: i, j, ierr + real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 + real(dp), parameter :: velocity_factors(4) = [0.25d0, 0.5d0, 0.75d0, 1d0] + character(len=24), parameter :: names(4) = [character(len=24) :: & + 'quarter_a0', 'half_a0', 'three_quarter_a0', 'full_a0'] + + call setup_decay_case(decay_case) + L_conv_ref = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) + Lambda = decay_case%mixing_length_alpha * decay_case%scale_height%val + L_conv_start = L_conv_ref + + do i = 1, size(velocity_factors) + conv_vel_start = velocity_factors(i) * decay_case%conv_vel_start_ref + do j = 0, 40 + dt = pow(10d0, 2.3d0 + 0.02d0*j) + tau_phys = arnett_relaxation_time(Lambda, decay_case%grav%val, decay_case%scale_height%val, & + decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, decay_case%conv_vel_start_ref) + call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + call write_row(io, mode%name, 'decay_velocity_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + end do + end subroutine run_decay_velocity_sweep + + + subroutine run_growth_sweep(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: growth_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Gamma + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, L_conv_eq + integer :: i, j, ierr + character(len=24), parameter :: names(2) = [character(len=24) :: 'radiative_start', 'equilibrium_start'] + + call setup_growth_case(growth_case) + call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + L_conv_eq = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, eq_gradT%val) + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, eq_conv_vel%val) + + call write_row(io, mode%name, 'reference', 'tdc_equilibrium', -1, -1d0, 1d40, 0d0, 0d0, & + growth_case, eq_gradT, eq_Y_face, eq_conv_vel, tau_phys, ierr) + + do i = 1, size(names) + do j = 0, 40 + dt = pow(10d0, -2d0 + 0.25d0*j) + if (i == 1) then + conv_vel_start = 0d0 + L_conv_start = 0d0 + else + conv_vel_start = eq_conv_vel%val + L_conv_start = L_conv_eq + end if + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, eq_conv_vel%val) + call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + call write_row(io, mode%name, 'growth_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + end do + + call call_cox_mlt(growth_case, gradT, Y_face, conv_vel, D, Gamma, ierr) + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, conv_vel%val) + call write_row(io, mode%name, 'reference', 'cox_mlt_equilibrium', -1, -1d0, 1d40, 0d0, 0d0, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end subroutine run_growth_sweep + + + subroutine run_growth_flux_memory_sweep(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: growth_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, L_conv_eq + integer :: i, j, ierr + real(dp), parameter :: memory_factors(5) = [0d0, 0.25d0, 0.5d0, 0.75d0, 1d0] + character(len=32), parameter :: names(5) = [character(len=32) :: & + 'zero_flux_memory', 'quarter_flux_memory', 'half_flux_memory', 'three_quarter_flux_memory', 'full_flux_memory'] + + call setup_growth_case(growth_case) + call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + L_conv_eq = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, eq_gradT%val) + conv_vel_start = 0d0 + + do i = 1, size(memory_factors) + L_conv_start = memory_factors(i) * L_conv_eq + do j = 0, 40 + dt = pow(10d0, -2d0 + 0.25d0*j) + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, eq_conv_vel%val) + call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + call write_row(io, mode%name, 'growth_flux_memory_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + end do + end subroutine run_growth_flux_memory_sweep + + + subroutine run_growth_velocity_sweep(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: growth_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys + integer :: i, j, ierr + real(dp), parameter :: velocity_factors(5) = [0d0, 0.25d0, 0.5d0, 0.75d0, 1d0] + character(len=32), parameter :: names(5) = [character(len=32) :: & + 'zero_velocity_memory', 'quarter_velocity_memory', 'half_velocity_memory', 'three_quarter_velocity_memory', 'full_velocity_memory'] + + call setup_growth_case(growth_case) + call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + L_conv_start = 0d0 + + do i = 1, size(velocity_factors) + conv_vel_start = velocity_factors(i) * eq_conv_vel%val + do j = 0, 40 + dt = pow(10d0, -2d0 + 0.25d0*j) + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, eq_conv_vel%val) + call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + call write_row(io, mode%name, 'growth_velocity_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + end do + end subroutine run_growth_velocity_sweep + + + subroutine run_decay_evolution(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: decay_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time + integer :: j, ierr + real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 + integer, parameter :: num_steps = 12 + integer, parameter :: num_steps_long = 400 + + call setup_decay_case(decay_case) + conv_vel_start = decay_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) + tau_phys = arnett_relaxation_time(decay_case%mixing_length_alpha * decay_case%scale_height%val, decay_case%grav%val, & + decay_case%scale_height%val, decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, conv_vel_start) + dt = pow(10d0, 2.3d0) + + gradT = gradT_start_old + Y_face = gradT_start_old - decay_case%gradL + conv_vel = conv_vel_start + call write_row(io, mode%name, 'decay_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, 0) + + do j = 1, num_steps + call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call write_row(io, mode%name, 'decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT%val) + end do + + conv_vel_start = decay_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) + gradT = gradT_start_old + Y_face = gradT_start_old - decay_case%gradL + conv_vel = conv_vel_start + call write_row(io, mode%name, 'decay_long_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, 0) + + do j = 1, num_steps_long + call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call write_row(io, mode%name, 'decay_long_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT%val) + end do + end subroutine run_decay_evolution + + + subroutine run_growth_evolution(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: growth_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time + integer :: j, ierr + integer, parameter :: num_steps = 120 + + call setup_growth_case(growth_case) + call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + if (ierr /= 0) return + + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, eq_conv_vel%val) + call reference_evolution_dt(growth_case, 0d0, 0d0, dt, ierr) + if (ierr /= 0) return + conv_vel_start = 0d0 + L_conv_start = 0d0 + gradT = growth_case%gradr + Y_face = growth_case%gradr - growth_case%gradL + conv_vel = 0d0 + call write_row(io, mode%name, 'growth_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & + growth_case, gradT, Y_face, conv_vel, tau_phys, 0) + + do j = 1, num_steps + call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call write_row(io, mode%name, 'growth_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, gradT%val) + end do + end subroutine run_growth_evolution + + + subroutine run_envelope_decay_evolution(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: envelope_decay_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time, gradT_start + integer :: j, ierr + integer, parameter :: num_steps = 120 + + call setup_envelope_decay_case(envelope_decay_case, gradT_start) + conv_vel_start = envelope_decay_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT_start) + tau_phys = arnett_relaxation_time(envelope_decay_case%mixing_length_alpha * envelope_decay_case%scale_height%val, & + envelope_decay_case%grav%val, envelope_decay_case%scale_height%val, envelope_decay_case%gradL%val, & + envelope_decay_case%gradr%val, conv_vel_start, 0d0) + call reference_evolution_dt(envelope_decay_case, conv_vel_start, L_conv_start, dt, ierr) + if (ierr /= 0) return + gradT = gradT_start + Y_face = gradT_start - envelope_decay_case%gradL + conv_vel = conv_vel_start + call write_row(io, mode%name, 'envelope_decay_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & + envelope_decay_case, gradT, Y_face, conv_vel, tau_phys, 0) + + do j = 1, num_steps + call call_tdc(envelope_decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call write_row(io, mode%name, 'envelope_decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + envelope_decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT%val) + end do + end subroutine run_envelope_decay_evolution + + + subroutine run_cburn_growth_evolution(io, mode) + integer, intent(in) :: io + type(tdc_mode_data), intent(in) :: mode + type(tdc_case_data) :: cburn_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D + type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time + integer :: j, ierr + real(dp), parameter :: gradT_start = 2.8060983127196415d-01 + integer, parameter :: num_steps = 120 + + call setup_cburn_case(cburn_case) + conv_vel_start = cburn_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT_start) + call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) + if (ierr /= 0) return + + tau_phys = arnett_relaxation_time(cburn_case%mixing_length_alpha * cburn_case%scale_height%val, cburn_case%grav%val, & + cburn_case%scale_height%val, cburn_case%gradL%val, cburn_case%gradr%val, conv_vel_start, eq_conv_vel%val) + call reference_evolution_dt(cburn_case, conv_vel_start, L_conv_start, dt, ierr) + if (ierr /= 0) return + gradT = gradT_start + Y_face = gradT_start - cburn_case%gradL + conv_vel = conv_vel_start + call write_row(io, mode%name, 'cburn_growth_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & + cburn_case, gradT, Y_face, conv_vel, tau_phys, 0) + + do j = 1, num_steps + call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + time = j * dt + call write_row(io, mode%name, 'cburn_growth_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + cburn_case, gradT, Y_face, conv_vel, tau_phys, ierr) + conv_vel_start = conv_vel%val + L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT%val) + end do + end subroutine run_cburn_growth_evolution + + + subroutine run_mlt_evolution(io) + integer, intent(in) :: io + type(tdc_case_data) :: decay_case, growth_case, cburn_case + type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Gamma + real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time + integer :: ierr, j + real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 + integer, parameter :: decay_steps = 12 + integer, parameter :: decay_long_steps = 400 + integer, parameter :: growth_steps = 120 + real(dp) :: envelope_decay_gradT_start + + call setup_decay_case(decay_case) + conv_vel_start = decay_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) + tau_phys = arnett_relaxation_time(decay_case%mixing_length_alpha * decay_case%scale_height%val, decay_case%grav%val, & + decay_case%scale_height%val, decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, 0d0) + dt = pow(10d0, 2.3d0) + + call call_cox_mlt(decay_case, gradT, Y_face, conv_vel, D, Gamma, ierr) + + do j = 0, decay_steps + time = j * dt + call write_row(io, 'mlt', 'decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + + do j = 0, decay_long_steps + time = j * dt + call write_row(io, 'mlt', 'decay_long_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + + call setup_growth_case(growth_case) + call call_cox_mlt(growth_case, gradT, Y_face, conv_vel, D, Gamma, ierr) + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, conv_vel%val) + call reference_evolution_dt(growth_case, 0d0, 0d0, dt, ierr) + if (ierr /= 0) return + + do j = 0, growth_steps + time = j * dt + call write_row(io, 'mlt', 'growth_evolution', 'track', j, time, dt, 0d0, 0d0, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + + call setup_envelope_decay_case(growth_case, envelope_decay_gradT_start) + conv_vel_start = growth_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, envelope_decay_gradT_start) + call call_cox_mlt(growth_case, gradT, Y_face, conv_vel, D, Gamma, ierr) + tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & + growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, 0d0) + call reference_evolution_dt(growth_case, conv_vel_start, L_conv_start, dt, ierr) + if (ierr /= 0) return + + do j = 0, growth_steps + time = j * dt + call write_row(io, 'mlt', 'envelope_decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + + call setup_cburn_case(cburn_case) + conv_vel_start = cburn_case%conv_vel_start_ref + L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, 2.8060983127196415d-01) + call call_cox_mlt(cburn_case, gradT, Y_face, conv_vel, D, Gamma, ierr) + tau_phys = arnett_relaxation_time(cburn_case%mixing_length_alpha * cburn_case%scale_height%val, cburn_case%grav%val, & + cburn_case%scale_height%val, cburn_case%gradL%val, cburn_case%gradr%val, conv_vel_start, conv_vel%val) + call reference_evolution_dt(cburn_case, conv_vel_start, L_conv_start, dt, ierr) + if (ierr /= 0) return + + do j = 0, growth_steps + time = j * dt + call write_row(io, 'mlt', 'cburn_growth_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & + cburn_case, gradT, Y_face, conv_vel, tau_phys, ierr) + end do + end subroutine run_mlt_evolution + + + subroutine reference_evolution_dt(case_data, conv_vel_start, L_conv_start, dt, ierr) + type(tdc_case_data), intent(in) :: case_data + real(dp), intent(in) :: conv_vel_start, L_conv_start + real(dp), intent(out) :: dt + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: ref_gradT, ref_Y_face, ref_conv_vel, ref_D + real(dp) :: tau_ref + + call call_tdc(case_data, tdc_modes(1), conv_vel_start, L_conv_start, 1d40, ref_gradT, ref_Y_face, ref_conv_vel, ref_D, ierr) + if (ierr /= 0) return + + tau_ref = arnett_relaxation_time(case_data%mixing_length_alpha * case_data%scale_height%val, case_data%grav%val, & + case_data%scale_height%val, case_data%gradL%val, case_data%gradr%val, conv_vel_start, ref_conv_vel%val) + dt = max(1d-6, 5d-2 * tau_ref) + end subroutine reference_evolution_dt + + + subroutine call_tdc(case_data, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) + type(tdc_case_data), intent(in) :: case_data + type(tdc_mode_data), intent(in) :: mode + real(dp), intent(in) :: conv_vel_start, L_conv_start, dt + type(auto_diff_real_star_order1), intent(out) :: gradT, Y_face, conv_vel, D + integer, intent(out) :: ierr + integer :: mixing_type, tdc_num_iters + real(dp) :: gradT_start, Y_face_start + real(dp), parameter :: tiny = 1d-30 + + if (abs(case_data%L%val) <= tiny .or. abs(case_data%gradr%val) <= tiny) then + gradT_start = case_data%gradL%val + else + gradT_start = case_data%gradr%val * (1d0 - L_conv_start/case_data%L%val) + end if + Y_face_start = gradT_start - case_data%gradL%val + + call set_TDC( & + conv_vel_start, Y_face_start, case_data%mixing_length_alpha, case_data%TDC_alpha_D, case_data%TDC_alpha_R, & + case_data%TDC_alpha_Pt, dt, case_data%cgrav, case_data%m, case_data%report, & + mixing_type, case_data%scale, case_data%chiT, case_data%chiRho, case_data%gradr, case_data%r, case_data%P, & + case_data%T, case_data%rho, case_data%dV, case_data%Cp, case_data%opacity, case_data%scale_height, & + case_data%gradL, case_data%grada, conv_vel, D, Y_face, gradT, tdc_num_iters, case_data%max_conv_vel, & + case_data%Eq_div_w, case_data%grav, mode%include_mlt_correction, case_data%TDC_alpha_C, case_data%TDC_alpha_S, & + case_data%use_TDC_enthalpy_flux_limiter, mode%use_arnett, mode%use_acceleration_limit, mode%use_Af_split, mode%growth_target, & + case_data%energy, ierr) + end subroutine call_tdc + + + subroutine call_cox_mlt(case_data, gradT, Y_face, conv_vel, D, Gamma, ierr) + type(tdc_case_data), intent(in) :: case_data + type(auto_diff_real_star_order1), intent(out) :: gradT, Y_face, conv_vel, D, Gamma + integer, intent(out) :: ierr + integer :: mixing_type + real(dp) :: Henyey_MLT_nu_param, Henyey_MLT_y_param + + Henyey_MLT_nu_param = 0d0 + Henyey_MLT_y_param = 0d0 + + call set_MLT('Cox', case_data%mixing_length_alpha, Henyey_MLT_nu_param, Henyey_MLT_y_param, & + case_data%chiT, case_data%chiRho, case_data%Cp, case_data%grav, & + case_data%mixing_length_alpha*case_data%scale_height, case_data%rho, case_data%P, case_data%T, & + case_data%opacity, case_data%gradr, case_data%grada, case_data%gradL, & + Gamma, gradT, Y_face, conv_vel, D, mixing_type, case_data%max_conv_vel, ierr) + end subroutine call_cox_mlt + + + subroutine setup_decay_case(case_data) + type(tdc_case_data), intent(out) :: case_data + + case_data%max_conv_vel = 1d99 + case_data%conv_vel_start_ref = 52320587.415154047d0 + case_data%mixing_length_alpha = 2.0d0 + case_data%TDC_alpha_D = 1.0d0 + case_data%TDC_alpha_R = 0.0d0 + case_data%TDC_alpha_Pt = 0.0d0 + case_data%TDC_alpha_C = 1.0d0 + case_data%TDC_alpha_S = 1.0d0 + case_data%cgrav = 6.6743000000000004d-8 + case_data%m = 5.8707400456875664d34 + case_data%scale = 5.0386519362246294d45 + case_data%L = 1.0941528815883500015d0*(-5.0386519362246294d45) + case_data%r = 10314294541.567163d0 + case_data%P = 5.0581587249808894d20 + case_data%T = 613193666.51783681d0 + case_data%rho = 5204.5732574745753d0 + case_data%dV = 3.8256494463482604d-7 + case_data%Cp = 6628075118.4606590d0 + case_data%opacity = 9.0750171231469945d-2 + case_data%scale_height = 2638686602.0063782d0 + case_data%gradL = 0.25207587267343501d0 + case_data%grada = 0.25204697256872738d0 + case_data%report = .false. + case_data%chiT = 1d0 + case_data%chiRho = 1d0 + case_data%grav = case_data%m*case_data%cgrav/pow2(case_data%r) + case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & + (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%cgrav*case_data%m) + case_data%Eq_div_w = 0d0 + case_data%energy = 0d0 + case_data%use_TDC_enthalpy_flux_limiter = .false. + end subroutine setup_decay_case + + + subroutine setup_growth_case(case_data) + type(tdc_case_data), intent(out) :: case_data + + case_data%max_conv_vel = 1d99 + case_data%conv_vel_start_ref = 0d0 + case_data%mixing_length_alpha = 2.0d0 + case_data%chiT = 1d0 + case_data%chiRho = 1d0 + case_data%T = 1d5 + case_data%rho = 1d-5 + case_data%r = Rsun + case_data%m = Msun + case_data%cgrav = standard_cgrav + case_data%grav = case_data%m*case_data%cgrav/pow2(case_data%r) + case_data%Cp = 2.5d0*kerg/mp + case_data%P = case_data%rho*case_data%T*kerg/mp + case_data%scale_height = case_data%P/(case_data%rho*case_data%grav) + case_data%opacity = 1d0 + case_data%grada = 0.4d0 + case_data%gradL = case_data%grada + case_data%L = 70d0*Lsun + case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & + (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%grav*pow2(case_data%r)) + case_data%L = case_data%L*(1d0 + 1d-5)*(case_data%grada/case_data%gradr) + case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & + (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%grav*pow2(case_data%r)) + case_data%TDC_alpha_D = 1.0d0 + case_data%TDC_alpha_R = 0.0d0 + case_data%TDC_alpha_Pt = 0.0d0 + case_data%TDC_alpha_C = 1.0d0 + case_data%TDC_alpha_S = 1.0d0 + case_data%dV = 0d0 + case_data%energy = 0d0 + case_data%scale = case_data%L%val*1d-3 + case_data%report = .false. + case_data%Eq_div_w = 0d0 + case_data%use_TDC_enthalpy_flux_limiter = .false. + end subroutine setup_growth_case + + + subroutine setup_envelope_decay_case(case_data, gradT_start_ref) + type(tdc_case_data), intent(out) :: case_data + real(dp), intent(out) :: gradT_start_ref + type(tdc_case_data) :: unstable_case + type(auto_diff_real_star_order1) :: gradT_start, Y_face_start, conv_vel_start, D_start, Gamma_start + integer :: ierr + + call setup_growth_case(unstable_case) + call call_cox_mlt(unstable_case, gradT_start, Y_face_start, conv_vel_start, D_start, Gamma_start, ierr) + + case_data = unstable_case + case_data%conv_vel_start_ref = conv_vel_start%val + gradT_start_ref = gradT_start%val + case_data%L = unstable_case%L * ((1d0 - 1d-5)/(1d0 + 1d-5)) + case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & + (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%grav*pow2(case_data%r)) + case_data%scale = case_data%L%val*1d-3 + end subroutine setup_envelope_decay_case + + + subroutine setup_cburn_case(case_data) + type(tdc_case_data), intent(out) :: case_data + + case_data%max_conv_vel = 1d99 + case_data%conv_vel_start_ref = 5.0383392852019933d4 + case_data%mixing_length_alpha = 2.0d0 + case_data%TDC_alpha_D = 1.0d0 + case_data%TDC_alpha_R = 0.0d0 + case_data%TDC_alpha_Pt = 0.0d0 + case_data%TDC_alpha_C = 1.0d0 + case_data%TDC_alpha_S = 1.0d0 + case_data%cgrav = standard_cgrav + case_data%m = 1.1259123990149387d0*Msun + case_data%scale = 1.0372316545177369d6*Lsun*1d-3 + case_data%L = 1.0372316545177369d6*Lsun + case_data%r = 1.0818528002666345d9 + case_data%P = 8.7371150320499226d21 + case_data%T = 8.9448446840612292d8 + case_data%rho = 1.6585817351580659d5 + case_data%dV = 0d0 + case_data%Cp = 3.7545969237063849d8 + case_data%opacity = 6.8854059514891264d-2 + case_data%scale_height = 4.1262096121030027d8 + case_data%grada = 2.7977735453489061d-1 + ! The saved model provides gradT - grada, so use gradL = grada here. + case_data%gradL = case_data%grada + case_data%report = .false. + case_data%chiT = 1.5046551755548503d0 + case_data%chiRho = 8.4356679250011213d-1 + case_data%grav = case_data%m*case_data%cgrav/pow2(case_data%r) + case_data%gradr = 6.5970726825239474d0 + case_data%Eq_div_w = 0d0 + case_data%energy = 0d0 + case_data%use_TDC_enthalpy_flux_limiter = .false. + end subroutine setup_cburn_case + + + real(dp) function arnett_relaxation_time(Lambda, grav, Hp, gradL, gradr, conv_vel_start, conv_vel_eq) result(tau_phys) + real(dp), intent(in) :: Lambda, grav, Hp, gradL, gradr, conv_vel_start, conv_vel_eq + real(dp), parameter :: tiny = 1d-99 + real(dp) :: N, rate + + if (gradr > gradL) then + tau_phys = max(Lambda, tiny) / max(abs(conv_vel_eq), tiny) + else + N = sqrt(max(0d0, grav/max(Hp, tiny) * (gradL - gradr))) + rate = N + abs(conv_vel_start)/max(Lambda, tiny) + tau_phys = 1d0 / max(rate, tiny) + end if + end function arnett_relaxation_time + + + real(dp) function Lconv_from_gradT(L, gradr, gradT) result(L_conv) + real(dp), intent(in) :: L, gradr, gradT + + if (gradr == 0d0) then + L_conv = 0d0 + else + L_conv = L * (1d0 - gradT/gradr) + end if + end function Lconv_from_gradT + + + subroutine print_mode_controls(mode) + type(tdc_mode_data), intent(in) :: mode + + if (mode%include_mlt_correction) then + write(*, '(a)') ' include_mlt_corr_to_tdc = .true.' + else + write(*, '(a)') ' include_mlt_corr_to_tdc = .false.' + end if + + if (mode%use_arnett) then + write(*, '(a)') ' use_TDC_arnett_velocity_closure = .true.' + else + write(*, '(a)') ' use_TDC_arnett_velocity_closure = .false.' + end if + + if (mode%use_acceleration_limit) then + write(*, '(a)') ' use_TDC_acceleration_limit = .true.' + else + write(*, '(a)') ' use_TDC_acceleration_limit = .false.' + end if + if (mode%use_Af_split) then + write(*, '(a)') ' use_TDC_Af_split = .true.' + else + write(*, '(a)') ' use_TDC_Af_split = .false.' + end if + write(*, '(a,a)') ' TDC_arnett_growth_target = ', trim(growth_target_name(mode%growth_target)) + end subroutine print_mode_controls + + + subroutine print_case_setup(case_data, conv_vel_start, gradT_start, interpretation) + type(tdc_case_data), intent(in) :: case_data + real(dp), intent(in) :: conv_vel_start, gradT_start + character(len=*), intent(in) :: interpretation + real(dp) :: L_conv_start, L_conv_div_L + + L_conv_start = Lconv_from_gradT(case_data%L%val, case_data%gradr%val, gradT_start) + if (case_data%L%val == 0d0) then + L_conv_div_L = 0d0 + else + L_conv_div_L = L_conv_start/case_data%L%val + end if + + write(*, '(a,1x,es24.16,1x,a,1x,es24.16)') ' T[K] =', case_data%T%val, 'rho[g/cm^3] =', case_data%rho%val + write(*, '(a,1x,es24.16,1x,a,1x,es24.16)') ' P[dyn/cm^2] =', case_data%P%val, 'L[erg/s] =', case_data%L%val + write(*, '(a,1x,es24.16,1x,a,1x,es24.16)') ' r[cm] =', case_data%r%val, 'Hp[cm] =', case_data%scale_height%val + write(*, '(a,1x,es24.16,1x,a,1x,es24.16,1x,a,1x,es24.16)') ' gradL =', case_data%gradL%val, & + 'gradr =', case_data%gradr%val, 'grada =', case_data%grada%val + write(*, '(a,1x,es24.16,1x,a,1x,es24.16,1x,a,1x,es24.16)') ' conv_vel_start[cm/s] =', conv_vel_start, & + 'gradT_start =', gradT_start, 'L_conv_start/L =', L_conv_div_L + write(*, '(a,a)') ' Interpretation: ', trim(interpretation) + write(*, '(a)') '' + end subroutine print_case_setup + + character(len=32) function growth_target_name(growth_target) result(name) + integer, intent(in) :: growth_target + + select case (growth_target) + case (TDC_arnett_growth_target_mlt) + name = 'mlt' + case (TDC_arnett_growth_target_tdc_no_mlt_corr) + name = 'tdc_no_mlt_corr' + case (TDC_arnett_growth_target_tdc_with_mlt_corr) + name = 'tdc_with_mlt_corr' + case default + name = 'unknown' + end select + end function growth_target_name + + + subroutine write_row(io, mode_name, group_name, scenario_name, step, time, dt, conv_vel_start, L_conv_start, & + case_data, gradT, Y_face, conv_vel, tau_phys, ierr) + integer, intent(in) :: io, step, ierr + character(len=*), intent(in) :: mode_name, group_name, scenario_name + real(dp), intent(in) :: time, dt, conv_vel_start, L_conv_start, tau_phys + type(tdc_case_data), intent(in) :: case_data + type(auto_diff_real_star_order1), intent(in) :: gradT, Y_face, conv_vel + real(dp) :: L_conv_end, L_conv_div_L + + L_conv_end = Lconv_from_gradT(case_data%L%val, case_data%gradr%val, gradT%val) + if (case_data%L%val == 0d0) then + L_conv_div_L = 0d0 + else + L_conv_div_L = L_conv_end / case_data%L%val + end if + + write(io, '(a,",",a,",",a,",",*(g0,:,","))') trim(mode_name), trim(group_name), trim(scenario_name), & + step, time, dt, conv_vel_start, L_conv_start, case_data%L%val, case_data%gradr%val, case_data%gradL%val, & + case_data%grada%val, gradT%val, Y_face%val, conv_vel%val, L_conv_end, L_conv_div_L, tau_phys, ierr + end subroutine write_row + +end module test_time_dependence_support diff --git a/turb/test/src/test_turb.f90 b/turb/test/src/test_turb.f90 index 2e71a34b3..d7940fd62 100644 --- a/turb/test/src/test_turb.f90 +++ b/turb/test/src/test_turb.f90 @@ -4,12 +4,23 @@ program test_turb use auto_diff use const_def, only: dp, pi, rsun, lsun, msun, kerg, mp, boltz_sigma, standard_cgrav use turb + use test_time_dependence_support, only: check_time_dependence, write_time_dependence_csv implicit none + integer, parameter :: num_tdc_modes = 4 + character(len=32), parameter :: tdc_mode_names(num_tdc_modes) = [character(len=32) :: & + 'plain TDC', 'TDC + Af split', 'TDC + Arnett closure', 'TDC + acceleration limit'] + logical, parameter :: tdc_mode_use_arnett(num_tdc_modes) = [.false., .false., .true., .false.] + logical, parameter :: tdc_mode_use_accel(num_tdc_modes) = [.false., .false., .false., .true.] + logical, parameter :: tdc_mode_use_split(num_tdc_modes) = [.false., .true., .false., .false.] + call check_efficient_MLT_scaling() call check_TDC() call compare_TDC_and_Cox_MLT() + call header('Test Time Dependence') + call check_time_dependence() + call write_test_time_dependence_csv() contains @@ -81,19 +92,19 @@ end subroutine check_efficient_MLT_scaling subroutine compare_TDC_and_Cox_MLT() real(dp) :: mixing_length_alpha, conv_vel_start, & - TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, L_start, TDC_alpha_C, TDC_alpha_S + TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, TDC_alpha_C, TDC_alpha_S type(auto_diff_real_star_order1) :: & r, L, T, P, opacity, rho, dV, chiRho, chiT, Cp, gradr, grada, scale_height, gradL, grav, Lambda type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Gamma, Eq_div_w, energy real(dp) :: Henyey_MLT_nu_param, Henyey_MLT_y_param, max_conv_vel character(len=3) :: MLT_option - integer :: mixing_type, ierr, tdc_num_iters + integer :: mixing_type, ierr, tdc_num_iters, mode_i logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter include 'formats' - call header('Compare TDC with MLT Cox') + call header('Compare MLT and TDC Modes') ! For limiting the conv_vel coming out of mlt/TDC with Csound. max_conv_vel = 1d99 ! we don't limit the conv_vel for testing. @@ -138,7 +149,6 @@ subroutine compare_TDC_and_Cox_MLT() Eq_div_w = 0d0 ! TDC_alpha_M is implicit in this term include_mlt_corr_to_TDC = .true. use_TDC_enthalpy_flux_limiter = .false. - ! MLT MLT_option = 'Cox' Henyey_MLT_nu_param = 0d0 @@ -146,38 +156,42 @@ subroutine compare_TDC_and_Cox_MLT() write (*, 1) 'gradR - gradA', gradr%val - grada%val - call set_TDC( & - conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & - mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & - scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & - Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - energy, ierr) - - - write (*, 1) 'TDC: Y, conv_vel_start, conv_vel, dt ', Y_face%val, conv_vel_start, conv_vel%val, dt - call set_MLT(MLT_option, mixing_length_alpha, Henyey_MLT_nu_param, Henyey_MLT_y_param, & chiT, chiRho, Cp, grav, Lambda, rho, P, T, opacity, & gradr, grada, gradL, & Gamma, gradT, Y_face, conv_vel, D, mixing_type, max_conv_vel, ierr) - write (*, 1) 'MLT: Y, conv_vel_start, conv_vel, Gamma', Y_face%val, conv_vel_start, conv_vel%val, Gamma%val + write (*, '(a)') 'Mode: MLT' + write (*, 1) 'Y, conv_vel_start, conv_vel, Gamma', Y_face%val, conv_vel_start, conv_vel%val, Gamma%val + + do mode_i = 1, num_tdc_modes + conv_vel_start = 0d0 + call set_TDC( & + conv_vel_start, 0d0, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & + mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & + scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & + Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & + tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), TDC_arnett_growth_target_mlt, energy, ierr) + write (*, '(a)') 'Mode: ' // trim(tdc_mode_names(mode_i)) + write (*, 1) 'Y, conv_vel_start, conv_vel, dt', Y_face%val, conv_vel_start, conv_vel%val, dt + end do end subroutine compare_TDC_and_Cox_MLT subroutine check_TDC() real(dp) :: mixing_length_alpha, conv_vel_start - real(dp) :: TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, max_conv_vel, L_start, TDC_alpha_C, TDC_alpha_S + real(dp) :: TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, max_conv_vel, TDC_alpha_C, TDC_alpha_S type(auto_diff_real_star_order1) :: & r, L, T, P, opacity, rho, dV, chiRho, chiT, Cp, gradr, grada, scale_height, gradL type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Eq_div_w, grav, energy - integer :: mixing_type, ierr, tdc_num_iters + integer :: mixing_type, ierr, tdc_num_iters, mode_i logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter integer :: j + real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 include 'formats' - call header('Test TDC') + call header('Test TDC Modes') ! For limiting the conv_vel coming out of mlt/TDC with Csound. max_conv_vel = 1d99 ! we don't limit the conv_vel for testing. @@ -214,24 +228,32 @@ subroutine check_TDC() energy = 0d0 include_mlt_corr_to_TDC = .true. use_TDC_enthalpy_flux_limiter = .false. - - write (*, *) "####################################" - write (*, *) "Running dt test" - - do j = 0, 30 - dt = 500d0*pow(1.02d0, j) - call set_TDC( & - conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & - mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & - scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & - Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - energy, ierr) - - - write (*, 1) 'dt, gradT, conv_vel_start, conv_vel', dt, gradT%val, conv_vel_start, conv_vel%val - if (report) stop + do mode_i = 1, num_tdc_modes + write (*, '(a)') '####################################' + write (*, '(a)') 'Mode: ' // trim(tdc_mode_names(mode_i)) + write (*, '(a)') 'Running dt test' + + do j = 0, 30 + dt = 500d0*pow(1.02d0, j) + call set_TDC( & + conv_vel_start, gradT_start_old - gradL%val, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & + mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & + scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & + Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & + tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), TDC_arnett_growth_target_mlt, energy, ierr) + + write (*, 1) 'dt, gradT, conv_vel_start, conv_vel', dt, gradT%val, conv_vel_start, conv_vel%val + if (report) stop + end do end do end subroutine check_TDC + subroutine write_test_time_dependence_csv() + integer :: ierr + + call write_time_dependence_csv('plotter/time_dependence.csv', ierr) + if (ierr /= 0) stop 1 + end subroutine write_test_time_dependence_csv + end program test_turb diff --git a/turb/test/test_output b/turb/test/test_output index 454ffeb53..c858e00f4 100644 --- a/turb/test/test_output +++ b/turb/test/test_output @@ -9,11 +9,12 @@ Expected ~10 because in the efficient limit vc ~ L^{1/3} ---------------------------------------------------------------- - Test TDC + Test TDC Modes ---------------------------------------------------------------- - #################################### - Running dt test +#################################### +Mode: plain TDC +Running dt test dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5204370043250246D-01 5.2320587415154047D+07 6.0597238914198903D+06 dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5204285749162930D-01 5.2320587415154047D+07 5.9050075093203261D+06 dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5204196393651124D-01 5.2320587415154047D+07 5.7494001285570739D+06 @@ -45,11 +46,795 @@ Expected ~10 because in the efficient limit vc ~ L^{1/3} dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 +#################################### +Mode: TDC + Af split +Running dt test + dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5204370043250246D-01 5.2320587415154047D+07 6.0597238914198903D+06 + dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5204285749162930D-01 5.2320587415154047D+07 5.9050075093203261D+06 + dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5204196393651124D-01 5.2320587415154047D+07 5.7494001285570739D+06 + dt, gradT, conv_vel_start, conv_vel 5.3060399999999993D+02 2.5204101302204984D-01 5.2320587415154047D+07 5.5925658656495046D+06 + dt, gradT, conv_vel_start, conv_vel 5.4121608000000003D+02 2.5203999647052466D-01 5.2320587415154047D+07 5.4341006185611701D+06 + dt, gradT, conv_vel_start, conv_vel 5.5204040160000000D+02 2.5203890395733641D-01 5.2320587415154047D+07 5.2735100646096319D+06 + dt, gradT, conv_vel_start, conv_vel 5.6308120963200008D+02 2.5203772235599331D-01 5.2320587415154047D+07 5.1101775684554409D+06 + dt, gradT, conv_vel_start, conv_vel 5.7434283382464002D+02 2.5203643459023894D-01 5.2320587415154047D+07 4.9433157147388468D+06 + dt, gradT, conv_vel_start, conv_vel 5.8582969050113286D+02 2.5203501781331550D-01 5.2320587415154047D+07 4.7718899504500106D+06 + dt, gradT, conv_vel_start, conv_vel 5.9754628431115555D+02 2.5203344036462588D-01 5.2320587415154047D+07 4.5944918361562928D+06 + dt, gradT, conv_vel_start, conv_vel 6.0949720999737872D+02 2.5203165633254127D-01 5.2320587415154047D+07 4.4091141978058126D+06 + dt, gradT, conv_vel_start, conv_vel 6.2168715419732621D+02 2.5202959494944044D-01 5.2320587415154047D+07 4.2127157422839301D+06 + dt, gradT, conv_vel_start, conv_vel 6.3412089728127273D+02 2.5202713722579184D-01 5.2320587415154047D+07 4.0002689176325197D+06 + dt, gradT, conv_vel_start, conv_vel 6.4680331522689812D+02 2.5202405410296042D-01 5.2320587415154047D+07 3.7622592559380517D+06 + dt, gradT, conv_vel_start, conv_vel 6.5973938153143615D+02 2.5201978092426058D-01 5.2320587415154047D+07 3.4756430172060304D+06 + dt, gradT, conv_vel_start, conv_vel 6.7293416916206490D+02 2.5201140133059619D-01 5.2320587415154047D+07 3.0239000429141554D+06 + dt, gradT, conv_vel_start, conv_vel 6.8639285254530625D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.0012070959621246D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.1412312378813670D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.2840558626389941D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.4297369798917748D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.5783317194896108D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.7298983538794027D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 7.8844963209569903D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 8.0421862473761303D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 8.2030299723236533D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 8.3670905717701260D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 8.5344323832055295D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 + dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 +#################################### +Mode: TDC + Arnett closure +Running dt test + dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5206418300800154D-01 5.2320587415154047D+07 1.6677542875162063D+07 + dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5206408290709337D-01 5.2320587415154047D+07 1.6535942343005361D+07 + dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5206398162348564D-01 5.2320587415154047D+07 1.6395095276109921D+07 + dt, gradT, conv_vel_start, conv_vel 5.3060399999999993D+02 2.5206387914177358D-01 5.2320587415154047D+07 1.6255003277390720D+07 + dt, gradT, conv_vel_start, conv_vel 5.4121608000000003D+02 2.5206377544613878D-01 5.2320587415154047D+07 1.6115667806304075D+07 + dt, gradT, conv_vel_start, conv_vel 5.5204040160000000D+02 2.5206367052053480D-01 5.2320587415154047D+07 1.5977090186487976D+07 + dt, gradT, conv_vel_start, conv_vel 5.6308120963200008D+02 2.5206356434883304D-01 5.2320587415154047D+07 1.5839271612211445D+07 + dt, gradT, conv_vel_start, conv_vel 5.7434283382464002D+02 2.5206345691428195D-01 5.2320587415154047D+07 1.5702213135614676D+07 + dt, gradT, conv_vel_start, conv_vel 5.8582969050113286D+02 2.5206334820006576D-01 5.2320587415154047D+07 1.5565915684761290D+07 + dt, gradT, conv_vel_start, conv_vel 5.9754628431115555D+02 2.5206323818901338D-01 5.2320587415154047D+07 1.5430380057873391D+07 + dt, gradT, conv_vel_start, conv_vel 6.0949720999737872D+02 2.5206312686364857D-01 5.2320587415154047D+07 1.5295606927139120D+07 + dt, gradT, conv_vel_start, conv_vel 6.2168715419732621D+02 2.5206301420618338D-01 5.2320587415154047D+07 1.5161596840912011D+07 + dt, gradT, conv_vel_start, conv_vel 6.3412089728127273D+02 2.5206290019851052D-01 5.2320587415154047D+07 1.5028350225903768D+07 + dt, gradT, conv_vel_start, conv_vel 6.4680331522689812D+02 2.5206278482219630D-01 5.2320587415154047D+07 1.4895867389369542D+07 + dt, gradT, conv_vel_start, conv_vel 6.5973938153143615D+02 2.5206266805847288D-01 5.2320587415154047D+07 1.4764148521284653D+07 + dt, gradT, conv_vel_start, conv_vel 6.7293416916206490D+02 2.5206254988823046D-01 5.2320587415154047D+07 1.4633193696512120D+07 + dt, gradT, conv_vel_start, conv_vel 6.8639285254530625D+02 2.5206243029200931D-01 5.2320587415154047D+07 1.4503002876959939D+07 + dt, gradT, conv_vel_start, conv_vel 7.0012070959621246D+02 2.5206230924999140D-01 5.2320587415154047D+07 1.4373575913727390D+07 + dt, gradT, conv_vel_start, conv_vel 7.1412312378813670D+02 2.5206218674199193D-01 5.2320587415154047D+07 1.4244912549239578D+07 + dt, gradT, conv_vel_start, conv_vel 7.2840558626389941D+02 2.5206206274745041D-01 5.2320587415154047D+07 1.4117012419369336D+07 + dt, gradT, conv_vel_start, conv_vel 7.4297369798917748D+02 2.5206193724542159D-01 5.2320587415154047D+07 1.3989875055545826D+07 + dt, gradT, conv_vel_start, conv_vel 7.5783317194896108D+02 2.5206181021456614D-01 5.2320587415154047D+07 1.3863499886848994D+07 + dt, gradT, conv_vel_start, conv_vel 7.7298983538794027D+02 2.5206168163314091D-01 5.2320587415154047D+07 1.3737886242089199D+07 + dt, gradT, conv_vel_start, conv_vel 7.8844963209569903D+02 2.5206155147898895D-01 5.2320587415154047D+07 1.3613033351871220D+07 + dt, gradT, conv_vel_start, conv_vel 8.0421862473761303D+02 2.5206141972952911D-01 5.2320587415154047D+07 1.3488940350641957D+07 + dt, gradT, conv_vel_start, conv_vel 8.2030299723236533D+02 2.5206128636194908D-01 5.2320587415154047D+07 1.3365606284074448D+07 + dt, gradT, conv_vel_start, conv_vel 8.3670905717701260D+02 2.5206115135247592D-01 5.2320587415154047D+07 1.3243030092187464D+07 + dt, gradT, conv_vel_start, conv_vel 8.5344323832055295D+02 2.5206101467733599D-01 5.2320587415154047D+07 1.3121210636905069D+07 + dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 2.5206087631215318D-01 5.2320587415154047D+07 1.3000146688504113D+07 + dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 2.5206073623207331D-01 5.2320587415154047D+07 1.2879836931164706D+07 + dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 2.5206059441175166D-01 5.2320587415154047D+07 1.2760279964925412D+07 +#################################### +Mode: TDC + acceleration limit +Running dt test + dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5206387323614471D-01 5.2320587415154047D+07 1.6247003234033018D+07 + dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5206376930092206D-01 5.2320587415154047D+07 1.6107485434631741D+07 + dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5206366415898146D-01 5.2320587415154047D+07 1.5968764848771460D+07 + dt, gradT, conv_vel_start, conv_vel 5.3060399999999993D+02 2.5206355779572454D-01 5.2320587415154047D+07 1.5830843070094654D+07 + dt, gradT, conv_vel_start, conv_vel 5.4121608000000003D+02 2.5206345019634430D-01 5.2320587415154047D+07 1.5693721553130953D+07 + dt, gradT, conv_vel_start, conv_vel 5.5204040160000000D+02 2.5206334134582137D-01 5.2320587415154047D+07 1.5557401615557974D+07 + dt, gradT, conv_vel_start, conv_vel 5.6308120963200008D+02 2.5206323122892066D-01 5.2320587415154047D+07 1.5421884440460186D+07 + dt, gradT, conv_vel_start, conv_vel 5.7434283382464002D+02 2.5206311983018764D-01 5.2320587415154047D+07 1.5287171078584744D+07 + dt, gradT, conv_vel_start, conv_vel 5.8582969050113286D+02 2.5206300713394497D-01 5.2320587415154047D+07 1.5153262450593071D+07 + dt, gradT, conv_vel_start, conv_vel 5.9754628431115555D+02 2.5206289312428865D-01 5.2320587415154047D+07 1.5020159349307271D+07 + dt, gradT, conv_vel_start, conv_vel 6.0949720999737872D+02 2.5206277778508412D-01 5.2320587415154047D+07 1.4887862441950262D+07 + dt, gradT, conv_vel_start, conv_vel 6.2168715419732621D+02 2.5206266109996278D-01 5.2320587415154047D+07 1.4756372272378715D+07 + dt, gradT, conv_vel_start, conv_vel 6.3412089728127273D+02 2.5206254305231768D-01 5.2320587415154047D+07 1.4625689263307815D+07 + dt, gradT, conv_vel_start, conv_vel 6.4680331522689812D+02 2.5206242362529979D-01 5.2320587415154047D+07 1.4495813718527034D+07 + dt, gradT, conv_vel_start, conv_vel 6.5973938153143615D+02 2.5206230280181391D-01 5.2320587415154047D+07 1.4366745825105909D+07 + dt, gradT, conv_vel_start, conv_vel 6.7293416916206490D+02 2.5206218056451452D-01 5.2320587415154047D+07 1.4238485655589178D+07 + dt, gradT, conv_vel_start, conv_vel 6.8639285254530625D+02 2.5206205689580141D-01 5.2320587415154047D+07 1.4111033170180386D+07 + dt, gradT, conv_vel_start, conv_vel 7.0012070959621246D+02 2.5206193177781577D-01 5.2320587415154047D+07 1.3984388218913175D+07 + dt, gradT, conv_vel_start, conv_vel 7.1412312378813670D+02 2.5206180519243526D-01 5.2320587415154047D+07 1.3858550543809673D+07 + dt, gradT, conv_vel_start, conv_vel 7.2840558626389941D+02 2.5206167712127014D-01 5.2320587415154047D+07 1.3733519781025143D+07 + dt, gradT, conv_vel_start, conv_vel 7.4297369798917748D+02 2.5206154754565829D-01 5.2320587415154047D+07 1.3609295462978393D+07 + dt, gradT, conv_vel_start, conv_vel 7.5783317194896108D+02 2.5206141644666069D-01 5.2320587415154047D+07 1.3485877020467168D+07 + dt, gradT, conv_vel_start, conv_vel 7.7298983538794027D+02 2.5206128380505688D-01 5.2320587415154047D+07 1.3363263784768103D+07 + dt, gradT, conv_vel_start, conv_vel 7.8844963209569903D+02 2.5206114960133991D-01 5.2320587415154047D+07 1.3241454989720535D+07 + dt, gradT, conv_vel_start, conv_vel 8.0421862473761303D+02 2.5206101381571150D-01 5.2320587415154047D+07 1.3120449773793729D+07 + dt, gradT, conv_vel_start, conv_vel 8.2030299723236533D+02 2.5206087642807706D-01 5.2320587415154047D+07 1.3000247182137012D+07 + dt, gradT, conv_vel_start, conv_vel 8.3670905717701260D+02 2.5206073741804069D-01 5.2320587415154047D+07 1.2880846168612307D+07 + dt, gradT, conv_vel_start, conv_vel 8.5344323832055295D+02 2.5206059676489972D-01 5.2320587415154047D+07 1.2762245597808629D+07 + dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 2.5206045444763975D-01 5.2320587415154047D+07 1.2644444247038215D+07 + dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 2.5206031044492883D-01 5.2320587415154047D+07 1.2527440808313739D+07 + dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 2.5206016473511245D-01 5.2320587415154047D+07 1.2411233890306359D+07 ---------------------------------------------------------------- - Compare TDC with MLT Cox + Compare MLT and TDC Modes ---------------------------------------------------------------- gradR - gradA 4.0000000000040004D-06 - TDC: Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 - MLT: Y, conv_vel_start, conv_vel, Gamma 3.9999830300230244D-06 0.0000000000000000D+00 1.5051080930415759D+02 1.3740991947818479D-03 +Mode: MLT + Y, conv_vel_start, conv_vel, Gamma 3.9999830300230244D-06 0.0000000000000000D+00 1.5051080930415759D+02 1.3740991947818479D-03 +Mode: plain TDC + Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 +Mode: TDC + Af split + Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 +Mode: TDC + Arnett closure + Y, conv_vel_start, conv_vel, dt 3.9999852207537568D-06 0.0000000000000000D+00 1.5051080930415756D+02 1.0000000000000000D+40 +Mode: TDC + acceleration limit + Y, conv_vel_start, conv_vel, dt 3.9999830300861647D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 + ---------------------------------------------------------------- + + Test Time Dependence + + ---------------------------------------------------------------- + +Decay + + T[K] = 6.1319366651783681E+08 rho[g/cm^3] = 5.2045732574745753E+03 + P[dyn/cm^2] = 5.0581587249808894E+20 L[erg/s] = -5.5130555353408978E+45 + r[cm] = 1.0314294541567163E+10 Hp[cm] = 2.6386866020063782E+09 + gradL = 2.5207587267343501E-01 gradr = -1.2020505435123698E+05 grada = 2.5204697256872738E-01 + conv_vel_start[cm/s] = 5.2320587415154047E+07 gradT_start = 2.5204370043250246E-01 L_conv_start/L = 1.0000020967812193E+00 + Interpretation: Idealized deep-interior decay test with a large inward luminosity; a generic strongly contracting negative-luminosity state. + +Convection model: tdc + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206216661731234E-01 -1.3706056122687329E-05 5.2320587415154047E+07 1.4223996656248299E+07 1.0000020969348418E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5205110632014682E-01 -2.4766353288167702E-05 1.4223996656248299E+07 7.8717643317566449E+06 1.0000020968428298E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5203572180572381E-01 -4.0150867711182339E-05 7.8717643317566449E+06 4.8555587348417640E+06 1.0000020967148442E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 4.8555587348417640E+06 0.0000000000000000E+00 -6.6613381477509392E-16 + 5 9.9763115748443909E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 6 1.1971573889813269E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 7 1.3966836204782148E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 8 1.5962098519751025E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 9 1.7957360834719902E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 10 1.9952623149688782E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 11 2.1947885464657661E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 12 2.3943147779626538E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + tau_phys[s] 2.4407158796310516E-02 + +Convection model: tdc_with_Af_split + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .true. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206216661731234E-01 -1.3706056122687329E-05 5.2320587415154047E+07 1.4223996656248299E+07 1.0000020969348418E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5205110632014682E-01 -2.4766353288167702E-05 1.4223996656248299E+07 7.8717643317566449E+06 1.0000020968428298E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5203572180572381E-01 -4.0150867711182339E-05 7.8717643317566449E+06 4.8555587348417640E+06 1.0000020967148442E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 4.8555587348417640E+06 0.0000000000000000E+00 -6.6613381477509392E-16 + 5 9.9763115748443909E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 6 1.1971573889813269E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 7 1.3966836204782148E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 8 1.5962098519751025E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 9 1.7957360834719902E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 10 1.9952623149688782E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 11 2.1947885464657661E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 12 2.3943147779626538E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + tau_phys[s] 2.4407158796310516E-02 + +Convection model: tdc_with_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206216661731234E-01 -1.3706056122687329E-05 5.2320587415154047E+07 1.4223996656248299E+07 1.0000020969348418E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5205110632014682E-01 -2.4766353288167702E-05 1.4223996656248299E+07 7.8717643317566449E+06 1.0000020968428298E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5203572180572381E-01 -4.0150867711182339E-05 7.8717643317566449E+06 4.8555587348417640E+06 1.0000020967148442E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 4.8555587348417640E+06 0.0000000000000000E+00 -6.6613381477509392E-16 + 5 9.9763115748443909E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 6 1.1971573889813269E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 7 1.3966836204782148E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 8 1.5962098519751025E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 9 1.7957360834719902E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 10 1.9952623149688782E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 11 2.1947885464657661E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + 12 2.3943147779626538E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 + tau_phys[s] 2.4407158796310516E-02 + +Convection model: tdc_with_arnett_closure + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206182001458954E-01 -1.4052658845437666E-05 2.4011193072444737E+07 1.3873167997163163E+07 1.0000020969319583E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205438149247528E-01 -2.1491180959748781E-05 1.3873167997163163E+07 9.0713905769964289E+06 1.0000020968700762E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204524357187114E-01 -3.0629101563847604E-05 9.0713905769964289E+06 6.3650217225108435E+06 1.0000020967940568E+00 + 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203397101831237E-01 -4.1901655122646402E-05 6.3650217225108435E+06 4.6526777007509712E+06 1.0000020967002792E+00 + 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5201982717062937E-01 -5.6045502805643498E-05 4.6526777007509712E+06 3.4785109711089474E+06 1.0000020965826149E+00 + 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200162875243959E-01 -7.4243920995430379E-05 3.4785109711089474E+06 2.6258701553926971E+06 1.0000020964312202E+00 + 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5197745619178208E-01 -9.8416481652949052E-05 2.6258701553926971E+06 1.9809171497260793E+06 1.0000020962301257E+00 + 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5194408147891123E-01 -1.3179119452377133E-04 1.9809171497260793E+06 1.4792710315161166E+06 1.0000020959524776E+00 + 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5189578380675709E-01 -1.8008886667794557E-04 1.4792710315161166E+06 1.0825483000777548E+06 1.0000020955506834E+00 + 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5182170737495413E-01 -2.5416529848086930E-04 1.0825483000777548E+06 7.6703978566282836E+05 1.0000020949344330E+00 + 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5169935498816232E-01 -3.7651768527268890E-04 7.6703978566282836E+05 5.1778416657852300E+05 1.0000020939165690E+00 + tau_phys[s] 2.4407158796310516E-02 + +Convection model: tdc_with_arnett_closure_tdc_ss + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_no_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206182001458954E-01 -1.4052658845437666E-05 2.4011193072444737E+07 1.3873167997163163E+07 1.0000020969319583E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205438149247528E-01 -2.1491180959748781E-05 1.3873167997163163E+07 9.0713905769964289E+06 1.0000020968700762E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204524357187114E-01 -3.0629101563847604E-05 9.0713905769964289E+06 6.3650217225108435E+06 1.0000020967940568E+00 + 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203397101831237E-01 -4.1901655122646402E-05 6.3650217225108435E+06 4.6526777007509712E+06 1.0000020967002792E+00 + 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5201982717062937E-01 -5.6045502805643498E-05 4.6526777007509712E+06 3.4785109711089474E+06 1.0000020965826149E+00 + 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200162875243959E-01 -7.4243920995430379E-05 3.4785109711089474E+06 2.6258701553926971E+06 1.0000020964312202E+00 + 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5197745619178208E-01 -9.8416481652949052E-05 2.6258701553926971E+06 1.9809171497260793E+06 1.0000020962301257E+00 + 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5194408147891123E-01 -1.3179119452377133E-04 1.9809171497260793E+06 1.4792710315161166E+06 1.0000020959524776E+00 + 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5189578380675709E-01 -1.8008886667794557E-04 1.4792710315161166E+06 1.0825483000777548E+06 1.0000020955506834E+00 + 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5182170737495413E-01 -2.5416529848086930E-04 1.0825483000777548E+06 7.6703978566282836E+05 1.0000020949344330E+00 + 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5169935498816232E-01 -3.7651768527268890E-04 7.6703978566282836E+05 5.1778416657852300E+05 1.0000020939165690E+00 + tau_phys[s] 2.4407158796310516E-02 + +Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_with_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206182001458954E-01 -1.4052658845437666E-05 2.4011193072444737E+07 1.3873167997163163E+07 1.0000020969319583E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205438149247528E-01 -2.1491180959748781E-05 1.3873167997163163E+07 9.0713905769964289E+06 1.0000020968700762E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204524357187114E-01 -3.0629101563847604E-05 9.0713905769964289E+06 6.3650217225108435E+06 1.0000020967940568E+00 + 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203397101831237E-01 -4.1901655122646402E-05 6.3650217225108435E+06 4.6526777007509712E+06 1.0000020967002792E+00 + 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5201982717062937E-01 -5.6045502805643498E-05 4.6526777007509712E+06 3.4785109711089474E+06 1.0000020965826149E+00 + 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200162875243959E-01 -7.4243920995430379E-05 3.4785109711089474E+06 2.6258701553926971E+06 1.0000020964312202E+00 + 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5197745619178208E-01 -9.8416481652949052E-05 2.6258701553926971E+06 1.9809171497260793E+06 1.0000020962301257E+00 + 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5194408147891123E-01 -1.3179119452377133E-04 1.9809171497260793E+06 1.4792710315161166E+06 1.0000020959524776E+00 + 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5189578380675709E-01 -1.8008886667794557E-04 1.4792710315161166E+06 1.0825483000777548E+06 1.0000020955506834E+00 + 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5182170737495413E-01 -2.5416529848086930E-04 1.0825483000777548E+06 7.6703978566282836E+05 1.0000020949344330E+00 + 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5169935498816232E-01 -3.7651768527268890E-04 7.6703978566282836E+05 5.1778416657852300E+05 1.0000020939165690E+00 + tau_phys[s] 2.4407158796310516E-02 + +Convection model: tdc_with_acceleration_limit + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .true. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 + 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206758806058704E-01 -8.2846128479657675E-06 5.2320587415154047E+07 2.3532167410343025E+07 1.0000020969799432E+00 + 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206173568375961E-01 -1.4136989675374021E-05 2.3532167410343025E+07 1.3790410896198066E+07 1.0000020969312566E+00 + 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205450899117010E-01 -2.1363682264881386E-05 1.3790410896198066E+07 9.1255287375001255E+06 1.0000020968711369E+00 + 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204577378855098E-01 -3.0098884884035677E-05 9.1255287375001255E+06 6.4771468173637539E+06 1.0000020967984677E+00 + 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203520056883455E-01 -4.0672104600445126E-05 6.4771468173637539E+06 4.7933318998581618E+06 1.0000020967105079E+00 + 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5202224016998098E-01 -5.3632503454028986E-05 4.7933318998581618E+06 3.6350139158013938E+06 1.0000020966026888E+00 + 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200604740238397E-01 -6.9825271051036477E-05 3.6350139158013938E+06 2.7920392349913488E+06 1.0000020964679794E+00 + 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5198533132299578E-01 -9.0541350439236155E-05 2.7920392349913488E+06 2.1532139225782664E+06 1.0000020962956397E+00 + 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5195808332967567E-01 -1.1778934375932993E-04 2.1532139225782664E+06 1.6551148861899225E+06 1.0000020960689606E+00 + 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5192107875150627E-01 -1.5479392192872549E-04 1.6551148861899225E+06 1.2594480054608323E+06 1.0000020957611151E+00 + 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5186892727679827E-01 -2.0694539663674628E-04 1.2594480054608323E+06 9.4205959308299061E+05 1.0000020953272608E+00 + 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5179216466102777E-01 -2.8370801240722605E-04 9.4205959308299061E+05 6.8716739568737103E+05 1.0000020946886636E+00 + tau_phys[s] 2.4407158796310516E-02 + + +Growth + + T[K] = 1.0000000000000000E+05 rho[g/cm^3] = 1.0000000000000001E-05 + P[dyn/cm^2] = 8.2543997567252174E+07 L[erg/s] = 2.4440540110725111E+35 + r[cm] = 6.9570000000000000E+10 Hp[cm] = 3.0103560887821615E+08 + gradL = 4.0000000000000002E-01 gradr = 4.0000400000000003E-01 grada = 4.0000000000000002E-01 + conv_vel_start[cm/s] = 0.0000000000000000E+00 gradT_start = 4.0000400000000003E-01 L_conv_start/L = 0.0000000000000000E+00 + Interpretation: Idealized generic onset test in a dilute, marginally unstable layer initialized on the radiative branch. + +Convection model: tdc + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397716939257E-01 3.9771693925558278E-06 0.0000000000000000E+00 2.7948760309172320E+02 7.1495234560010973E-02 5.7075947856866094E-08 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395493296970E-01 3.9549329696727386E-06 2.7948760309172320E+02 5.5477497861836196E+02 1.4191601625825195E-01 1.1266644917018453E-07 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393347167013E-01 3.9334716701094930E-06 5.5477497861836196E+02 8.2341845398708051E+02 2.1063723348590743E-01 1.6631916155418483E-07 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000391293777982E-01 3.9129377797828441E-06 8.2341845398708051E+02 1.0832121431338355E+03 2.7709460238989475E-01 2.1765337399060058E-07 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000389344979725E-01 3.8934497972205580E-06 1.0832121431338355E+03 1.3322532528000313E+03 3.4080137275718969E-01 2.6637284322728050E-07 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000387510756641E-01 3.8751075663634162E-06 1.3322532528000313E+03 1.5689873926498860E+03 4.0135991871664384E-01 3.1222796181840096E-07 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000385796830107E-01 3.8579683010650897E-06 1.5689873926498860E+03 1.7922298853375303E+03 4.5846719002995001E-01 3.5507569662307498E-07 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000384206410128E-01 3.8420641012738213E-06 1.7922298853375303E+03 2.0011670228765338E+03 5.1191503348133172E-01 3.9483579850063677E-07 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000382740094365E-01 3.8274009436087563E-06 2.0011670228765338E+03 2.1953387606570254E+03 5.6158576586435349E-01 4.3149332606962082E-07 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000381396225176E-01 3.8139622517159853E-06 2.1953387606570254E+03 2.3746071539845266E+03 6.0744409978816527E-01 4.6508971973668878E-07 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000380171283689E-01 3.8017128368745924E-06 2.3746071539845266E+03 2.5391150402843618E+03 6.4952657424453109E-01 4.9571295068773225E-07 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000379060290026E-01 3.7906029002259580E-06 2.5391150402843618E+03 2.6892393632450708E+03 6.8792961453865198E-01 5.2348751455877363E-07 + tau_phys[s] 1.5401478440959990E+05 + conv_vel_eq[cm/s] 3.9091780705625856E+03 + +Convection model: tdc_with_Af_split + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .true. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397716939257E-01 3.9771693925558278E-06 0.0000000000000000E+00 2.7948760309172320E+02 7.1495234560010973E-02 5.7075947856866094E-08 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395493296970E-01 3.9549329696727386E-06 2.7948760309172320E+02 5.5477497861836196E+02 1.4191601625825195E-01 1.1266644917018453E-07 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393347167013E-01 3.9334716701094930E-06 5.5477497861836196E+02 8.2341845398708051E+02 2.1063723348590743E-01 1.6631916155418483E-07 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000391293777982E-01 3.9129377797828441E-06 8.2341845398708051E+02 1.0832121431338355E+03 2.7709460238989475E-01 2.1765337399060058E-07 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000389344979725E-01 3.8934497972205580E-06 1.0832121431338355E+03 1.3322532528000313E+03 3.4080137275718969E-01 2.6637284322728050E-07 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000387510756641E-01 3.8751075663634162E-06 1.3322532528000313E+03 1.5689873926498860E+03 4.0135991871664384E-01 3.1222796181840096E-07 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000385796830107E-01 3.8579683010650897E-06 1.5689873926498860E+03 1.7922298853375303E+03 4.5846719002995001E-01 3.5507569662307498E-07 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000384206410128E-01 3.8420641012738213E-06 1.7922298853375303E+03 2.0011670228765338E+03 5.1191503348133172E-01 3.9483579850063677E-07 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000382740094365E-01 3.8274009436087563E-06 2.0011670228765338E+03 2.1953387606570254E+03 5.6158576586435349E-01 4.3149332606962082E-07 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000381396225176E-01 3.8139622517159853E-06 2.1953387606570254E+03 2.3746071539845266E+03 6.0744409978816527E-01 4.6508971973668878E-07 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000380171283689E-01 3.8017128368745924E-06 2.3746071539845266E+03 2.5391150402843618E+03 6.4952657424453109E-01 4.9571295068773225E-07 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000379060290026E-01 3.7906029002259580E-06 2.5391150402843618E+03 2.6892393632450708E+03 6.8792961453865198E-01 5.2348751455877363E-07 + tau_phys[s] 1.5401478440959990E+05 + conv_vel_eq[cm/s] 3.9091780705625856E+03 + +Convection model: tdc_with_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000214698E-01 4.0000021469332226E-06 0.0000000000000000E+00 3.8633120695816348E-01 2.5667997066102185E-03 -5.3672621902478568E-12 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000400000210340E-01 4.0000021033756866E-06 3.8633120695816348E-01 7.7265731910856306E-01 5.1335655631176286E-03 -5.2584603338345914E-12 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000400000205982E-01 4.0000020598193017E-06 7.7265731910856306E-01 1.1589732461189168E+00 7.7002637491546998E-03 -5.1494364328164019E-12 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000400000201630E-01 4.0000020162646295E-06 1.1589732461189168E+00 1.5452738981937484E+00 1.0266860447920460E-02 -5.0406345764031357E-12 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000400000197273E-01 4.0000019727122672E-06 1.5452738981937484E+00 1.9315541863426069E+00 1.2833321847962554E-02 -4.9316106753849454E-12 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000400000192921E-01 4.0000019291627696E-06 1.9315541863426069E+00 2.3178090226481904E+00 1.5399614144958678E-02 -4.8228088189716800E-12 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000400000188563E-01 4.0000018856167177E-06 2.3178090226481904E+00 2.7040333205343550E+00 1.7965703543497226E-02 -4.7140069625584147E-12 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000400000184211E-01 4.0000018420746816E-06 2.7040333205343550E+00 3.0902219950339695E+00 2.0531556258856939E-02 -4.6052051061451493E-12 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000400000179853E-01 4.0000017985372355E-06 3.0902219950339695E+00 3.4763699630565950E+00 2.3097138518785379E-02 -4.4961812051269590E-12 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000400000175501E-01 4.0000017550049487E-06 3.4763699630565950E+00 3.8624721436559484E+00 2.5662416565275962E-02 -4.3873793487136936E-12 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000400000171149E-01 4.0000017114784031E-06 3.8624721436559484E+00 4.2485234582971305E+00 2.8227356656343426E-02 -4.2785774923004283E-12 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000400000166797E-01 4.0000016679581679E-06 4.2485234582971305E+00 4.6345188311235814E+00 3.0791925067797508E-02 -4.1697756358871629E-12 + tau_phys[s] 4.0001848084279178E+06 + conv_vel_eq[cm/s] 1.5051085052069075E+02 + +Convection model: tdc_with_arnett_closure + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000215053E-01 4.0000021504806016E-06 0.0000000000000000E+00 3.5486498395614025E-01 2.3577375312560877E-03 -5.3761439744448572E-12 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000400000211050E-01 4.0000021104709140E-06 3.5486498395614025E-01 7.0972405000613070E-01 4.7154357437006085E-03 -5.2762239022285931E-12 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000400000207048E-01 4.0000020704623351E-06 7.0972405000613070E-01 1.0645732532520236E+00 7.0730684272695410E-03 -5.1760817854074048E-12 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000400000203046E-01 4.0000020304553189E-06 1.0645732532520236E+00 1.4194086493002254E+00 9.4306093752498151E-03 -5.0759396685862157E-12 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000400000199049E-01 4.0000019904503078E-06 1.4194086493002254E+00 1.7742262944368432E+00 1.1788032385444317E-02 -4.9760195963699516E-12 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000400000195047E-01 4.0000019504477335E-06 1.7742262944368432E+00 2.1290222458029628E+00 1.4145311261336450E-02 -4.8760995241536875E-12 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000400000191050E-01 4.0000019104480594E-06 2.1290222458029628E+00 2.4837925615698393E+00 1.6502419813254100E-02 -4.7761794519374234E-12 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000400000187047E-01 4.0000018704517176E-06 2.4837925615698393E+00 2.8385333011139875E+00 1.8859331859532952E-02 -4.6760373351162343E-12 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000400000183051E-01 4.0000018304591570E-06 2.8385333011139875E+00 3.1932405251921545E+00 2.1216021227679013E-02 -4.5761172628999702E-12 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000400000179048E-01 4.0000017904708162E-06 3.1932405251921545E+00 3.5479102961161524E+00 2.3572461755530197E-02 -4.4761971906837061E-12 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000400000175051E-01 4.0000017504871452E-06 3.5479102961161524E+00 3.9025386779275455E+00 2.5928627292416968E-02 -4.3762771184674421E-12 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000400000171055E-01 4.0000017105085826E-06 3.9025386779275455E+00 4.2571217365721683E+00 2.8284491700321844E-02 -4.2763570462511780E-12 + tau_phys[s] 4.0001859038558854E+06 + conv_vel_eq[cm/s] 1.5051080930415756E+02 + +Convection model: tdc_with_arnett_closure_tdc_ss + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_no_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397905964313E-01 3.9790596431254168E-06 0.0000000000000000E+00 2.5622791658289248E+02 6.5545214865593907E-02 5.2350368706655104E-08 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395868380273E-01 3.9586838027330971E-06 2.5622791658289248E+02 5.0812241374390942E+02 1.2998190529365766E-01 1.0328946031812336E-07 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393900405307E-01 3.9390040530690553E-06 5.0812241374390942E+02 7.5388597854220450E+02 1.9285025264497857E-01 1.5248834250858323E-07 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000392012896901E-01 3.9201289690074889E-06 7.5388597854220450E+02 9.9191947411124386E+02 2.5374118451669631E-01 1.9967558073652467E-07 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000390214122467E-01 3.9021412246235627E-06 9.9191947411124386E+02 1.2208544242941691E+03 3.1230463341836739E-01 2.4464449199790295E-07 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000388511314366E-01 3.8851131436649770E-06 1.2208544242941691E+03 1.4395732327535929E+03 3.6825470898705265E-01 2.8721426881261891E-07 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000386908437530E-01 3.8690843752875792E-06 1.4395732327535929E+03 1.6472153079290754E+03 4.2137126480196846E-01 3.2728578891472182E-07 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000385407841926E-01 3.8540784192664383E-06 1.6472153079290754E+03 1.8431728577811130E+03 4.7149882264530724E-01 3.6480030385366291E-07 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000384010097301E-01 3.8401009729872936E-06 1.8431728577811130E+03 2.0270770882940803E+03 5.1854304196543177E-01 3.9974357013417006E-07 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000382714228588E-01 3.8271422858515486E-06 2.0270770882940803E+03 2.1987773001609389E+03 5.6246537263637719E-01 4.3213996392399418E-07 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000381517966382E-01 3.8151796637934343E-06 2.1987773001609389E+03 2.3583151952953904E+03 6.0327648235169695E-01 4.6204622006218443E-07 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000380417997322E-01 3.8041799732138720E-06 2.3583151952953904E+03 2.5058965519565550E+03 6.4102901088768294E-01 4.8954517151145183E-07 + tau_phys[s] 1.5401478440959990E+05 + conv_vel_eq[cm/s] 3.9091780705625856E+03 + +Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_with_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000215053E-01 4.0000021504807583E-06 0.0000000000000000E+00 3.5486668024615414E-01 2.3577481558206366E-03 -5.3761439744448572E-12 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000400000211050E-01 4.0000021104708784E-06 3.5486668024615414E-01 7.0972743898010049E-01 4.7154569688816830E-03 -5.2762239022285931E-12 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000400000207048E-01 4.0000020704621148E-06 7.0972743898010049E-01 1.0645783312664758E+00 7.0731002288777056E-03 -5.1760817854074048E-12 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000400000203046E-01 4.0000020304549073E-06 1.0645783312664758E+00 1.4194154126744352E+00 9.4306517288553094E-03 -5.0759396685862157E-12 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000400000199049E-01 4.0000019904497038E-06 1.4194154126744352E+00 1.7742347394530025E+00 1.1788085266378175E-02 -4.9760195963699516E-12 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000400000195047E-01 4.0000019504469449E-06 1.7742347394530025E+00 2.1290323687063499E+00 1.4145374644691623E-02 -4.8760995241536875E-12 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000400000191044E-01 4.0000019104470786E-06 2.1290323687063499E+00 2.4838043585689924E+00 1.6502493673886610E-02 -4.7759574073324984E-12 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000400000187047E-01 4.0000018704505453E-06 2.4838043585689924E+00 2.8385467683808785E+00 1.8859416172063045E-02 -4.6760373351162343E-12 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000400000183051E-01 4.0000018304577992E-06 2.8385467683808785E+00 3.1932556588623648E+00 2.1216115966492314E-02 -4.5761172628999702E-12 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000400000179048E-01 4.0000017904692746E-06 3.1932556588623648E+00 3.5479270922890560E+00 2.3572566894778938E-02 -4.4761971906837061E-12 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000400000175051E-01 4.0000017504854113E-06 3.5479270922890560E+00 3.9025571326664878E+00 2.5928742806021168E-02 -4.3762771184674421E-12 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000400000171055E-01 4.0000017105066649E-06 3.9025571326664878E+00 4.2571418459046519E+00 2.8284617561970538E-02 -4.2763570462511780E-12 + tau_phys[s] 4.0001848084279178E+06 + conv_vel_eq[cm/s] 1.5051085052069075E+02 + +Convection model: tdc_with_acceleration_limit + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .true. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 + 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397906682761E-01 3.9790668275639272E-06 0.0000000000000000E+00 2.5610668006689633E+02 6.5514201564637081E-02 5.2332407740607323E-08 + 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395870019106E-01 3.9587001910622614E-06 2.5610668006689633E+02 5.0788164619975976E+02 1.2992031496960393E-01 1.0324848986886792E-07 + 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393902906861E-01 3.9390290685648684E-06 5.0788164619975976E+02 7.5353032017462010E+02 1.9275927230047529E-01 1.5242580431173991E-07 + 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000392016185576E-01 3.9201618557629890E-06 7.5353032017462010E+02 9.9145617735202836E+02 2.5362266938362926E-01 1.9959336472474831E-07 + 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000390218513221E-01 3.9021851322061936E-06 9.9145617735202836E+02 1.2202929165191219E+03 3.1216099509723910E-01 2.4453472424745826E-07 + 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000388516342067E-01 3.8851634206675437E-06 1.2202929165191219E+03 1.4389246229381201E+03 3.6808878924541771E-01 2.8708857746639893E-07 + 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000386913999231E-01 3.8691399922794135E-06 1.4389246229381201E+03 1.6464918522109924E+03 4.2118619886098951E-01 3.2714674780276454E-07 + 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000385413833245E-01 3.8541383324098155E-06 1.6464918522109924E+03 1.8423874388500608E+03 4.7129790600327282E-01 3.6465052244416535E-07 + 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000384016415824E-01 3.8401641581925262E-06 1.8423874388500608E+03 2.0262427348297099E+03 5.1832960746607926E-01 3.9958560860142711E-07 + 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000382720776673E-01 3.8272077666912246E-06 2.0262427348297099E+03 2.1979067682379173E+03 5.6224268338884031E-01 4.3197626353741470E-07 + 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000381524653283E-01 3.8152465328255701E-06 2.1979067682379173E+03 2.3574206248425303E+03 6.0304764384991660E-01 4.6187904922945222E-07 + 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000380424740695E-01 3.8042474068968323E-06 2.3574206248425303E+03 2.5049892033251745E+03 6.4079690362242092E-01 4.8937658891912150E-07 + tau_phys[s] 1.5401478440959990E+05 + conv_vel_eq[cm/s] 3.9091780705625856E+03 + + +Envelope Decay + + T[K] = 1.0000000000000000E+05 rho[g/cm^3] = 1.0000000000000001E-05 + P[dyn/cm^2] = 8.2543997567252174E+07 L[erg/s] = 2.4440051304810954E+35 + r[cm] = 6.9570000000000000E+10 Hp[cm] = 3.0103560887821615E+08 + gradL = 4.0000000000000002E-01 gradr = 3.9999599999999996E-01 grada = 4.0000000000000002E-01 + conv_vel_start[cm/s] = 1.5051080930415759E+02 gradT_start = 4.0000399998303005E-01 L_conv_start/L = -2.0000157576749444E-05 + Interpretation: Idealized generic envelope decay test in a dilute, slightly stable layer initialized from a nearby unstable convective state. + +Convection model: tdc + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999600459798040E-01 -3.9954020196233482E-06 1.5051080930415759E+02 5.6023963943454127E+01 -1.1495066010169808E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 5.6023963943454127E+01 0.0000000000000000E+00 -2.2204460492503131E-16 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + tau_phys[s] 5.1712339439846779E+04 + +Convection model: tdc_with_Af_split + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .true. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601233828330E-01 -3.9876617167210728E-06 1.5051080930415759E+02 1.5062723972850915E+02 -3.0846016851882041E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999600460753221E-01 -3.9953924678421233E-06 1.5062723972850915E+02 5.6140482309923982E+01 -1.1518945797206470E-08 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 5.6140482309923982E+01 0.0000000000000000E+00 -2.2204460492503131E-16 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + tau_phys[s] 5.1712339439846779E+04 + +Convection model: tdc_with_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999600459798040E-01 -3.9954020196233482E-06 1.5051080930415759E+02 5.6023963943454127E+01 -1.1495066010169808E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 5.6023963943454127E+01 0.0000000000000000E+00 -2.2204460492503131E-16 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 + tau_phys[s] 5.1712339439846779E+04 + +Convection model: tdc_with_arnett_closure + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601118303718E-01 -3.9888169628287702E-06 1.4333884136075864E+02 1.3651284352704997E+02 -2.7957872683614937E-08 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601065211243E-01 -3.9893478875881710E-06 1.3651284352704997E+02 1.3001573464797281E+02 -2.6630547544925776E-08 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601014660824E-01 -3.9898533917723057E-06 1.3001573464797281E+02 1.2383131323690023E+02 -2.5366774458746022E-08 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600966528720E-01 -3.9903347128151052E-06 1.2383131323690023E+02 1.1794420882538631E+02 -2.4163459677595256E-08 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600920697398E-01 -3.9907930260371550E-06 1.1794420882538631E+02 1.1233983630660511E+02 -2.3017665107261109E-08 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600877055208E-01 -3.9912294479361355E-06 1.1233983630660511E+02 1.0700435306171352E+02 -2.1926599647059675E-08 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600835496074E-01 -3.9916450392873039E-06 1.0700435306171352E+02 1.0192461867543554E+02 -2.0887610752140517E-08 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600795919193E-01 -3.9920408080663319E-06 1.0192461867543554E+02 9.7088157062666198E+01 -1.9898178882371553E-08 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600758228782E-01 -3.9924177122059408E-06 9.7088157062666198E+01 9.2483120841990669E+01 -1.8955909286688666E-08 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600722333783E-01 -3.9927766621969745E-06 9.2483120841990669E+01 8.8098257804847563E+01 -1.8058525341757559E-08 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600688147646E-01 -3.9931185235436489E-06 8.8098257804847563E+01 8.3922879340761455E+01 -1.7203863222903237E-08 + tau_phys[s] 5.1712339439846779E+04 + +Convection model: tdc_with_arnett_closure_tdc_ss + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_no_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601118303718E-01 -3.9888169628287702E-06 1.4333884136075864E+02 1.3651284352704997E+02 -2.7957872683614937E-08 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601065211243E-01 -3.9893478875881710E-06 1.3651284352704997E+02 1.3001573464797281E+02 -2.6630547544925776E-08 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601014660824E-01 -3.9898533917723057E-06 1.3001573464797281E+02 1.2383131323690023E+02 -2.5366774458746022E-08 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600966528720E-01 -3.9903347128151052E-06 1.2383131323690023E+02 1.1794420882538631E+02 -2.4163459677595256E-08 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600920697398E-01 -3.9907930260371550E-06 1.1794420882538631E+02 1.1233983630660511E+02 -2.3017665107261109E-08 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600877055208E-01 -3.9912294479361355E-06 1.1233983630660511E+02 1.0700435306171352E+02 -2.1926599647059675E-08 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600835496074E-01 -3.9916450392873039E-06 1.0700435306171352E+02 1.0192461867543554E+02 -2.0887610752140517E-08 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600795919193E-01 -3.9920408080663319E-06 1.0192461867543554E+02 9.7088157062666198E+01 -1.9898178882371553E-08 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600758228782E-01 -3.9924177122059408E-06 9.7088157062666198E+01 9.2483120841990669E+01 -1.8955909286688666E-08 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600722333783E-01 -3.9927766621969745E-06 9.2483120841990669E+01 8.8098257804847563E+01 -1.8058525341757559E-08 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600688147646E-01 -3.9931185235436489E-06 8.8098257804847563E+01 8.3922879340761455E+01 -1.7203863222903237E-08 + tau_phys[s] 5.1712339439846779E+04 + +Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_with_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601118303718E-01 -3.9888169628287702E-06 1.4333884136075864E+02 1.3651284352704997E+02 -2.7957872683614937E-08 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601065211243E-01 -3.9893478875881710E-06 1.3651284352704997E+02 1.3001573464797281E+02 -2.6630547544925776E-08 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601014660824E-01 -3.9898533917723057E-06 1.3001573464797281E+02 1.2383131323690023E+02 -2.5366774458746022E-08 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600966528720E-01 -3.9903347128151052E-06 1.2383131323690023E+02 1.1794420882538631E+02 -2.4163459677595256E-08 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600920697398E-01 -3.9907930260371550E-06 1.1794420882538631E+02 1.1233983630660511E+02 -2.3017665107261109E-08 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600877055208E-01 -3.9912294479361355E-06 1.1233983630660511E+02 1.0700435306171352E+02 -2.1926599647059675E-08 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600835496074E-01 -3.9916450392873039E-06 1.0700435306171352E+02 1.0192461867543554E+02 -2.0887610752140517E-08 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600795919193E-01 -3.9920408080663319E-06 1.0192461867543554E+02 9.7088157062666198E+01 -1.9898178882371553E-08 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600758228782E-01 -3.9924177122059408E-06 9.7088157062666198E+01 9.2483120841990669E+01 -1.8955909286688666E-08 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600722333783E-01 -3.9927766621969745E-06 9.2483120841990669E+01 8.8098257804847563E+01 -1.8058525341757559E-08 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600688147646E-01 -3.9931185235436489E-06 8.8098257804847563E+01 8.3922879340761455E+01 -1.7203863222903237E-08 + tau_phys[s] 5.1712339439846779E+04 + +Convection model: tdc_with_acceleration_limit + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .true. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L + 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 + 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601231906107E-01 -3.9876809389473039E-06 1.5051080930415759E+02 1.5039184667947683E+02 -3.0797960848261141E-08 + 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601173381572E-01 -3.9882661842796214E-06 1.5039184667947683E+02 1.4322611570825293E+02 -2.9334832785110617E-08 + 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601117663830E-01 -3.9888233617351223E-06 1.4322611570825293E+02 1.3640600108423521E+02 -2.7941875258008505E-08 + 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601064615808E-01 -3.9893538419139621E-06 1.3640600108423521E+02 1.2991444404870444E+02 -2.6615661452566997E-08 + 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999601014107378E-01 -3.9898589262223817E-06 1.2991444404870444E+02 1.2373526389999549E+02 -2.5352937971234724E-08 + 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600966014942E-01 -3.9903398505742943E-06 1.2373526389999549E+02 1.1785310947451343E+02 -2.4150615063334158E-08 + 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600920221112E-01 -3.9907977888759667E-06 1.1785310947451343E+02 1.1225341360941988E+02 -2.3005757965322001E-08 + 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600876614372E-01 -3.9912338563081760E-06 1.1225341360941988E+02 1.0692235037754655E+02 -2.1915578463094224E-08 + 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600835088761E-01 -3.9916491124191063E-06 1.0692235037754655E+02 1.0184679490185958E+02 -2.0877427786558659E-08 + 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600795543599E-01 -3.9920445640402590E-06 1.0184679490185958E+02 9.7014285572520834E+01 -1.9888789060118484E-08 + 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600757883197E-01 -3.9924211680367763E-06 9.7014285572520834E+01 9.2412988502788608E+01 -1.8947269531111033E-08 + 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600722016609E-01 -3.9927798339027035E-06 9.2412988502788608E+01 8.8031664073266199E+01 -1.8050595906871081E-08 + tau_phys[s] 5.1712339439846779E+04 + + +Carbon Burning + + T[K] = 8.9448446840612292E+08 rho[g/cm^3] = 1.6585817351580659E+05 + P[dyn/cm^2] = 8.7371150320499226E+21 L[erg/s] = 3.9705227734938969E+39 + r[cm] = 1.0818528002666345E+09 Hp[cm] = 4.1262096121030027E+08 + gradL = 2.7977735453489061E-01 gradr = 6.5970726825239474E+00 grada = 2.7977735453489061E-01 + conv_vel_start[cm/s] = 5.0383392852019933E+04 gradT_start = 2.8060983127196415E-01 L_conv_start/L = 9.5746449299924841E-01 + Interpretation: 12 Msun pre-core-collapse model at core-carbon depletion; a hot convective carbon-burning zone taken directly from the saved model. + +Convection model: tdc + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744393250170E-01 8.9397611087579920E-08 5.0383392852019933E+04 5.2121418074864210E+04 8.6482708264866570E-01 9.5759066825599037E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744154258327E-01 8.7007692642466247E-08 5.2121418074864210E+04 5.3553083901440143E+04 8.8858206526151517E-01 9.5759066861825992E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977743966686153E-01 8.5131970906460151E-08 5.3553083901440143E+04 5.4733024690056111E+04 9.0816028833386531E-01 9.5759066890258626E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743818030582E-01 8.3645415219367943E-08 5.4733024690056111E+04 5.5705746147751015E+04 9.2430021490454561E-01 9.5759066912792190E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743699319907E-01 8.2458308462769200E-08 5.5705746147751015E+04 5.6507711040586320E+04 9.3760685513565400E-01 9.5759066930786640E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743603953487E-01 8.1504644270383458E-08 5.6507711040586320E+04 5.7168892765873708E+04 9.4857754403286687E-01 9.5759066945242499E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743526975762E-01 8.0734867018686773E-08 5.7168892765873708E+04 5.7713977130908381E+04 9.5762188201563703E-01 9.5759066956910988E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743464604299E-01 8.0111152384924902E-08 5.7713977130908381E+04 5.8163315974492507E+04 9.6507755792720606E-01 9.5759066966365392E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743413912803E-01 7.9604237436080674E-08 5.8163315974492507E+04 5.8533696442506945E+04 9.7122311327573652E-01 9.5759066974049312E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743372612102E-01 7.9191230398618388E-08 5.8533696442506945E+04 5.8838967982603062E+04 9.7628834567324707E-01 9.5759066980309782E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743338895023E-01 7.8854059604312865E-08 5.8838967982603062E+04 5.9090556574501214E+04 9.8046284122604344E-01 9.5759066985420704E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743311324182E-01 7.8578351207862593E-08 5.9090556574501214E+04 5.9297888015708093E+04 9.8390299792290736E-01 9.5759066989599950E-01 + tau_phys[s] 1.3692865440101397E+04 + conv_vel_eq[cm/s] 6.0268022499057690E+04 + +Convection model: tdc_with_Af_split + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .true. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744393250170E-01 8.9397611087579920E-08 5.0383392852019933E+04 5.2121418074864210E+04 8.6482708264866570E-01 9.5759066825599037E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744154258327E-01 8.7007692642466247E-08 5.2121418074864210E+04 5.3553083901440143E+04 8.8858206526151517E-01 9.5759066861825992E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977743966686153E-01 8.5131970906460151E-08 5.3553083901440143E+04 5.4733024690056111E+04 9.0816028833386531E-01 9.5759066890258626E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743818030582E-01 8.3645415219367943E-08 5.4733024690056111E+04 5.5705746147751015E+04 9.2430021490454561E-01 9.5759066912792190E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743699319907E-01 8.2458308462769200E-08 5.5705746147751015E+04 5.6507711040586320E+04 9.3760685513565400E-01 9.5759066930786640E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743603953487E-01 8.1504644270383458E-08 5.6507711040586320E+04 5.7168892765873708E+04 9.4857754403286687E-01 9.5759066945242499E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743526975762E-01 8.0734867018686773E-08 5.7168892765873708E+04 5.7713977130908381E+04 9.5762188201563703E-01 9.5759066956910988E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743464604299E-01 8.0111152384924902E-08 5.7713977130908381E+04 5.8163315974492507E+04 9.6507755792720606E-01 9.5759066966365392E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743413912803E-01 7.9604237436080674E-08 5.8163315974492507E+04 5.8533696442506945E+04 9.7122311327573652E-01 9.5759066974049312E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743372612102E-01 7.9191230398618388E-08 5.8533696442506945E+04 5.8838967982603062E+04 9.7628834567324707E-01 9.5759066980309782E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743338895023E-01 7.8854059604312865E-08 5.8838967982603062E+04 5.9090556574501214E+04 9.8046284122604344E-01 9.5759066985420704E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743311324182E-01 7.8578351207862593E-08 5.9090556574501214E+04 5.9297888015708093E+04 9.8390299792290736E-01 9.5759066989599950E-01 + tau_phys[s] 1.3692865440101397E+04 + conv_vel_eq[cm/s] 6.0268022499057690E+04 + +Convection model: tdc_with_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744393250414E-01 8.9397613549264659E-08 5.0383392852019933E+04 5.2121418074864210E+04 8.6482708264866626E-01 9.5759066825599004E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744154258566E-01 8.7007695038341343E-08 5.2121418074864210E+04 5.3553083901440143E+04 8.8858206526151562E-01 9.5759066861825948E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977743966686386E-01 8.5131973250684700E-08 5.3553083901440143E+04 5.4733024690056103E+04 9.0816028833386564E-01 9.5759066890258582E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743818030815E-01 8.3645417522658156E-08 5.4733024690056103E+04 5.5705746147751001E+04 9.2430021490454595E-01 9.5759066912792157E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743699320134E-01 8.2458310733371101E-08 5.5705746147751001E+04 5.6507711040586320E+04 9.3760685513565456E-01 9.5759066930786618E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743603953714E-01 8.1504646514724638E-08 5.6507711040586320E+04 5.7168892765873701E+04 9.4857754403286731E-01 9.5759066945242477E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743526975984E-01 8.0734869241831377E-08 5.7168892765873701E+04 5.7713977130908395E+04 9.5762188201563780E-01 9.5759066956910943E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743464604521E-01 8.0111154590894669E-08 5.7713977130908395E+04 5.8163315974492529E+04 9.6507755792720706E-01 9.5759066966365369E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743413913025E-01 7.9604239628091563E-08 5.8163315974492529E+04 5.8533696442506960E+04 9.7122311327573740E-01 9.5759066974049289E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743372612318E-01 7.9191232579256562E-08 5.8533696442506960E+04 5.8838967982603062E+04 9.7628834567324763E-01 9.5759066980309748E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743338895239E-01 7.8854061775666592E-08 5.8838967982603062E+04 5.9090556574501214E+04 9.8046284122604399E-01 9.5759066985420671E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743311324399E-01 7.8578353371624311E-08 5.9090556574501214E+04 5.9297888015708078E+04 9.8390299792290770E-01 9.5759066989599928E-01 + tau_phys[s] 1.3692865440101406E+04 + conv_vel_eq[cm/s] 6.0268022499057653E+04 + +Convection model: tdc_with_arnett_closure + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356745E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744520385489E-01 9.0668964263554147E-08 5.0383392852019933E+04 5.1390577002891834E+04 8.5270056776287106E-01 9.5759066806327564E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744362425339E-01 8.9089362790023356E-08 5.1390577002891834E+04 5.2301759098960865E+04 8.6781939957925058E-01 9.5759066830271533E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744224406487E-01 8.7709174238387871E-08 5.2301759098960865E+04 5.3124777794366411E+04 8.8147537602046233E-01 9.5759066851192776E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977744103538243E-01 8.6500491832886817E-08 5.3124777794366411E+04 5.3867097100848223E+04 8.9379234405261265E-01 9.5759066869514264E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743997479193E-01 8.5439901298144772E-08 5.3867097100848223E+04 5.4535765173182728E+04 9.0488725051557095E-01 9.5759066885590949E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743904252494E-01 8.4507634317939072E-08 5.4535765173182728E+04 5.5137390034761258E+04 9.1486973934848292E-01 9.5759066899722467E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743822179751E-01 8.3686906889868532E-08 5.5137390034761258E+04 5.5678128969929494E+04 9.2384197558166425E-01 9.5759066912163249E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743749828748E-01 8.2963396894463927E-08 5.5678128969929494E+04 5.6163688685138841E+04 9.3189864801051225E-01 9.5759066923130387E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743685971829E-01 8.2324827671967184E-08 5.6163688685138841E+04 5.6599333732951032E+04 9.3912710897119844E-01 9.5759066932809978E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743629552376E-01 8.1760633170864908E-08 5.6599333732951032E+04 5.6989901076132992E+04 9.4560761599609822E-01 9.5759066941362170E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743579657710E-01 8.1261686481527235E-08 5.6989901076132992E+04 5.7339819027223064E+04 9.5141364606943513E-01 9.5759066948925309E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743535496868E-01 8.0820078075982598E-08 5.7339819027223064E+04 5.7653129122727834E+04 9.5661225857592092E-01 9.5759066955619321E-01 + tau_phys[s] 1.3692865440101436E+04 + conv_vel_eq[cm/s] 6.0268022499057523E+04 + +Convection model: tdc_with_arnett_closure_tdc_ss + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_no_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744426707885E-01 8.9732188207931824E-08 5.0383392852019933E+04 5.1927077174868406E+04 8.6160247211828300E-01 9.5759066820527439E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744207525823E-01 8.7540367644418904E-08 5.1927077174868406E+04 5.3227218358122140E+04 8.8317512589623071E-01 9.5759066853751584E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744030900475E-01 8.5774114117380993E-08 5.3227218358122140E+04 5.4323268890729865E+04 9.0136139594723264E-01 9.5759066880524868E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743887354872E-01 8.4338658097761514E-08 5.4323268890729865E+04 5.5247858706982588E+04 9.1670269599183229E-01 9.5759066902283851E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743769897684E-01 8.3164086240160149E-08 5.5247858706982588E+04 5.6028154431140800E+04 9.2964978952174548E-01 9.5759066920088287E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743673258043E-01 8.2197689805054950E-08 5.6028154431140800E+04 5.6686876221858103E+04 9.4057966183882047E-01 9.5759066934737169E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743593389864E-01 8.1399008017221890E-08 5.6686876221858103E+04 5.7243084182376369E+04 9.4980856860321550E-01 9.5759066946843774E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743527140164E-01 8.0736511052647707E-08 5.7243084182376369E+04 5.7712801903750500E+04 9.5760238200370451E-01 9.5759066956886052E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743472020744E-01 8.0185316803658979E-08 5.7712801903750500E+04 5.8109519983545382E+04 9.6418494541535593E-01 9.5759066965241202E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743426047058E-01 7.9725579962603688E-08 5.8109519983545382E+04 5.8444608013075558E+04 9.6974490931719814E-01 9.5759066972209994E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743387622106E-01 7.9341330442321321E-08 5.8444608013075558E+04 5.8727654853248649E+04 9.7444137733516767E-01 9.5759066978034535E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743355451007E-01 7.9019619479967841E-08 5.8727654853248649E+04 5.8966751557618190E+04 9.7840860065617974E-01 9.5759066982911101E-01 + tau_phys[s] 1.3692865440101397E+04 + conv_vel_eq[cm/s] 6.0268022499057690E+04 + +Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr + include_mlt_corr_to_tdc = .true. + use_TDC_arnett_velocity_closure = .true. + use_TDC_acceleration_limit = .false. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = tdc_with_mlt_corr + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744426708129E-01 8.9732190678829608E-08 5.0383392852019933E+04 5.1927077174868406E+04 8.6160247211828356E-01 9.5759066820527394E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744207526067E-01 8.7540370054961924E-08 5.1927077174868406E+04 5.3227218358122140E+04 8.8317512589623126E-01 9.5759066853751540E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744030900709E-01 8.5774116479288135E-08 5.3227218358122140E+04 5.4323268890729880E+04 9.0136139594723341E-01 9.5759066880524835E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743887355105E-01 8.4338660420141414E-08 5.4323268890729880E+04 5.5247858706982610E+04 9.1670269599183318E-01 9.5759066902283818E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743769897911E-01 8.3164088530196320E-08 5.5247858706982610E+04 5.6028154431140822E+04 9.2964978952174637E-01 9.5759066920088254E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743673258265E-01 8.2197692068480073E-08 5.6028154431140822E+04 5.6686876221858118E+04 9.4057966183882125E-01 9.5759066934737114E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743593390086E-01 8.1399010258654226E-08 5.6686876221858118E+04 5.7243084182376377E+04 9.4980856860321616E-01 9.5759066946843718E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743527140386E-01 8.0736513275837296E-08 5.7243084182376377E+04 5.7712801903750507E+04 9.5760238200370518E-01 9.5759066956886019E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743472020961E-01 8.0185319011670677E-08 5.7712801903750507E+04 5.8109519983545397E+04 9.6418494541535671E-01 9.5759066965241146E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743426047275E-01 7.9725582157955909E-08 5.8109519983545397E+04 5.8444608013075565E+04 9.6974490931719892E-01 9.5759066972209961E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743387622322E-01 7.9341332627092990E-08 5.8444608013075565E+04 5.8727654853248656E+04 9.7444137733516833E-01 9.5759066978034502E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743355451229E-01 7.9019621655880471E-08 5.8727654853248656E+04 5.8966751557618198E+04 9.7840860065618040E-01 9.5759066982911067E-01 + tau_phys[s] 1.3692865440101406E+04 + conv_vel_eq[cm/s] 6.0268022499057653E+04 + +Convection model: tdc_with_acceleration_limit + include_mlt_corr_to_tdc = .false. + use_TDC_arnett_velocity_closure = .false. + use_TDC_acceleration_limit = .true. + use_TDC_Af_split = .false. + TDC_arnett_growth_target = mlt + step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L + 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 + 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744429205098E-01 8.9757160379176415E-08 5.0383392852019933E+04 5.1912630061385767E+04 8.6136275770782822E-01 9.5759066820148897E-01 + 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744211459010E-01 8.7579699506788919E-08 5.1912630061385767E+04 5.3203314123834403E+04 8.8277849376369122E-01 9.5759066853155372E-01 + 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744035601065E-01 8.5821120051982845E-08 5.3203314123834403E+04 5.4293514955356935E+04 9.0086770237410452E-01 9.5759066879812349E-01 + 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743892395596E-01 8.4389065321904641E-08 5.4293514955356935E+04 5.5214858089850313E+04 9.1615513169879792E-01 9.5759066901519774E-01 + 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743775004338E-01 8.3215152783814713E-08 5.5214858089850313E+04 5.5993771699908561E+04 9.2907929243545428E-01 9.5759066919314217E-01 + 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743678256012E-01 8.2247669492817401E-08 5.5993771699908561E+04 5.6652429137465610E+04 9.4000809696968879E-01 9.5759066933979553E-01 + 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743598170535E-01 8.1446814735415659E-08 5.6652429137465610E+04 5.7209484292184556E+04 9.4925106084373423E-01 9.5759066946119098E-01 + 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743531639254E-01 8.0781501953059110E-08 5.7209484292184556E+04 5.7680659013403005E+04 9.5706904958271799E-01 9.5759066956204064E-01 + 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743476203953E-01 8.0227148896885881E-08 5.7680659013403005E+04 5.8079220478626514E+04 9.6368219945385802E-01 9.5759066964607087E-01 + 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743429900392E-01 7.9764113337606552E-08 5.8079220478626514E+04 5.8416373912082607E+04 9.6927643366755500E-01 9.5759066971625895E-01 + 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743391145249E-01 7.9376561880575233E-08 5.8416373912082607E+04 5.8701588471312651E+04 9.7400886966600686E-01 9.5759066977500484E-01 + 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743358652696E-01 7.9051636338452517E-08 5.8701588471312651E+04 5.8942869317359953E+04 9.7801233346061001E-01 9.5759066982425800E-01 + tau_phys[s] 1.3692865440101397E+04 + conv_vel_eq[cm/s] 6.0268022499057690E+04 From eccc100dda964002ad0b4d4f2155bd1862aa9686 Mon Sep 17 00:00:00 2001 From: Ebraheem Farag <63124736+Debraheem@users.noreply.github.com> Date: Sat, 11 Apr 2026 11:50:47 -0400 Subject: [PATCH 02/12] refactor, add debugging and report info, clean up mlt_TDC_face_support --- star/private/mlt_tdc_face_support.f90 | 177 ++++++++++++++++++++------ 1 file changed, 139 insertions(+), 38 deletions(-) diff --git a/star/private/mlt_tdc_face_support.f90 b/star/private/mlt_tdc_face_support.f90 index 2dea8b1b4..cea538acc 100644 --- a/star/private/mlt_tdc_face_support.f90 +++ b/star/private/mlt_tdc_face_support.f90 @@ -70,6 +70,8 @@ subroutine get_mlt_face_state_ad( & end if end subroutine get_mlt_face_state_ad + ! Reconstructs the face composition from either the current or the + ! start-of-step composition and renormalizes xa_face. subroutine get_face_composition(s, k, use_starting_comp, zbar_face, xa_face, ierr) use star_utils, only: get_face_weights @@ -103,12 +105,19 @@ subroutine get_face_composition(s, k, use_starting_comp, zbar_face, xa_face, ier sum_xa = sum(xa_face) if (sum_xa <= 0d0) then ierr = -1 + if (s%report_ierr) then + !$OMP critical (mlt_tdc_face_report_ierr) + write(*,*) 'get_face_composition: sum_xa <= 0 for k', k + !$OMP end critical (mlt_tdc_face_report_ierr) + end if return end if xa_face = xa_face/sum_xa end subroutine get_face_composition + ! Builds the recomputed face EOS input state by wrapping T and rho to the + ! face, reconstructing the face composition, and evaluating the EOS there. subroutine get_face_eos_inputs( & s, k, T_face, rho_face, eos_res, d_dlnd, d_dlnT, ierr) use eos_support, only: get_eos @@ -130,6 +139,11 @@ subroutine get_face_eos_inputs( & rho_face = get_rho_face(s, k) if (T_face%val <= 0d0 .or. rho_face%val <= 0d0) then ierr = -1 + if (s%report_ierr) then + !$OMP critical (mlt_tdc_face_report_ierr) + write(*,*) 'get_face_eos_inputs: bad face T or rho for k', k, T_face%val, rho_face%val + !$OMP end critical (mlt_tdc_face_report_ierr) + end if return end if @@ -142,10 +156,15 @@ subroutine get_face_eos_inputs( & call get_eos( & s, k, eos_xa_face, rho_face%val, log10_rho, T_face%val, log10_T, & eos_res, d_dlnd, d_dlnT, d_dxa, ierr) - if (ierr /= 0) return + if (ierr /= 0) then + if (s%report_ierr) call write_face_eos_call_info(s, k, T_face, rho_face, zbar_face, eos_xa_face) + return + end if end subroutine get_face_eos_inputs + ! Interpolates extra_opacity_factor to the face and applies the existing + ! logT taper used to turn that factor on and off. subroutine get_face_opacity_factor(s, k, log10_T, opacity_factor_face) use star_utils, only: get_face_weights @@ -182,34 +201,6 @@ subroutine get_face_opacity_factor(s, k, log10_T, opacity_factor_face) end subroutine get_face_opacity_factor - subroutine set_face_ad_from_value(value, dvalue_dlnd, dvalue_dlnT, T_face, rho_face, quantity_ad) - type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face - real(dp), intent(in) :: value, dvalue_dlnd, dvalue_dlnT - type(auto_diff_real_star_order1), intent(out) :: quantity_ad - type(auto_diff_real_star_order1) :: lnT_face, lnd_face - integer :: j - - lnd_face = log(rho_face) - lnT_face = log(T_face) - quantity_ad = 0d0 - quantity_ad%val = value - do j = 1, size(quantity_ad%d1Array) - quantity_ad%d1Array(j) = dvalue_dlnd*lnd_face%d1Array(j) + dvalue_dlnT*lnT_face%d1Array(j) - end do - end subroutine set_face_ad_from_value - - - subroutine set_face_ad_from_log(log_value, dlog_dlnd, dlog_dlnT, T_face, rho_face, quantity_ad) - type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face - real(dp), intent(in) :: log_value, dlog_dlnd, dlog_dlnT - type(auto_diff_real_star_order1), intent(out) :: quantity_ad - real(dp) :: value - - value = exp(log_value) - call set_face_ad_from_value(value, value*dlog_dlnd, value*dlog_dlnT, T_face, rho_face, quantity_ad) - end subroutine set_face_ad_from_log - - ! Recomputes the face EOS and opacity state as ! auto_diff_real_star_order1 quantities for the MLT/TDC solve, ! instead of using the stored face quantities. @@ -225,6 +216,7 @@ subroutine get_face_eos_kap_ad( & real(dp) :: log10_T, log10_rho, kap_zbar_face, opacity_factor_face real(dp) :: eos_res(num_eos_basic_results), d_dlnd(num_eos_basic_results), d_dlnT(num_eos_basic_results) + real(dp) :: dlnT_face(auto_diff_star_num_vars), dlnd_face(auto_diff_star_num_vars) real(dp) :: kap, dlnkap_dlnd, dlnkap_dlnT real(dp) :: kap_fracs(num_kap_fracs), kap_xa_face(s%species) type(auto_diff_real_star_order1) :: Pgas_face, gamma1_face, mlt_Pturb_ad, alpha @@ -235,14 +227,15 @@ subroutine get_face_eos_kap_ad( & if (ierr /= 0) return log10_T = log10(T_face%val) log10_rho = log10(rho_face%val) + call set_face_log_partials(T_face, rho_face, dlnT_face, dlnd_face) - call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), T_face, rho_face, Pgas_face) + call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), dlnd_face, dlnT_face, Pgas_face) P_face = Pgas_face + crad*pow4(T_face)/3d0 - call set_face_ad_from_value(eos_res(i_Cp), d_dlnd(i_Cp), d_dlnT(i_Cp), T_face, rho_face, Cp_face) - call set_face_ad_from_value(eos_res(i_chiRho), d_dlnd(i_chiRho), d_dlnT(i_chiRho), T_face, rho_face, ChiRho_face) - call set_face_ad_from_value(eos_res(i_chiT), d_dlnd(i_chiT), d_dlnT(i_chiT), T_face, rho_face, ChiT_face) - call set_face_ad_from_value(eos_res(i_grad_ad), d_dlnd(i_grad_ad), d_dlnT(i_grad_ad), T_face, rho_face, grada_face) - call set_face_ad_from_value(eos_res(i_gamma1), d_dlnd(i_gamma1), d_dlnT(i_gamma1), T_face, rho_face, gamma1_face) + call set_face_ad_from_value(eos_res(i_Cp), d_dlnd(i_Cp), d_dlnT(i_Cp), dlnd_face, dlnT_face, Cp_face) + call set_face_ad_from_value(eos_res(i_chiRho), d_dlnd(i_chiRho), d_dlnT(i_chiRho), dlnd_face, dlnT_face, ChiRho_face) + call set_face_ad_from_value(eos_res(i_chiT), d_dlnd(i_chiT), d_dlnT(i_chiT), dlnd_face, dlnT_face, ChiT_face) + call set_face_ad_from_value(eos_res(i_grad_ad), d_dlnd(i_grad_ad), d_dlnT(i_grad_ad), dlnd_face, dlnT_face, grada_face) + call set_face_ad_from_value(eos_res(i_gamma1), d_dlnd(i_gamma1), d_dlnT(i_gamma1), dlnd_face, dlnT_face, gamma1_face) call get_face_composition(s, k, s% use_starting_composition_for_kap, kap_zbar_face, kap_xa_face, ierr) if (ierr /= 0) return @@ -253,7 +246,21 @@ subroutine get_face_eos_kap_ad( & eos_res(i_lnfree_e), d_dlnd(i_lnfree_e), d_dlnT(i_lnfree_e), & eos_res(i_eta), d_dlnd(i_eta), d_dlnT(i_eta), & kap_fracs, kap, dlnkap_dlnd, dlnkap_dlnT, ierr) - if (ierr /= 0 .or. is_bad_num(kap) .or. kap <= 0d0) return + if (ierr /= 0) then + if (s%report_ierr) call write_face_kap_call_info( & + s, k, T_face, rho_face, kap_zbar_face, kap_xa_face, opacity_factor_face) + return + end if + if (is_bad_num(kap) .or. kap <= 0d0) then + ierr = -1 + if (s%report_ierr) then + !$OMP critical (mlt_tdc_face_report_ierr) + write(*,*) 'get_face_eos_kap_ad: bad face opacity for k', k, kap + !$OMP end critical (mlt_tdc_face_report_ierr) + call write_face_kap_call_info(s, k, T_face, rho_face, kap_zbar_face, kap_xa_face, opacity_factor_face) + end if + return + end if kap = kap*opacity_factor_face if (s%opacity_max > 0d0 .and. kap > s%opacity_max) then @@ -266,7 +273,7 @@ subroutine get_face_eos_kap_ad( & dlnkap_dlnd = 0d0 dlnkap_dlnT = 0d0 end if - call set_face_ad_from_value(kap, kap*dlnkap_dlnd, kap*dlnkap_dlnT, T_face, rho_face, opacity_face) + call set_face_ad_from_value(kap, kap*dlnkap_dlnd, kap*dlnkap_dlnT, dlnd_face, dlnT_face, opacity_face) if (s% have_mlt_vc .and. s% okay_to_set_mlt_vc .and. s% include_mlt_Pturb_in_thermodynamic_gradients & .and. s% mlt_Pturb_factor > 0d0 .and. k > 1) then @@ -288,14 +295,16 @@ subroutine get_face_scale_height_ad(s, k, scale_height_face, ierr) integer, intent(out) :: ierr real(dp) :: eos_res(num_eos_basic_results), d_dlnd(num_eos_basic_results), d_dlnT(num_eos_basic_results) + real(dp) :: dlnT_face(auto_diff_star_num_vars), dlnd_face(auto_diff_star_num_vars) type(auto_diff_real_star_order1) :: T_face, rho_face, Pgas_face, P_face ierr = 0 call get_face_eos_inputs( & s, k, T_face, rho_face, eos_res, d_dlnd, d_dlnT, ierr) if (ierr /= 0) return + call set_face_log_partials(T_face, rho_face, dlnT_face, dlnd_face) - call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), T_face, rho_face, Pgas_face) + call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), dlnd_face, dlnT_face, Pgas_face) P_face = Pgas_face + crad*pow4(T_face)/3d0 call set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) @@ -351,4 +360,96 @@ subroutine set_gradr_from_face_state(s, k, P_face, opacity_face, T_face, gradr_f gradr_face = P_face*opacity_face*L_face/(4d0*pi4*clight*s%m_grav(k)*s%cgrav(k)*Pr_face) end subroutine set_gradr_from_face_state + ! Precomputes dlnT_face and dlnd_face for converting scalar d/dlnT and + ! d/dlnd microphysics partials into star-order1 autodiff derivatives. + subroutine set_face_log_partials(T_face, rho_face, dlnT_face, dlnd_face) + type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face + real(dp), intent(out) :: dlnT_face(auto_diff_star_num_vars), dlnd_face(auto_diff_star_num_vars) + + dlnT_face = T_face%d1Array/T_face%val + dlnd_face = rho_face%d1Array/rho_face%val + end subroutine set_face_log_partials + + + ! Converts a scalar value with d/dlnd and d/dlnT partials into an + ! auto_diff_real_star_order1 quantity using the face chain rule. + subroutine set_face_ad_from_value(value, dvalue_dlnd, dvalue_dlnT, dlnd_face, dlnT_face, quantity_ad) + real(dp), intent(in) :: value, dvalue_dlnd, dvalue_dlnT + real(dp), intent(in) :: dlnd_face(auto_diff_star_num_vars), dlnT_face(auto_diff_star_num_vars) + type(auto_diff_real_star_order1), intent(out) :: quantity_ad + + quantity_ad = 0d0 + quantity_ad%val = value + quantity_ad%d1Array = dvalue_dlnd*dlnd_face + dvalue_dlnT*dlnT_face + end subroutine set_face_ad_from_value + + + ! Same as set_face_ad_from_value, but for a quantity returned in + ! logarithmic form by the microphysics routine. + subroutine set_face_ad_from_log(log_value, dlog_dlnd, dlog_dlnT, dlnd_face, dlnT_face, quantity_ad) + real(dp), intent(in) :: log_value, dlog_dlnd, dlog_dlnT + real(dp), intent(in) :: dlnd_face(auto_diff_star_num_vars), dlnT_face(auto_diff_star_num_vars) + type(auto_diff_real_star_order1), intent(out) :: quantity_ad + real(dp) :: value + + value = exp(log_value) + call set_face_ad_from_value(value, value*dlog_dlnd, value*dlog_dlnT, dlnd_face, dlnT_face, quantity_ad) + end subroutine set_face_ad_from_log + + + ! Writes the recomputed face EOS inputs that were passed to get_eos. + subroutine write_face_eos_call_info(s, k, T_face, rho_face, zbar_face, xa_face) + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face + real(dp), intent(in) :: zbar_face + real(dp), intent(in) :: xa_face(:) + + integer :: j + include 'formats' + + !$OMP critical (mlt_tdc_face_eos_call_info) + write(*,'(A)') + write(*,*) 'face EOS input info for k', k + write(*,1) 'T_face', T_face%val + write(*,1) 'rho_face', rho_face%val + write(*,1) 'log10_T_face', log10(T_face%val) + write(*,1) 'log10_rho_face', log10(rho_face%val) + write(*,1) 'zbar_face', zbar_face + write(*,1) 'sum(xa_face)', sum(xa_face) + do j = 1, s%species + write(*,2) 'xa_face ' // trim(s%nameofequ(j+s%nvar_hydro)), j, xa_face(j) + end do + !$OMP end critical (mlt_tdc_face_eos_call_info) + end subroutine write_face_eos_call_info + + + ! Writes the recomputed face opacity inputs that were passed to get_kap. + subroutine write_face_kap_call_info(s, k, T_face, rho_face, zbar_face, xa_face, opacity_factor_face) + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(in) :: T_face, rho_face + real(dp), intent(in) :: zbar_face + real(dp), intent(in) :: xa_face(:) + real(dp), intent(in) :: opacity_factor_face + + integer :: j + include 'formats' + + !$OMP critical (mlt_tdc_face_kap_call_info) + write(*,'(A)') + write(*,*) 'face opacity input info for k', k + write(*,1) 'T_face', T_face%val + write(*,1) 'rho_face', rho_face%val + write(*,1) 'log10_T_face', log10(T_face%val) + write(*,1) 'log10_rho_face', log10(rho_face%val) + write(*,1) 'zbar_face', zbar_face + write(*,1) 'opacity_factor_face', opacity_factor_face + write(*,1) 'sum(xa_face)', sum(xa_face) + do j = 1, s%species + write(*,2) 'xa_face ' // trim(s%nameofequ(j+s%nvar_hydro)), j, xa_face(j) + end do + !$OMP end critical (mlt_tdc_face_kap_call_info) + end subroutine write_face_kap_call_info + end module mlt_tdc_face_support From 861279f6e88cd4bba96d7980023686042023757d Mon Sep 17 00:00:00 2001 From: Ebraheem Farag <63124736+Debraheem@users.noreply.github.com> Date: Sat, 11 Apr 2026 12:34:46 -0400 Subject: [PATCH 03/12] [ci skip] docs clean up --- star/defaults/controls_dev.defaults | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index bce06b878..2f61022c3 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -281,15 +281,16 @@ ! use_face_values_eos_and_kap_mlt_tdc ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ! If use_face_values_eos_and_kap_mlt_tdc = .true., evaluate the current - ! MLT/TDC thermodynamic bundle from a face-centered state. Face T and rho - ! are still built by wrapping the cell-centered primitives to the face, - ! but then a single EOS call at that face state is used to obtain P, Cp, - ! chiRho, chiT, grad_ad, lnfree_e, eta, and opacity. Those face-EOS - ! quantities are then used directly in the local gradr seen by MLT/TDC. - ! Wrapped rho and wrapped specific energy are still used in the MLT/TDC - ! call, so this is a local thermodynamic-bundle change, not a full - ! face-state reformulation of the whole star solve. + ! MESA interpolates primitive solver variables such as T, rho, L, and + ! composition, together with constructed quantities such as opacity, + ! pressure, and other EOS results, onto cell faces for use in MLT and + ! TDC. If use_face_values_eos_and_kap_mlt_tdc = .true., this option + ! instead reconstructs only the primitive face variables and then makes + ! additional EOS and opacity calls to obtain the thermodynamic quantities + ! corresponding to that face state. Despite the cost of the extra EOS and + ! opacity work, this can improve accuracy on coarse meshes, especially in + ! unresolved opacity bumps in pulsating envelopes, and is a potential + ! candidate for becoming the default mode, pending further testing. ! :: From 79d80ba8ce2e0cffc0fb1d1d4b098ce76492282e Mon Sep 17 00:00:00 2001 From: Ebraheem Farag <63124736+Debraheem@users.noreply.github.com> Date: Sun, 12 Apr 2026 10:51:06 -0400 Subject: [PATCH 04/12] enhanced dissipation and mlt refactor face properties --- star/defaults/controls_dev.defaults | 40 ++ star/defaults/profile_columns.list | 14 + .../dev_TDC_Cepheid_9M/inlist_pulses | 2 +- star/private/alloc.f90 | 30 ++ star/private/conv_premix.f90 | 7 + star/private/ctrls_io.f90 | 7 + star/private/hydro_temperature.f90 | 95 +++-- star/private/hydro_vars.f90 | 2 + star/private/mlt_tdc_face_support.f90 | 104 +++-- star/private/phase_separation.f90 | 7 + star/private/profile_getval.f90 | 30 +- star/private/star_profile_def.f90 | 29 +- star/private/struct_burn_mix.f90 | 15 + star/private/tdc_hydro.f90 | 386 ++++++++++-------- star/private/turb_info.f90 | 3 +- star/private/turb_support.f90 | 14 +- star_data/private/star_controls_dev.inc | 3 + star_data/public/star_data_step_work.inc | 9 + turb/private/tdc_support.f90 | 62 ++- turb/public/turb.f90 | 14 + 20 files changed, 642 insertions(+), 231 deletions(-) diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 2f61022c3..3cc21e254 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -261,6 +261,46 @@ use_TDC_Af_split = .false. + ! use_TDC_enhanced_dissipation + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! If use_TDC_enhanced_dissipation = .true., replace the baseline Kuhfuss + ! local-TDC dissipation length in the xi2 damping term by a reduced + ! dissipation length following the Ahlborn/Kupka harmonic-sum correction. + ! + ! This change applies only to the Kuhfuss local-TDC closure. It does not + ! modify the optional Arnett velocity closure. + + ! :: + + use_TDC_enhanced_dissipation = .false. + + + ! TDC_enhanced_dissipation_c4 + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! Effective stable-side dissipation-length coefficient c4 used in the + ! Ahlborn/Kupka reduction factor for the Kuhfuss local-TDC dissipation + ! length. Larger values give a shorter dissipation length in stable + ! regions and therefore stronger damping. + + ! :: + + TDC_enhanced_dissipation_c4 = 0.072d0 + + + ! TDC_enhanced_dissipation_v_floor + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! Speed floor in cm s^-1 used together with the lagged start-of-step + ! convective speed when evaluating the Ahlborn/Kupka stable-side + ! dissipation-length correction for local TDC. + + ! :: + + TDC_enhanced_dissipation_v_floor = 1d0 + + ! use_conservative_L_remesh ! ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/star/defaults/profile_columns.list b/star/defaults/profile_columns.list index 2bf7338c2..6de3e6c83 100644 --- a/star/defaults/profile_columns.list +++ b/star/defaults/profile_columns.list @@ -740,6 +740,20 @@ !Uq !Y_face + !mlt_tdc_T_face + !mlt_tdc_rho_face + !mlt_tdc_P_face + !mlt_tdc_Cp_face + !mlt_tdc_ChiRho_face + !mlt_tdc_ChiT_face + !mlt_tdc_grada_face + !mlt_tdc_opacity_face + !mlt_tdc_scale_height_face + !mlt_tdc_gradr_face + !tdc_Chi_div_w_face + !tdc_Eq_div_w_face + !tdc_Chi_div_w_cell + !# RTI !RTI_du_diffusion_kick diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses index e2b38cf9e..28bd13e75 100644 --- a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/inlist_pulses @@ -90,7 +90,7 @@ Zbase = 0.004d0 ! limit max model number as part of test suite. - !max_model_number = 3000 + max_model_number = 2000 !3000 ! controls for analyzing pulsations using GYRE in MESA x_integer_ctrl(1) = 1000 ! gyre interval to check diff --git a/star/private/alloc.f90 b/star/private/alloc.f90 index 675345b21..d4215a654 100644 --- a/star/private/alloc.f90 +++ b/star/private/alloc.f90 @@ -1086,6 +1086,28 @@ subroutine star_info_arrays(s, c_in, action_in, ierr) if (failed('mlt_D_ad')) exit call do1_ad(s% mlt_Gamma_ad, c% mlt_Gamma_ad) if (failed('mlt_Gamma_ad')) exit + call do1_logical(s% have_mlt_tdc_face_state, c% have_mlt_tdc_face_state) + if (failed('have_mlt_tdc_face_state')) exit + call do1_ad(s% mlt_tdc_T_face_ad, c% mlt_tdc_T_face_ad) + if (failed('mlt_tdc_T_face_ad')) exit + call do1_ad(s% mlt_tdc_rho_face_ad, c% mlt_tdc_rho_face_ad) + if (failed('mlt_tdc_rho_face_ad')) exit + call do1_ad(s% mlt_tdc_P_face_ad, c% mlt_tdc_P_face_ad) + if (failed('mlt_tdc_P_face_ad')) exit + call do1_ad(s% mlt_tdc_Cp_face_ad, c% mlt_tdc_Cp_face_ad) + if (failed('mlt_tdc_Cp_face_ad')) exit + call do1_ad(s% mlt_tdc_ChiRho_face_ad, c% mlt_tdc_ChiRho_face_ad) + if (failed('mlt_tdc_ChiRho_face_ad')) exit + call do1_ad(s% mlt_tdc_ChiT_face_ad, c% mlt_tdc_ChiT_face_ad) + if (failed('mlt_tdc_ChiT_face_ad')) exit + call do1_ad(s% mlt_tdc_grada_face_ad, c% mlt_tdc_grada_face_ad) + if (failed('mlt_tdc_grada_face_ad')) exit + call do1_ad(s% mlt_tdc_opacity_face_ad, c% mlt_tdc_opacity_face_ad) + if (failed('mlt_tdc_opacity_face_ad')) exit + call do1_ad(s% mlt_tdc_scale_height_face_ad, c% mlt_tdc_scale_height_face_ad) + if (failed('mlt_tdc_scale_height_face_ad')) exit + call do1_ad(s% mlt_tdc_gradr_face_ad, c% mlt_tdc_gradr_face_ad) + if (failed('mlt_tdc_gradr_face_ad')) exit call do1_ad(s% PII_ad, c% PII_ad) if (failed('PII_ad')) exit @@ -1093,6 +1115,12 @@ subroutine star_info_arrays(s, c_in, action_in, ierr) if (failed('Chi_ad')) exit call do1_ad(s% Eq_ad, c% Eq_ad) if (failed('Eq_ad')) exit + call do1_ad(s% tdc_Chi_div_w_face_ad, c% tdc_Chi_div_w_face_ad) + if (failed('tdc_Chi_div_w_face_ad')) exit + call do1_ad(s% tdc_Eq_div_w_face_ad, c% tdc_Eq_div_w_face_ad) + if (failed('tdc_Eq_div_w_face_ad')) exit + call do1_ad(s% tdc_Chi_div_w_cell_ad, c% tdc_Chi_div_w_cell_ad) + if (failed('tdc_Chi_div_w_cell_ad')) exit call do1_ad(s% COUPL_ad, c% COUPL_ad) if (failed('COUPL_ad')) exit call do1_ad(s% Lr_ad, c% Lr_ad) @@ -1198,6 +1226,8 @@ subroutine star_info_arrays(s, c_in, action_in, ierr) if (failed('Peos_start')) exit call do1(s% Peos_face_start, c% Peos_face_start) if (failed('Peos_face_start')) exit + call do1(s% mlt_tdc_P_face_start, c% mlt_tdc_P_face_start) + if (failed('mlt_tdc_P_face_start')) exit call do1(s% lnT_start, c% lnT_start) if (failed('lnT_start')) exit call do1(s% energy_start, c% energy_start) diff --git a/star/private/conv_premix.f90 b/star/private/conv_premix.f90 index 25bc99e6c..b93a5cfe1 100644 --- a/star/private/conv_premix.f90 +++ b/star/private/conv_premix.f90 @@ -1339,6 +1339,13 @@ subroutine update_model_ (s, update_mode, kc_t, kc_b) kf_t = kc_t kf_b = kc_b + 1 + if (s% use_face_values_eos_and_kap_mlt_tdc) then + ! update_model_ changed the local composition and refreshed EOS and kap + ! on kc_t:kc_b, so the cached face thermo bundle must be rebuilt for the + ! interior faces before set_mlt_vars uses it. + s% have_mlt_tdc_face_state(kf_t+1:kf_b-1) = .false. + end if + call set_mlt_vars(s, kf_t+1, kf_b-1, ierr) if (ierr /= 0) then write(*,*) 'conv_premix: failed in call to set_mlt_vars during update_model_' diff --git a/star/private/ctrls_io.f90 b/star/private/ctrls_io.f90 index 16004f3de..20c440716 100644 --- a/star/private/ctrls_io.f90 +++ b/star/private/ctrls_io.f90 @@ -113,6 +113,7 @@ module ctrls_io include_mlt_Pturb_in_thermodynamic_gradients, & include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, & TDC_arnett_growth_target, use_TDC_acceleration_limit, use_TDC_Af_split, & + use_TDC_enhanced_dissipation, TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor, & use_conservative_L_remesh, & use_face_values_eos_and_kap_mlt_tdc, & TDC_include_eturb_in_energy_equation, & @@ -2105,6 +2106,9 @@ subroutine store_controls(s, ierr) s% TDC_arnett_growth_target = TDC_arnett_growth_target s% use_TDC_acceleration_limit = use_TDC_acceleration_limit s% use_TDC_Af_split = use_TDC_Af_split + s% use_TDC_enhanced_dissipation = use_TDC_enhanced_dissipation + s% TDC_enhanced_dissipation_c4 = TDC_enhanced_dissipation_c4 + s% TDC_enhanced_dissipation_v_floor = TDC_enhanced_dissipation_v_floor s% use_conservative_L_remesh = use_conservative_L_remesh s% use_face_values_eos_and_kap_mlt_tdc = use_face_values_eos_and_kap_mlt_tdc s% TDC_include_eturb_in_energy_equation = TDC_include_eturb_in_energy_equation @@ -3822,6 +3826,9 @@ subroutine set_controls_for_writing(s, ierr) TDC_arnett_growth_target = s% TDC_arnett_growth_target use_TDC_acceleration_limit = s% use_TDC_acceleration_limit use_TDC_Af_split = s% use_TDC_Af_split + use_TDC_enhanced_dissipation = s% use_TDC_enhanced_dissipation + TDC_enhanced_dissipation_c4 = s% TDC_enhanced_dissipation_c4 + TDC_enhanced_dissipation_v_floor = s% TDC_enhanced_dissipation_v_floor use_conservative_L_remesh = s% use_conservative_L_remesh use_face_values_eos_and_kap_mlt_tdc = s% use_face_values_eos_and_kap_mlt_tdc TDC_include_eturb_in_energy_equation = s% TDC_include_eturb_in_energy_equation diff --git a/star/private/hydro_temperature.f90 b/star/private/hydro_temperature.f90 index c6e84ef2b..c7f1e6c00 100644 --- a/star/private/hydro_temperature.f90 +++ b/star/private/hydro_temperature.f90 @@ -21,6 +21,7 @@ module hydro_temperature use star_private_def use const_def, only: dp, ln10, pi4, crad, clight, convective_mixing + use mlt_tdc_face_support, only: get_face_eos_kap_ad use utils_lib, only: mesa_error, is_bad use auto_diff use auto_diff_support @@ -51,6 +52,7 @@ subroutine do1_alt_dlnT_dm_eqn(s, k, nvar, ierr) type(auto_diff_real_star_order1) :: L_ad, r_00, area, area2, Lrad_ad, & kap_00, kap_m1, kap_face, d_P_rad_expected_ad, T_m1, T4_m1, T_00, T4_00, & P_rad_m1, P_rad_00, d_P_rad_actual_ad, resid + type(auto_diff_real_star_order1) :: T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face type(auto_diff_real_star_order1) :: flxR, flxLambda integer :: i_equL @@ -88,9 +90,19 @@ subroutine do1_alt_dlnT_dm_eqn(s, k, nvar, ierr) Lrad_ad = L_ad end if - kap_00 = wrap_kap_00(s,k) - kap_m1 = wrap_kap_m1(s,k) - kap_face = alfa*kap_00 + beta*kap_m1 + if (s% use_face_values_eos_and_kap_mlt_tdc) then + if (s% have_mlt_tdc_face_state(k)) then + kap_face = s% mlt_tdc_opacity_face_ad(k) + else + call get_face_eos_kap_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, kap_face, ierr) + if (ierr /= 0) return + end if + else + kap_00 = wrap_kap_00(s,k) + kap_m1 = wrap_kap_m1(s,k) + kap_face = alfa*kap_00 + beta*kap_m1 + end if if (kap_face%val < s% min_kap_for_dPrad_dm_eqn) & kap_face = s% min_kap_for_dPrad_dm_eqn @@ -397,7 +409,8 @@ subroutine eval_dlnPdm_qhse(s, k, & ! calculate the expected dlnPdm for HSE integer, intent(out) :: ierr real(dp) :: alfa - type(auto_diff_real_star_order1) :: grav, area, P00, Pm1, inv_R2, mlt_Ptrb00, mlt_Ptrbm1 + type(auto_diff_real_star_order1) :: grav, area, P00, Pm1, inv_R2, mlt_Ptrb00, mlt_Ptrbm1, mlt_Ptrb_face + type(auto_diff_real_star_order1) :: T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face include 'formats' ierr = 0 @@ -408,37 +421,59 @@ subroutine eval_dlnPdm_qhse(s, k, & ! calculate the expected dlnPdm for HSE ! for rotation, multiply gravity by factor fp. MESA 2, eqn 22. call expected_HSE_grav_term(s, k, grav, area, ierr) ! note that expected_HSE_grav_term is negative - ! mlt_pturb in thermodynamic gradients does not currently support time centering because it is timelagged. - ! replace mlt_vc check with s% mlt_vc_old(k) >0 check. - if ((s% have_mlt_vc .and. s% okay_to_set_mlt_vc) .and. s% include_mlt_Pturb_in_thermodynamic_gradients & - .and. s% mlt_Pturb_factor > 0d0) then - if (k ==1) then - mlt_Ptrb00 = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*wrap_d_00(s,k)/3d0 - mlt_Ptrbm1 = 0d0 + if (s% use_face_values_eos_and_kap_mlt_tdc) then + if (s% have_mlt_tdc_face_state(k)) then + rho_face = s% mlt_tdc_rho_face_ad(k) + Ppoint = s% mlt_tdc_P_face_ad(k) else - mlt_Ptrb00 = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*wrap_d_00(s,k)/3d0 - mlt_Ptrbm1 = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*wrap_d_m1(s,k)/3d0 + call get_face_eos_kap_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face, ierr) + if (ierr /= 0) return + Ppoint = P_face + end if + if (s% using_velocity_time_centering) then + Ppoint = 0.5d0*(Ppoint + s% mlt_tdc_P_face_start(k)) + end if + if ((s% have_mlt_vc .and. s% okay_to_set_mlt_vc) .and. s% include_mlt_Pturb_in_thermodynamic_gradients & + .and. s% mlt_Pturb_factor > 0d0) then + ! Keep the lagged convective velocity, but form the pressure term from the same + ! face density used by the reconstructed face thermodynamic quantities. + mlt_Ptrb_face = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*rho_face/3d0 + Ppoint = Ppoint + mlt_Ptrb_face + end if + else + ! mlt_pturb in thermodynamic gradients does not currently support time centering because it is timelagged. + ! replace mlt_vc check with s% mlt_vc_old(k) >0 check. + if ((s% have_mlt_vc .and. s% okay_to_set_mlt_vc) .and. s% include_mlt_Pturb_in_thermodynamic_gradients & + .and. s% mlt_Pturb_factor > 0d0) then + if (k ==1) then + mlt_Ptrb00 = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*wrap_d_00(s,k)/3d0 + mlt_Ptrbm1 = 0d0 + else + mlt_Ptrb00 = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*wrap_d_00(s,k)/3d0 + mlt_Ptrbm1 = s% mlt_Pturb_factor*pow2(s% mlt_vc_old(k))*wrap_d_m1(s,k)/3d0 + end if + else ! no mlt_pturb + mlt_Ptrb00 = 0d0 + mlt_Ptrbm1 = 0d0 end if - else ! no mlt_pturb - mlt_Ptrb00 = 0d0 - mlt_Ptrbm1 = 0d0 - end if - P00 = wrap_Peos_00(s,k) + P00 = wrap_Peos_00(s,k) - ! mlt Pturb doesn't support time centering yet. - if (s% using_velocity_time_centering) P00 = 0.5d0*(P00 + s% Peos_start(k)) + ! mlt Pturb doesn't support time centering yet. + if (s% using_velocity_time_centering) P00 = 0.5d0*(P00 + s% Peos_start(k)) - if (k == 1) then - Pm1 = 0d0 - Ppoint = P00 + mlt_Ptrb00 - else - Pm1 = wrap_Peos_m1(s,k) - if (s% using_velocity_time_centering) Pm1 = 0.5d0*(Pm1 + s% Peos_start(k-1)) ! pm1 wasn't time centered until now - Pm1 = Pm1 + mlt_Ptrbm1 ! include mlt Ptrb in k-1 - P00 = P00 + mlt_Ptrb00 ! include mlt Ptrb in k - alfa = s% dq(k-1)/(s% dq(k-1) + s% dq(k)) - Ppoint = alfa*P00 + (1d0-alfa)*Pm1 + if (k == 1) then + Pm1 = 0d0 + Ppoint = P00 + mlt_Ptrb00 + else + Pm1 = wrap_Peos_m1(s,k) + if (s% using_velocity_time_centering) Pm1 = 0.5d0*(Pm1 + s% Peos_start(k-1)) ! pm1 wasn't time centered until now + Pm1 = Pm1 + mlt_Ptrbm1 ! include mlt Ptrb in k-1 + P00 = P00 + mlt_Ptrb00 ! include mlt Ptrb in k + alfa = s% dq(k-1)/(s% dq(k-1) + s% dq(k)) + Ppoint = alfa*P00 + (1d0-alfa)*Pm1 + end if end if dlnPdm_qhse = grav/(area*Ppoint) ! note that expected_HSE_grav_term is negative diff --git a/star/private/hydro_vars.f90 b/star/private/hydro_vars.f90 index 23a6d4843..270e070e3 100644 --- a/star/private/hydro_vars.f90 +++ b/star/private/hydro_vars.f90 @@ -564,6 +564,8 @@ subroutine set_hydro_vars( & if (.not. skip_mlt .and. .not. s% RSP_flag) then + s% have_mlt_tdc_face_state(1:s%nz) = .false. + if (.not. skip_mixing_info) then if (s% make_gradr_sticky_in_solver_iters) then s% fixed_gradr_for_rest_of_solver_iters(nzlo:nzhi) = .false. diff --git a/star/private/mlt_tdc_face_support.f90 b/star/private/mlt_tdc_face_support.f90 index cea538acc..5fb41409f 100644 --- a/star/private/mlt_tdc_face_support.f90 +++ b/star/private/mlt_tdc_face_support.f90 @@ -51,11 +51,18 @@ subroutine get_mlt_face_state_ad( & ierr = 0 if (s%use_face_values_eos_and_kap_mlt_tdc) then - call get_face_eos_kap_ad( & - s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face, ierr) + call ensure_mlt_tdc_face_state_ad(s, k, ierr) if (ierr /= 0) return - call set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) - call set_gradr_from_face_state(s, k, P_face, opacity_face, T_face, gradr_face) + T_face = s%mlt_tdc_T_face_ad(k) + rho_face = s%mlt_tdc_rho_face_ad(k) + P_face = s%mlt_tdc_P_face_ad(k) + Cp_face = s%mlt_tdc_Cp_face_ad(k) + ChiRho_face = s%mlt_tdc_ChiRho_face_ad(k) + ChiT_face = s%mlt_tdc_ChiT_face_ad(k) + grada_face = s%mlt_tdc_grada_face_ad(k) + opacity_face = s%mlt_tdc_opacity_face_ad(k) + scale_height_face = s%mlt_tdc_scale_height_face_ad(k) + gradr_face = s%mlt_tdc_gradr_face_ad(k) else T_face = get_T_face(s, k) P_face = get_Peos_face(s, k) @@ -70,6 +77,39 @@ subroutine get_mlt_face_state_ad( & end if end subroutine get_mlt_face_state_ad + + ! Ensures that the recomputed MLT and TDC face thermodynamic quantities have + ! been assembled and cached for face k. + subroutine ensure_mlt_tdc_face_state_ad(s, k, ierr) + type(star_info), pointer :: s + integer, intent(in) :: k + integer, intent(out) :: ierr + + type(auto_diff_real_star_order1) :: T_face, rho_face, P_face, Cp_face + type(auto_diff_real_star_order1) :: ChiRho_face, ChiT_face, grada_face, opacity_face + type(auto_diff_real_star_order1) :: scale_height_face, gradr_face + + ierr = 0 + if (s%have_mlt_tdc_face_state(k)) return + + call build_mlt_tdc_face_state_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, & + opacity_face, scale_height_face, gradr_face, ierr) + if (ierr /= 0) return + + s%mlt_tdc_T_face_ad(k) = T_face + s%mlt_tdc_rho_face_ad(k) = rho_face + s%mlt_tdc_P_face_ad(k) = P_face + s%mlt_tdc_Cp_face_ad(k) = Cp_face + s%mlt_tdc_ChiRho_face_ad(k) = ChiRho_face + s%mlt_tdc_ChiT_face_ad(k) = ChiT_face + s%mlt_tdc_grada_face_ad(k) = grada_face + s%mlt_tdc_opacity_face_ad(k) = opacity_face + s%mlt_tdc_scale_height_face_ad(k) = scale_height_face + s%mlt_tdc_gradr_face_ad(k) = gradr_face + s%have_mlt_tdc_face_state(k) = .true. + end subroutine ensure_mlt_tdc_face_state_ad + ! Reconstructs the face composition from either the current or the ! start-of-step composition and renormalizes xa_face. subroutine get_face_composition(s, k, use_starting_comp, zbar_face, xa_face, ierr) @@ -201,17 +241,44 @@ subroutine get_face_opacity_factor(s, k, log10_T, opacity_factor_face) end subroutine get_face_opacity_factor - ! Recomputes the face EOS and opacity state as + ! Returns the cached or newly built face EOS and opacity state as ! auto_diff_real_star_order1 quantities for the MLT/TDC solve, ! instead of using the stored face quantities. subroutine get_face_eos_kap_ad( & s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face, ierr) + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face + integer, intent(out) :: ierr + + ierr = 0 + call ensure_mlt_tdc_face_state_ad(s, k, ierr) + if (ierr /= 0) return + + T_face = s%mlt_tdc_T_face_ad(k) + rho_face = s%mlt_tdc_rho_face_ad(k) + P_face = s%mlt_tdc_P_face_ad(k) + Cp_face = s%mlt_tdc_Cp_face_ad(k) + ChiRho_face = s%mlt_tdc_ChiRho_face_ad(k) + ChiT_face = s%mlt_tdc_ChiT_face_ad(k) + grada_face = s%mlt_tdc_grada_face_ad(k) + opacity_face = s%mlt_tdc_opacity_face_ad(k) + end subroutine get_face_eos_kap_ad + + + ! Builds the full set of recomputed face thermodynamic quantities for the + ! MLT and TDC solve from one EOS call and one opacity call at face k. + subroutine build_mlt_tdc_face_state_ad( & + s, k, T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, & + opacity_face, scale_height_face, gradr_face, ierr) use eos_def, only: num_eos_basic_results, i_lnPgas, i_grad_ad, i_gamma1, i_Cp, i_chiRho, i_chiT, i_eta, i_lnfree_e use kap_def, only: num_kap_fracs type(star_info), pointer :: s integer, intent(in) :: k - type(auto_diff_real_star_order1), intent(out) :: T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face + type(auto_diff_real_star_order1), intent(out) :: & + T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, & + opacity_face, scale_height_face, gradr_face integer, intent(out) :: ierr real(dp) :: log10_T, log10_rho, kap_zbar_face, opacity_factor_face @@ -281,33 +348,24 @@ subroutine get_face_eos_kap_ad( & alpha = mlt_Pturb_ad/(P_face*gamma1_face) grada_face = grada_face*(P_face + mlt_Pturb_ad)/(P_face*(1d0 + alpha)) end if - end subroutine get_face_eos_kap_ad + call set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) + call set_gradr_from_face_state(s, k, P_face, opacity_face, T_face, gradr_face) + end subroutine build_mlt_tdc_face_state_ad - ! Recomputes the face pressure scale height as an - ! auto_diff_real_star_order1 quantity from the recomputed face state. - subroutine get_face_scale_height_ad(s, k, scale_height_face, ierr) - use eos_def, only: num_eos_basic_results, i_lnPgas + ! Returns the cached or newly built face pressure scale height as an + ! auto_diff_real_star_order1 quantity from the face EOS state. + subroutine get_face_scale_height_ad(s, k, scale_height_face, ierr) type(star_info), pointer :: s integer, intent(in) :: k type(auto_diff_real_star_order1), intent(out) :: scale_height_face integer, intent(out) :: ierr - real(dp) :: eos_res(num_eos_basic_results), d_dlnd(num_eos_basic_results), d_dlnT(num_eos_basic_results) - real(dp) :: dlnT_face(auto_diff_star_num_vars), dlnd_face(auto_diff_star_num_vars) - type(auto_diff_real_star_order1) :: T_face, rho_face, Pgas_face, P_face - ierr = 0 - call get_face_eos_inputs( & - s, k, T_face, rho_face, eos_res, d_dlnd, d_dlnT, ierr) + call ensure_mlt_tdc_face_state_ad(s, k, ierr) if (ierr /= 0) return - call set_face_log_partials(T_face, rho_face, dlnT_face, dlnd_face) - - call set_face_ad_from_log(eos_res(i_lnPgas), d_dlnd(i_lnPgas), d_dlnT(i_lnPgas), dlnd_face, dlnT_face, Pgas_face) - P_face = Pgas_face + crad*pow4(T_face)/3d0 - - call set_scale_height_from_face_state(s, k, P_face, rho_face, scale_height_face) + scale_height_face = s%mlt_tdc_scale_height_face_ad(k) end subroutine get_face_scale_height_ad diff --git a/star/private/phase_separation.f90 b/star/private/phase_separation.f90 index 09b25374a..9d2c8de59 100644 --- a/star/private/phase_separation.f90 +++ b/star/private/phase_separation.f90 @@ -387,6 +387,13 @@ subroutine update_model_ (s, kc_t, kc_b, do_brunt) kf_t = kc_t kf_b = kc_b + 1 + if (s% use_face_values_eos_and_kap_mlt_tdc) then + ! update_model_ changed the local composition and refreshed EOS and + ! kap on kc_t:kc_b, so the cached face thermo bundle must be rebuilt + ! for the interior faces before set_mlt_vars uses it. + s% have_mlt_tdc_face_state(kf_t+1:kf_b-1) = .false. + end if + call set_mlt_vars(s, kf_t+1, kf_b-1, ierr) if (ierr /= 0) then write(*,*) 'phase_separation: failed in call to set_mlt_vars during update_model_' diff --git a/star/private/profile_getval.f90 b/star/private/profile_getval.f90 index 471399f94..3d34144b7 100644 --- a/star/private/profile_getval.f90 +++ b/star/private/profile_getval.f90 @@ -279,7 +279,7 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) d_dlnR00, d_dlnRp1, d_dv00, d_dvp1 integer :: j, nz, ionization_k, klo, khi, i, ii, ierr real(dp) :: f, lgT, full_on, full_off, am_nu_factor - logical :: rsp_or_w + logical :: rsp_or_w, face_cache_active, tdc_cache_active include 'formats' if (s% rotation_flag) then @@ -304,6 +304,8 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) int_flag = .false. rsp_or_w = s% RSP_flag .or. s% RSP2_flag + face_cache_active = s% use_face_values_eos_and_kap_mlt_tdc + tdc_cache_active = s% MLT_option == 'TDC' .and. .not. s% RSP_flag .and. (s% v_flag .or. s% u_flag) if (c > extra_offset) then i = c - extra_offset @@ -1919,6 +1921,32 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) if (rsp_or_w) val = s% Lt(k) case(p_Lt_div_L) if (rsp_or_w) val = s% Lt(k)/s% L(k) + case(p_mlt_tdc_T_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_T_face_ad(k)% val + case(p_mlt_tdc_rho_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_rho_face_ad(k)% val + case(p_mlt_tdc_P_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_P_face_ad(k)% val + case(p_mlt_tdc_Cp_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_Cp_face_ad(k)% val + case(p_mlt_tdc_ChiRho_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_ChiRho_face_ad(k)% val + case(p_mlt_tdc_ChiT_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_ChiT_face_ad(k)% val + case(p_mlt_tdc_grada_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_grada_face_ad(k)% val + case(p_mlt_tdc_opacity_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_opacity_face_ad(k)% val + case(p_mlt_tdc_scale_height_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_scale_height_face_ad(k)% val + case(p_mlt_tdc_gradr_face) + if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_gradr_face_ad(k)% val + case(p_tdc_Chi_div_w_face) + if (tdc_cache_active) val = s% tdc_Chi_div_w_face_ad(k)% val + case(p_tdc_Eq_div_w_face) + if (tdc_cache_active) val = s% tdc_Eq_div_w_face_ad(k)% val + case(p_tdc_Chi_div_w_cell) + if (tdc_cache_active) val = s% tdc_Chi_div_w_cell_ad(k)% val case(p_rsp_Et) diff --git a/star/private/star_profile_def.f90 b/star/private/star_profile_def.f90 index a51dd25c6..bdb922ee3 100644 --- a/star/private/star_profile_def.f90 +++ b/star/private/star_profile_def.f90 @@ -599,7 +599,21 @@ module star_profile_def integer, parameter :: p_Lt = p_Lc_div_L + 1 integer, parameter :: p_Lt_div_L = p_Lt + 1 - integer, parameter :: p_rsp_log_erad = p_Lt_div_L + 1 + integer, parameter :: p_mlt_tdc_T_face = p_Lt_div_L + 1 + integer, parameter :: p_mlt_tdc_rho_face = p_mlt_tdc_T_face + 1 + integer, parameter :: p_mlt_tdc_P_face = p_mlt_tdc_rho_face + 1 + integer, parameter :: p_mlt_tdc_Cp_face = p_mlt_tdc_P_face + 1 + integer, parameter :: p_mlt_tdc_ChiRho_face = p_mlt_tdc_Cp_face + 1 + integer, parameter :: p_mlt_tdc_ChiT_face = p_mlt_tdc_ChiRho_face + 1 + integer, parameter :: p_mlt_tdc_grada_face = p_mlt_tdc_ChiT_face + 1 + integer, parameter :: p_mlt_tdc_opacity_face = p_mlt_tdc_grada_face + 1 + integer, parameter :: p_mlt_tdc_scale_height_face = p_mlt_tdc_opacity_face + 1 + integer, parameter :: p_mlt_tdc_gradr_face = p_mlt_tdc_scale_height_face + 1 + integer, parameter :: p_tdc_Chi_div_w_face = p_mlt_tdc_gradr_face + 1 + integer, parameter :: p_tdc_Eq_div_w_face = p_tdc_Chi_div_w_face + 1 + integer, parameter :: p_tdc_Chi_div_w_cell = p_tdc_Eq_div_w_face + 1 + + integer, parameter :: p_rsp_log_erad = p_tdc_Chi_div_w_cell + 1 integer, parameter :: p_rsp_erad = p_rsp_log_erad + 1 integer, parameter :: p_rsp_logEt = p_rsp_erad + 1 integer, parameter :: p_rsp_Et = p_rsp_logEt + 1 @@ -1277,6 +1291,19 @@ subroutine profile_column_names_init(ierr) profile_column_name(p_Lc_div_L) = 'Lc_div_L' profile_column_name(p_Lt) = 'Lt' profile_column_name(p_Lt_div_L) = 'Lt_div_L' + profile_column_name(p_mlt_tdc_T_face) = 'mlt_tdc_T_face' + profile_column_name(p_mlt_tdc_rho_face) = 'mlt_tdc_rho_face' + profile_column_name(p_mlt_tdc_P_face) = 'mlt_tdc_P_face' + profile_column_name(p_mlt_tdc_Cp_face) = 'mlt_tdc_Cp_face' + profile_column_name(p_mlt_tdc_ChiRho_face) = 'mlt_tdc_ChiRho_face' + profile_column_name(p_mlt_tdc_ChiT_face) = 'mlt_tdc_ChiT_face' + profile_column_name(p_mlt_tdc_grada_face) = 'mlt_tdc_grada_face' + profile_column_name(p_mlt_tdc_opacity_face) = 'mlt_tdc_opacity_face' + profile_column_name(p_mlt_tdc_scale_height_face) = 'mlt_tdc_scale_height_face' + profile_column_name(p_mlt_tdc_gradr_face) = 'mlt_tdc_gradr_face' + profile_column_name(p_tdc_Chi_div_w_face) = 'tdc_Chi_div_w_face' + profile_column_name(p_tdc_Eq_div_w_face) = 'tdc_Eq_div_w_face' + profile_column_name(p_tdc_Chi_div_w_cell) = 'tdc_Chi_div_w_cell' profile_column_name(p_rsp_Et) = 'rsp_Et' profile_column_name(p_rsp_logEt) = 'rsp_logEt' diff --git a/star/private/struct_burn_mix.f90 b/star/private/struct_burn_mix.f90 index c7f150ca4..0aef11946 100644 --- a/star/private/struct_burn_mix.f90 +++ b/star/private/struct_burn_mix.f90 @@ -268,9 +268,12 @@ end function do_rsp_step subroutine save_start_values(s, ierr) use hydro_rsp2, only: set_etrb_start_vars use star_utils, only: eval_total_energy_integrals, set_luminosity_by_category, get_Peos_face_val + use mlt_tdc_face_support, only: get_face_eos_kap_ad type (star_info), pointer :: s integer, intent(out) :: ierr integer :: k, j + type(auto_diff_real_star_order1) :: & + T_face_ad, rho_face_ad, P_face_ad, Cp_face_ad, ChiRho_face_ad, ChiT_face_ad, grada_face_ad, opacity_face_ad include 'formats' ierr = 0 @@ -298,6 +301,18 @@ subroutine save_start_values(s, ierr) s% lnPeos_start(k) = s% lnPeos(k) s% Peos_start(k) = s% Peos(k) s% Peos_face_start(k) = get_Peos_face_val(s,k) + if (s% use_face_values_eos_and_kap_mlt_tdc) then + if (s% have_mlt_tdc_face_state(k)) then + s% mlt_tdc_P_face_start(k) = s% mlt_tdc_P_face_ad(k)%val + else + call get_face_eos_kap_ad( & + s, k, T_face_ad, rho_face_ad, P_face_ad, Cp_face_ad, ChiRho_face_ad, ChiT_face_ad, grada_face_ad, opacity_face_ad, ierr) + if (ierr /= 0) return + s% mlt_tdc_P_face_start(k) = P_face_ad%val + end if + else + s% mlt_tdc_P_face_start(k) = s% Peos_face_start(k) + end if s% lnPgas_start(k) = s% lnPgas(k) s% energy_start(k) = s% energy(k) s% lnR_start(k) = s% lnR(k) diff --git a/star/private/tdc_hydro.f90 b/star/private/tdc_hydro.f90 index 4258fdb61..9be2e285a 100644 --- a/star/private/tdc_hydro.f90 +++ b/star/private/tdc_hydro.f90 @@ -56,10 +56,16 @@ subroutine set_viscosity_vars_TDC(s, ierr) return end if - !$OMP PARALLEL DO PRIVATE(k,op_err) SCHEDULE(dynamic,2) + !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) do k = 1, s%nz - ! Hp_face(k) <= 0 means it needs to be set. e.g., after read file - if (s%Hp_face(k) <= 0) then + if (s%use_face_values_eos_and_kap_mlt_tdc) then + x = get_TDC_alpha_M_Hp_face(s, k, op_err) + if (op_err /= 0) then + ierr = op_err + else if (s%Hp_face(k) <= 0d0) then + s%Hp_face(k) = x%val + end if + else if (s%Hp_face(k) <= 0d0) then ! this scale height for face is already calculated in TDC s%Hp_face(k) = get_TDC_alpha_M_Hp_face_val(s, k, op_err) ! because this is called before s% scale_height(k) is updated in mlt_vars. if (op_err /= 0) ierr = op_err @@ -70,7 +76,25 @@ subroutine set_viscosity_vars_TDC(s, ierr) if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 1', s%model_number return end if - !$OMP PARALLEL DO PRIVATE(k,op_err) SCHEDULE(dynamic,2) + !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) + do k = 1, s%nz + call build_tdc_Chi_div_w_face_ad(s, k, s%tdc_Chi_div_w_face_ad(k), op_err) + if (op_err /= 0) ierr = op_err + call build_tdc_Eq_div_w_face_ad(s, k, s%tdc_Eq_div_w_face_ad(k), op_err) + if (op_err /= 0) ierr = op_err + if (s%v_flag) then + call build_tdc_Chi_div_w_cell_ad(s, k, s%tdc_Chi_div_w_cell_ad(k), op_err) + if (op_err /= 0) ierr = op_err + else + s%tdc_Chi_div_w_cell_ad(k) = 0d0 + end if + end do + !$OMP END PARALLEL DO + if (ierr /= 0) then + if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 2', s%model_number + return + end if + !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) do k = 1, s%nz x = compute_Chi_div_w_face(s, k, op_err) ! Sets Chi_face if (op_err /= 0) ierr = op_err @@ -85,7 +109,7 @@ subroutine set_viscosity_vars_TDC(s, ierr) end do !$OMP END PARALLEL DO if (ierr /= 0) then - if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 2', s%model_number + if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 3', s%model_number return end if end subroutine set_viscosity_vars_TDC @@ -136,6 +160,43 @@ real(dp) function get_TDC_alpha_M_Hp_face_val(s, k, ierr) result(Hp_face) end function get_TDC_alpha_M_Hp_face_val + function get_tdc_face_velocity_ad(s, k) result(w_00) + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1) :: w_00 + + if (s%okay_to_set_mlt_vc .and. & + s%TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then + w_00 = s%mlt_vc_old(k)/sqrt_2_div_3 + else + w_00 = s%mlt_vc_ad(k)/sqrt_2_div_3 + end if + end function get_tdc_face_velocity_ad + + + function get_tdc_cell_velocity_ad(s, k) result(w_00) + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1) :: w_00 + + if (k < s%nz) then + if (s%okay_to_set_mlt_vc .and. & + s%TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then + w_00 = 0.5d0*(s%mlt_vc_old(k) + s%mlt_vc_old(k+1))/sqrt_2_div_3 + else + w_00 = 0.5d0*(s%mlt_vc_ad(k) + shift_p1(s%mlt_vc_ad(k+1)))/sqrt_2_div_3 + end if + else + if (s%okay_to_set_mlt_vc .and. & + s%TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then + w_00 = 0.5d0*s%mlt_vc_old(k)/sqrt_2_div_3 + else + w_00 = 0.5d0*s%mlt_vc_ad(k)/sqrt_2_div_3 + end if + end if + end function get_tdc_cell_velocity_ad + + function wrap_Hp_cell(s, k) result(Hp_cell) ! cm , different than rsp2 type(star_info), pointer :: s integer, intent(in) :: k @@ -183,6 +244,39 @@ function Hp_cell_for_Chi(s, k, ierr) result(Hp_cell) ! cm end if end function Hp_cell_for_Chi + + function get_tdc_Chi_div_w_cell_ad(s, k, ierr) result(Chi_div_w_cell) + type(star_info), pointer :: s + integer, intent(in) :: k + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: Chi_div_w_cell + + ierr = 0 + Chi_div_w_cell = s%tdc_Chi_div_w_cell_ad(k) + end function get_tdc_Chi_div_w_cell_ad + + + function get_tdc_Chi_div_w_face_ad(s, k, ierr) result(Chi_div_w_face) + type(star_info), pointer :: s + integer, intent(in) :: k + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: Chi_div_w_face + + ierr = 0 + Chi_div_w_face = s%tdc_Chi_div_w_face_ad(k) + end function get_tdc_Chi_div_w_face_ad + + + function get_tdc_Eq_div_w_face_ad(s, k, ierr) result(Eq_div_w_face) + type(star_info), pointer :: s + integer, intent(in) :: k + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: Eq_div_w_face + + ierr = 0 + Eq_div_w_face = s%tdc_Eq_div_w_face_ad(k) + end function get_tdc_Eq_div_w_face_ad + ! this function is only called internally in TDC_Uq_face, and for v_flag only. function compute_Chi_cell(s, k, ierr) result(Chi_cell) ! does not update s% Chi or Chi_ad ! eddy viscosity energy (Kuhfuss 1986) [erg] @@ -190,81 +284,57 @@ function compute_Chi_cell(s, k, ierr) result(Chi_cell) ! does not update s% Chi integer, intent(in) :: k type(auto_diff_real_star_order1) :: Chi_cell integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: & - rho2, r6_cell, d_v_div_r, Hp_cell, w_00, d_00, r_00, r_p1 + type(auto_diff_real_star_order1) :: w_00 + + ierr = 0 + Chi_cell = get_tdc_Chi_div_w_cell_ad(s, k, ierr) + if (ierr /= 0) return + w_00 = get_tdc_cell_velocity_ad(s, k) + Chi_cell = Chi_cell*w_00 + end function compute_Chi_cell + + + subroutine build_tdc_Chi_div_w_cell_ad(s, k, Chi_div_w_cell, ierr) + ! Cell-centered eddy viscosity energy divided by the local velocity factor. + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: Chi_div_w_cell + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: rho2, r6_cell, d_v_div_r, Hp_cell, d_00, r_00, r_p1 real(dp) :: f, ALFAM_ALFA - logical :: dbg - include 'formats' + ierr = 0 - dbg = .false. - ! check where we are getting alfam from. if (s%MLT_option == 'TDC' .and. .not. s%RSP2_flag) then ALFAM_ALFA = s%TDC_alpha_M*s%mixing_length_alpha - else ! this is for safety, but probably is never called. + else ALFAM_ALFA = 0d0 end if if (ALFAM_ALFA == 0d0 .or. & - k <= s% TDC_num_outermost_cells_forced_nonturbulent .or. & - k > s% nz - s% TDC_num_innermost_cells_forced_nonturbulent) then - Chi_cell = 0d0 - else - Hp_cell = Hp_cell_for_Chi(s, k, ierr) - if (ierr /= 0) return - if (s%TDC_use_density_form_for_eddy_viscosity) then - ! new density derivative term - d_v_div_r = compute_rho_form_of_d_v_div_r(s, k, ierr) - else - d_v_div_r = compute_d_v_div_r(s, k, ierr) - end if - if (ierr /= 0) return + k <= s%TDC_num_outermost_cells_forced_nonturbulent .or. & + k > s%nz - s%TDC_num_innermost_cells_forced_nonturbulent) then + Chi_div_w_cell = 0d0 + return + end if - ! don't need to check if mlt_vc > 0 here. - if (k < s% nz) then - if (s% okay_to_set_mlt_vc .and. & - s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. - w_00 = 0.5d0*(s% mlt_vc_old(k) + s% mlt_vc_old(k+1))/sqrt_2_div_3! same as info%A0 from TDC - else - w_00 = 0.5d0*(s% mlt_vc_ad(k) + shift_p1(s% mlt_vc_ad(k+1)))/sqrt_2_div_3! same as info%A0 from TDC - end if - else - if (s% okay_to_set_mlt_vc .and. & - s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. - w_00 = 0.5d0*s% mlt_vc_old(k)/sqrt_2_div_3! same as info%A0 from TDC - else - w_00 = 0.5d0*s% mlt_vc_ad(k)/sqrt_2_div_3! same as info%A0 from TDC - end if - end if - d_00 = wrap_d_00(s, k) - f = (16d0/3d0)*pi*ALFAM_ALFA/s%dm(k) - rho2 = pow2(d_00) - r_00 = wrap_r_00(s, k) - r_p1 = wrap_r_p1(s, k) - r6_cell = 0.5d0*(pow6(r_00) + pow6(r_p1)) - Chi_cell = f*rho2*r6_cell*d_v_div_r*Hp_cell*w_00 - ! units = g^-1 cm s^-1 g^2 cm^-6 cm^6 s^-1 cm - ! = g cm^2 s^-2 - ! = erg - - end if - ! this is set in Chi_div_w_face - !s%Chi(k) = Chi_cell%val - !s%Chi_ad(k) = Chi_cell - - if (dbg .and. k == -100) then - write (*, *) ' s% ALFAM_ALFA', ALFAM_ALFA - write (*, *) 'Hp_cell', Hp_cell%val - write (*, *) 'd_v_div_r', d_v_div_r%val - write (*, *) ' f', f - write (*, *) 'w_00', w_00%val - write (*, *) 'd_00 ', d_00%val - write (*, *) 'rho2 ', rho2%val - write (*, *) 'r_00', r_00%val - write (*, *) 'r_p1 ', r_p1%val - write (*, *) 'r6_cell', r6_cell%val + Hp_cell = Hp_cell_for_Chi(s, k, ierr) + if (ierr /= 0) return + if (s%TDC_use_density_form_for_eddy_viscosity) then + d_v_div_r = compute_rho_form_of_d_v_div_r(s, k, ierr) + else + d_v_div_r = compute_d_v_div_r(s, k, ierr) end if - end function compute_Chi_cell + if (ierr /= 0) return + + d_00 = wrap_d_00(s, k) + f = (16d0/3d0)*pi*ALFAM_ALFA/s%dm(k) + rho2 = pow2(d_00) + r_00 = wrap_r_00(s, k) + r_p1 = wrap_r_p1(s, k) + r6_cell = 0.5d0*(pow6(r_00) + pow6(r_p1)) + Chi_div_w_cell = f*rho2*r6_cell*d_v_div_r*Hp_cell + end subroutine build_tdc_Chi_div_w_cell_ad ! face centered variables for tdc update below function compute_Chi_div_w_face(s, k, ierr) result(Chi_face) @@ -273,29 +343,44 @@ function compute_Chi_div_w_face(s, k, ierr) result(Chi_face) integer, intent(in) :: k type(auto_diff_real_star_order1) :: Chi_face integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: & - rho2, r6_face, d_v_div_r, Hp_face, w_00, d_00, r_00, r_p1 - real(dp) :: f, ALFAM_ALFA, dmbar - logical :: dbg - include 'formats' + type(auto_diff_real_star_order1) :: w_00 ierr = 0 - dbg = .false. - - ! check where we are getting alfam from. - if (s%MLT_option == 'TDC' .and. .not. s%RSP2_flag) then - ALFAM_ALFA = s%TDC_alpha_M*s%mixing_length_alpha - else ! this is for safety, but probably is never called. - ALFAM_ALFA = 0d0 - end if - - if (ALFAM_ALFA == 0d0 .or. & - k > s%nz - s% TDC_num_innermost_cells_forced_nonturbulent) then - Chi_face = 0d0 - else - Hp_face = get_TDC_alpha_M_Hp_face(s, k, ierr) !Hp_cell_for_Chi(s, k, ierr) + Chi_face = get_tdc_Chi_div_w_face_ad(s, k, ierr) + if (ierr /= 0) return + + ! Chi_cell does not set Chi, we store Chi_face in s% Chi and s% Chi_ad + w_00 = get_tdc_face_velocity_ad(s, k) + s%Chi(k) = Chi_face%val*w_00%val + s%Chi_ad(k) = Chi_face*w_00 + end function compute_Chi_div_w_face + + + subroutine build_tdc_Chi_div_w_face_ad(s, k, Chi_div_w_face, ierr) + ! Face-centered eddy viscosity energy divided by the local velocity factor. + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: Chi_div_w_face + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: rho2, r6_face, d_v_div_r, Hp_face, d_00, r_00 + real(dp) :: f, ALFAM_ALFA, dmbar + + ierr = 0 + + if (s%MLT_option == 'TDC' .and. .not. s%RSP2_flag) then + ALFAM_ALFA = s%TDC_alpha_M*s%mixing_length_alpha + else + ALFAM_ALFA = 0d0 + end if + + if (ALFAM_ALFA == 0d0 .or. & + k > s%nz - s%TDC_num_innermost_cells_forced_nonturbulent) then + Chi_div_w_face = 0d0 + return + end if + + Hp_face = get_TDC_alpha_M_Hp_face(s, k, ierr) if (ierr /= 0) return if (s%TDC_use_density_form_for_eddy_viscosity) then - ! new density derivative form d_v_div_r = compute_rho_form_of_d_v_div_r_face(s, k, ierr) else d_v_div_r = compute_d_v_div_r_face(s, k, ierr) @@ -303,92 +388,69 @@ function compute_Chi_div_w_face(s, k, ierr) result(Chi_face) if (ierr /= 0) return if (k >= 2) then - dmbar = 0.5d0*(s% dm(k) + s% dm(k-1)) + dmbar = 0.5d0*(s%dm(k) + s%dm(k-1)) else - dmbar = 0.5d0*s% dm(k) + dmbar = 0.5d0*s%dm(k) end if d_00 = get_rho_face(s, k) f = (16d0/3d0)*pi*ALFAM_ALFA/dmbar rho2 = pow2(d_00) r_00 = wrap_r_00(s, k) - !r_p1 = wrap_r_p1(s, k) - r6_face = pow6(r_00) !0.5d0*(pow6(r_00) + pow6(r_p1)) - Chi_face = f*rho2*r6_face*d_v_div_r*Hp_face!*w_00 - ! units = g^-1 cm s^-1 g^2 cm^-6 cm^6 s^-1 cm * [s/cm] ! [1/w_00] = [s/cm] - ! = g cm^2 s^-2 * [s/cm] - ! = erg ! * [s / cm] - > [erg] * [s/cm] - - end if - - ! Chi_cell does not set Chi, we store Chi_face in s% Chi and s% Chi_ad - if (s% okay_to_set_mlt_vc .and. & - s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. - w_00 = s% mlt_vc_old(k)/sqrt_2_div_3! same as info%A0 from TDC - else - w_00 = s% mlt_vc_ad(k)/sqrt_2_div_3! same as info%A0 from TDC - end if - s%Chi(k) = Chi_face%val*w_00%val - s%Chi_ad(k) = Chi_face*w_00 - - if (dbg .and. k == -100) then - write (*, *) ' s% ALFAM_ALFA', ALFAM_ALFA - write (*, *) 'Hp_face', Hp_face%val - write (*, *) 'd_v_div_r', d_v_div_r%val - write (*, *) ' f', f - write (*, *) 'w_00', w_00%val - write (*, *) 'd_00 ', d_00%val - write (*, *) 'rho2 ', rho2%val - write (*, *) 'r_00', r_00%val - write (*, *) 'r_p1 ', r_p1%val - write (*, *) 'r6_cell', r6_face%val - end if - end function compute_Chi_div_w_face + r6_face = pow6(r_00) + Chi_div_w_face = f*rho2*r6_face*d_v_div_r*Hp_face + end subroutine build_tdc_Chi_div_w_face_ad function compute_tdc_Eq_div_w_face(s, k, ierr) result(Eq_face) ! erg g^-1 s^-1 * (cm^-1 s^1) type(star_info), pointer :: s integer, intent(in) :: k type(auto_diff_real_star_order1) :: Eq_face integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: d_v_div_r, Chi_face, w_00 - real(dp) :: dmbar - include 'formats' + type(auto_diff_real_star_order1) :: w_00 ierr = 0 - if (s%mixing_length_alpha == 0d0 .or. & - k > s%nz - s% TDC_num_innermost_cells_forced_nonturbulent) then - Eq_face = 0d0 - if (k >= 1 .and. k <= s%nz) s%Eq_ad(k) = 0d0 - else - Chi_face = compute_Chi_div_w_face(s,k,ierr) + Eq_face = get_tdc_Eq_div_w_face_ad(s, k, ierr) + if (ierr /= 0) return + + ! only for output, really only used for returning Eq to star pointers. + w_00 = get_tdc_face_velocity_ad(s, k) + + s%Eq(k) = Eq_face%val * w_00%val + s%Eq_ad(k) = Eq_face * w_00 + end function compute_tdc_Eq_div_w_face + + + subroutine build_tdc_Eq_div_w_face_ad(s, k, Eq_div_w_face, ierr) + type(star_info), pointer :: s + integer, intent(in) :: k + type(auto_diff_real_star_order1), intent(out) :: Eq_div_w_face + integer, intent(out) :: ierr + type(auto_diff_real_star_order1) :: d_v_div_r, Chi_div_w_face + real(dp) :: dmbar + + ierr = 0 + if (s%mixing_length_alpha == 0d0 .or. & + k > s%nz - s%TDC_num_innermost_cells_forced_nonturbulent) then + Eq_div_w_face = 0d0 + return + end if + + Chi_div_w_face = get_tdc_Chi_div_w_face_ad(s, k, ierr) if (ierr /= 0) return if (s%TDC_use_density_form_for_eddy_viscosity) then - ! new density derivative term d_v_div_r = compute_rho_form_of_d_v_div_r_face_opt_time_center(s, k, ierr) else d_v_div_r = compute_d_v_div_r_opt_time_center_face(s, k, ierr) end if + if (ierr /= 0) return if (k >= 2) then - dmbar = 0.5d0*(s% dm(k) + s% dm(k-1)) + dmbar = 0.5d0*(s%dm(k) + s%dm(k-1)) else - dmbar = 0.5d0*s% dm(k) + dmbar = 0.5d0*s%dm(k) end if - if (ierr /= 0) return - Eq_face = 4d0*pi*Chi_face*d_v_div_r/dmbar ! erg s^-1 g^-1 * (cm^-1 s^1) - end if - - ! only for output, really only used for returning Eq to star pointers. - if (s% okay_to_set_mlt_vc .and. & - s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. - w_00 = s% mlt_vc_old(k)/sqrt_2_div_3! same as info%A0 from TDC - else - w_00 = s% mlt_vc_ad(k)/sqrt_2_div_3! same as info%A0 from TDC - end if - - s%Eq(k) = Eq_face%val * w_00%val - s%Eq_ad(k) = Eq_face * w_00 - end function compute_tdc_Eq_div_w_face + Eq_div_w_face = 4d0*pi*Chi_div_w_face*d_v_div_r/dmbar + end subroutine build_tdc_Eq_div_w_face_ad ! for v_flag only. face centered Uq for hydro_momentum function compute_tdc_Uq_face(s, k, ierr) result(Uq_face) !(v_flag only) ! cm s^-2, acceleration @@ -406,8 +468,8 @@ function compute_tdc_Uq_face(s, k, ierr) result(Uq_face) !(v_flag only) ! cm s^ else r_00 = wrap_opt_time_center_r_00(s, k) - ! which do we adopt? - Chi_00 = compute_Chi_cell(s, k, ierr) ! s% Chi_ad(k) XXX + Chi_00 = compute_Chi_cell(s, k, ierr) + if (ierr /= 0) return if (k > 1) then Chi_m1 = shift_m1(compute_Chi_cell(s, k-1, ierr)) @@ -444,24 +506,12 @@ function compute_tdc_Uq_dm_cell(s, k, ierr) result(Uq_cell) ! cm s^-2, accelera r_p1 = wrap_opt_time_center_r_p1(s, k) r_cell = 0.5d0*(r_00+r_p1) ! not staggered unlike terms inside chi_div_w_face - if (s% okay_to_set_mlt_vc .and. & - s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then - w_00 = s% mlt_vc_old(k)/sqrt_2_div_3 - else - w_00 = s% mlt_vc_ad(k)/sqrt_2_div_3 - end if - - Chi_00 = compute_Chi_div_w_face(s, k, ierr) * w_00 + w_00 = get_tdc_face_velocity_ad(s, k) + Chi_00 = get_tdc_Chi_div_w_face_ad(s, k, ierr) * w_00 if (k < s% nz) then - if (s% okay_to_set_mlt_vc .and. & - s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then - w_p1 = s% mlt_vc_old(k+1)/sqrt_2_div_3 - else - w_p1 = shift_p1(s% mlt_vc_ad(k+1))/sqrt_2_div_3 - end if - - Chi_p1 = shift_p1(compute_Chi_div_w_face(s, k+1, ierr))*w_p1 + w_p1 = shift_p1(get_tdc_face_velocity_ad(s, k+1)) + Chi_p1 = shift_p1(get_tdc_Chi_div_w_face_ad(s, k+1, ierr))*w_p1 if (ierr /= 0) return else Chi_p1 = 0d0 diff --git a/star/private/turb_info.f90 b/star/private/turb_info.f90 index 583e45b56..2ec8fe6dc 100644 --- a/star/private/turb_info.f90 +++ b/star/private/turb_info.f90 @@ -120,7 +120,8 @@ subroutine do1_mlt_2(s, k, & gradL_composition_term = 0d0 end if - ! Assemble the full face-state thermo bundle for the MLT/TDC solve. + ! Assemble the full set of face thermodynamic quantities for the + ! MLT/TDC solve. ! This helper either computes EOS and kap on faces directly or ! recomputes them from face wrapped primitives, and returns consistent ! T, P, rho, kap, Cp, chiRho, chiT, grada, gradr, and scale height values. diff --git a/star/private/turb_support.f90 b/star/private/turb_support.f90 index 6cc0db478..aa4badc64 100644 --- a/star/private/turb_support.f90 +++ b/star/private/turb_support.f90 @@ -155,7 +155,11 @@ subroutine do1_mlt_eval( & L_theta = 1d0 end if L = L_theta*wrap_L_00(s, k) + (1d0 - L_theta)*s% L_start(k) - P = P_theta*P + (1d0-P_theta)*s% Peos_face_start(k) + if (s% use_face_values_eos_and_kap_mlt_tdc) then + P = P_theta*P + (1d0-P_theta)*s% mlt_tdc_P_face_start(k) + else + P = P_theta*P + (1d0-P_theta)*s% Peos_face_start(k) + end if r = wrap_opt_time_center_r_00(s,k) else L = wrap_L_00(s,k) @@ -335,7 +339,9 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & - s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, s% TDC_arnett_growth_target, & + s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, & + s% use_TDC_enhanced_dissipation, s% TDC_enhanced_dissipation_c4, s% TDC_enhanced_dissipation_v_floor, & + s% TDC_arnett_growth_target, & energy, ierr) s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt @@ -358,7 +364,9 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & - s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, s% TDC_arnett_growth_target, & + s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, & + s% use_TDC_enhanced_dissipation, s% TDC_enhanced_dissipation_c4, s% TDC_enhanced_dissipation_v_floor, & + s% TDC_arnett_growth_target, & energy, ierr) s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt if (ierr /= 0) then diff --git a/star_data/private/star_controls_dev.inc b/star_data/private/star_controls_dev.inc index 5ef3ca8fb..fdd602f2c 100644 --- a/star_data/private/star_controls_dev.inc +++ b/star_data/private/star_controls_dev.inc @@ -7,11 +7,14 @@ logical :: use_TDC_arnett_velocity_closure logical :: use_TDC_acceleration_limit logical :: use_TDC_Af_split + logical :: use_TDC_enhanced_dissipation logical :: use_conservative_L_remesh logical :: use_face_values_eos_and_kap_mlt_tdc integer :: TDC_arnett_growth_target logical :: include_mlt_in_velocity_time_centering logical :: use_hydro_merge_limits_in_mesh_plan + real(dp) :: TDC_enhanced_dissipation_c4 + real(dp) :: TDC_enhanced_dissipation_v_floor real(dp) :: RSP2_Lsurf_factor real(dp) :: RSP2_alfap diff --git a/star_data/public/star_data_step_work.inc b/star_data/public/star_data_step_work.inc index 1991b965d..d9036d817 100644 --- a/star_data/public/star_data_step_work.inc +++ b/star_data/public/star_data_step_work.inc @@ -378,6 +378,12 @@ type(auto_diff_real_star_order1), pointer, dimension(:) :: & gradT_ad, Y_face_ad, gradr_ad, mlt_vc_ad, grada_face_ad, & gradL_ad, scale_height_ad, Lambda_ad, mlt_D_ad, mlt_Gamma_ad + logical, pointer :: have_mlt_tdc_face_state(:) + type(auto_diff_real_star_order1), pointer, dimension(:) :: & + mlt_tdc_T_face_ad, mlt_tdc_rho_face_ad, mlt_tdc_P_face_ad, & + mlt_tdc_Cp_face_ad, mlt_tdc_ChiRho_face_ad, mlt_tdc_ChiT_face_ad, & + mlt_tdc_grada_face_ad, mlt_tdc_opacity_face_ad, & + mlt_tdc_scale_height_face_ad, mlt_tdc_gradr_face_ad logical, pointer :: fixed_gradr_for_rest_of_solver_iters(:) @@ -386,6 +392,8 @@ type(auto_diff_real_star_order1), pointer, dimension(:) :: & PII_ad, Chi_ad, Eq_ad, COUPL_ad, Lr_ad, Lc_ad, Lt_ad + type(auto_diff_real_star_order1), pointer, dimension(:) :: & + tdc_Chi_div_w_face_ad, tdc_Eq_div_w_face_ad, tdc_Chi_div_w_cell_ad real(dp), pointer, dimension(:) :: & Ptrb, Pvsc, Pvsc_start, Hp_face, Y_face, Y_face_start, PII, Chi, Eq, Uq, & SOURCE, DAMP, DAMPR, COUPL, Lr, Lc, Lt, Lt_start @@ -812,6 +820,7 @@ real(dp), pointer :: lnd_start(:) ! (nz) real(dp), pointer :: Peos_start(:) ! (nz) real(dp), pointer :: Peos_face_start(:) ! (nz) + real(dp), pointer :: mlt_tdc_P_face_start(:) ! (nz) real(dp), pointer :: lnPeos_start(:) ! (nz) real(dp), pointer :: lnPgas_start(:) ! (nz) real(dp), pointer :: lnT_start(:) ! (nz) diff --git a/turb/private/tdc_support.f90 b/turb/private/tdc_support.f90 index 4eec995db..8615e3968 100644 --- a/turb/private/tdc_support.f90 +++ b/turb/private/tdc_support.f90 @@ -72,14 +72,69 @@ module tdc_support type tdc_info logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter logical :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split + logical :: use_TDC_enhanced_dissipation integer :: TDC_arnett_growth_target real(dp) :: mixing_length_alpha, TDC_alpha_C, TDC_alpha_S, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, e + real(dp) :: TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor type(auto_diff_real_tdc) :: A0, A_mlt, c0, L, L0, gradL, grada, Y_start - type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h, grav, chiT, chiRho + type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h, grav, chiT, chiRho, r end type tdc_info contains + ! Returns the dissipation length used in the Kuhfuss local-TDC damping term. + ! With the control on, this uses the Ahlborn/Kupka harmonic-sum length: + ! the geometric Wuchterl baseline for Y >= 0 and the stable-side reduced + ! length for Y < 0 using the lagged start-of-step convection speed scale. + type(auto_diff_real_tdc) function eval_tdc_dissipation_length(info, Y) result(Lambda_diss) + type(tdc_info), intent(in) :: info + type(auto_diff_real_tdc), intent(in) :: Y + type(auto_diff_real_tdc) :: Lambda0, Lambda_geom, radius, N2_loc, N_loc, a_quad, b_quad, v_lag + real(dp) :: v_floor + real(dp), parameter :: tiny_len = 1d-30 + real(dp), parameter :: tiny_speed = 1d-30 + + Lambda0 = convert(info%mixing_length_alpha*info%Hp) + if (.not. info%use_TDC_enhanced_dissipation) then + Lambda_diss = Lambda0 + return + end if + + radius = convert(info%r) + if (Lambda0%val <= tiny_len .or. radius%val <= tiny_len) then + Lambda_diss = Lambda0 + return + end if + + ! Source-model baseline in the convection zone: the Wuchterl harmonic sum + ! between the mixing length and the local radius. + Lambda_geom = 1d0/(1d0/Lambda0 + 1d0/radius) + + if (Y%val >= 0d0 .or. info%TDC_enhanced_dissipation_c4 <= 0d0) then + Lambda_diss = Lambda_geom + return + end if + + N2_loc = -Y*convert(info%chiT/info%chiRho*info%grav/info%Hp) + if (N2_loc%val <= 0d0) then + Lambda_diss = Lambda_geom + return + end if + + N_loc = sqrt(N2_loc) + v_floor = max(info%TDC_enhanced_dissipation_v_floor, tiny_speed) + v_lag = sqrt(pow2(info%A0) + pow2(v_floor)) + + a_quad = info%TDC_enhanced_dissipation_c4*N_loc/(v_lag*radius) + if (a_quad%val <= 0d0) then + Lambda_diss = Lambda_geom + return + end if + + b_quad = 1d0/Lambda0 + 1d0/radius + Lambda_diss = 2d0/(b_quad + sqrt(pow2(b_quad) + 4d0*a_quad)) + end function eval_tdc_dissipation_length + subroutine eval_Af_state(dt, A0, xi0, xi1, xi2, Af) type(auto_diff_real_tdc), intent(in) :: dt, A0, xi0, xi1, xi2 type(auto_diff_real_tdc), intent(out) :: Af @@ -666,7 +721,7 @@ subroutine eval_xis(info, Y, xi0, xi1, xi2) type(tdc_info), intent(in) :: info type(auto_diff_real_tdc), intent(in) :: Y type(auto_diff_real_tdc), intent(out) :: xi0, xi1, xi2 - type(auto_diff_real_tdc) :: S0, D0, DR0 + type(auto_diff_real_tdc) :: S0, D0, DR0, Lambda_diss type(auto_diff_real_star_order1) :: gammar_div_alfa, Pt0, dVdt type(auto_diff_real_tdc) :: X, FL, scale real(dp), parameter :: x_ALFAS = (1.d0/2.d0)*sqrt_2_div_3 @@ -701,7 +756,8 @@ subroutine eval_xis(info, Y, xi0, xi1, xi2) S0 = S0*Y + convert(info%Eq_div_w) end if - D0 = convert(info%TDC_alpha_D*x_CEDE/(info%mixing_length_alpha*info%Hp)) + Lambda_diss = eval_tdc_dissipation_length(info, Y) + D0 = info%TDC_alpha_D*x_CEDE/Lambda_diss gammar_div_alfa = info%TDC_alpha_R*x_GAMMAR/(info%mixing_length_alpha*info%Hp) DR0 = convert(4d0*boltz_sigma*pow2(gammar_div_alfa)*pow3(info%T)/(pow2(info%rho)*info%Cp*info%kap)) Pt0 = info%TDC_alpha_Pt*x_ALFAP*info%rho diff --git a/turb/public/turb.f90 b/turb/public/turb.f90 index c3620e4a1..9fb7c84fc 100644 --- a/turb/public/turb.f90 +++ b/turb/public/turb.f90 @@ -125,6 +125,13 @@ end subroutine set_thermohaline !! @param tdc_num_iters Number of iterations taken in the TDC solver. !! @param use_TDC_Af_split If true, use the split-step A_f closure when the start/end !! thermal states lie on opposite sides of Y = 0. + !! @param use_TDC_enhanced_dissipation If true, replace the baseline Kuhfuss + !! local-TDC dissipation length in xi2 by the Ahlborn/Kupka harmonic-sum + !! dissipation length. + !! @param TDC_enhanced_dissipation_c4 Stable-side dissipation-length coefficient + !! used in the Ahlborn/Kupka reduction factor. + !! @param TDC_enhanced_dissipation_v_floor Speed floor used with the lagged + !! start-of-step convective speed in the stable-side reduction factor. !! @param TDC_arnett_growth_target Unstable-side steady-state target for David Arnett's !! convection model in this implementation. !! @param ierr Tracks errors (output). @@ -134,6 +141,7 @@ subroutine set_TDC( & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, & max_conv_vel, Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, & TDC_alpha_S, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split, & + use_TDC_enhanced_dissipation, TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor, & TDC_arnett_growth_target, energy, ierr) use tdc use tdc_support @@ -143,8 +151,10 @@ subroutine set_TDC( & chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, scale_height, gradL, grada, Eq_div_w, grav, energy logical, intent(in) :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter logical, intent(in) :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split + logical, intent(in) :: use_TDC_enhanced_dissipation integer, intent(in) :: TDC_arnett_growth_target type(auto_diff_real_star_order1),intent(out) :: conv_vel, Y_face, gradT, D + real(dp), intent(in) :: TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor integer, intent(out) :: tdc_num_iters, mixing_type, ierr type(tdc_info) :: info type(auto_diff_real_star_order1) :: L, Lambda, Gamma @@ -170,11 +180,14 @@ subroutine set_TDC( & info%use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure info%use_TDC_acceleration_limit = use_TDC_acceleration_limit info%use_TDC_Af_split = use_TDC_Af_split + info%use_TDC_enhanced_dissipation = use_TDC_enhanced_dissipation info%TDC_arnett_growth_target = TDC_arnett_growth_target info%mixing_length_alpha = mixing_length_alpha info%TDC_alpha_D = TDC_alpha_D info%TDC_alpha_R = TDC_alpha_R info%TDC_alpha_Pt = TDC_alpha_Pt + info%TDC_enhanced_dissipation_c4 = TDC_enhanced_dissipation_c4 + info%TDC_enhanced_dissipation_v_floor = TDC_enhanced_dissipation_v_floor info%dt = dt info%L = convert(L) info%gradL = convert(gradL) @@ -187,6 +200,7 @@ subroutine set_TDC( & info%h = energy + P/rho ! actual enthalpy info%T = T info%rho = rho + info%r = r info%dV = dV info%Cp = Cp info%kap = opacity From 76bb863aa862f3b7f125eb3bb2e76670a6ae80bf Mon Sep 17 00:00:00 2001 From: Ebraheem Farag <63124736+Debraheem@users.noreply.github.com> Date: Mon, 27 Apr 2026 21:34:45 -0400 Subject: [PATCH 05/12] minor clean up --- turb/test/src/test_time_dependence_support.f90 | 3 ++- turb/test/src/test_turb.f90 | 6 ++++-- turb/test/test_output | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/turb/test/src/test_time_dependence_support.f90 b/turb/test/src/test_time_dependence_support.f90 index db348a743..c4302f6bc 100644 --- a/turb/test/src/test_time_dependence_support.f90 +++ b/turb/test/src/test_time_dependence_support.f90 @@ -773,7 +773,8 @@ subroutine call_tdc(case_data, mode, conv_vel_start, L_conv_start, dt, gradT, Y_ case_data%T, case_data%rho, case_data%dV, case_data%Cp, case_data%opacity, case_data%scale_height, & case_data%gradL, case_data%grada, conv_vel, D, Y_face, gradT, tdc_num_iters, case_data%max_conv_vel, & case_data%Eq_div_w, case_data%grav, mode%include_mlt_correction, case_data%TDC_alpha_C, case_data%TDC_alpha_S, & - case_data%use_TDC_enthalpy_flux_limiter, mode%use_arnett, mode%use_acceleration_limit, mode%use_Af_split, mode%growth_target, & + case_data%use_TDC_enthalpy_flux_limiter, mode%use_arnett, mode%use_acceleration_limit, mode%use_Af_split, & + .false., 0d0, 0d0, mode%growth_target, & case_data%energy, ierr) end subroutine call_tdc diff --git a/turb/test/src/test_turb.f90 b/turb/test/src/test_turb.f90 index d7940fd62..1f496eb1d 100644 --- a/turb/test/src/test_turb.f90 +++ b/turb/test/src/test_turb.f90 @@ -171,7 +171,8 @@ subroutine compare_TDC_and_Cox_MLT() mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), TDC_arnett_growth_target_mlt, energy, ierr) + tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), & + .false., 0d0, 0d0, TDC_arnett_growth_target_mlt, energy, ierr) write (*, '(a)') 'Mode: ' // trim(tdc_mode_names(mode_i)) write (*, 1) 'Y, conv_vel_start, conv_vel, dt', Y_face%val, conv_vel_start, conv_vel%val, dt end do @@ -240,7 +241,8 @@ subroutine check_TDC() mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), TDC_arnett_growth_target_mlt, energy, ierr) + tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), & + .false., 0d0, 0d0, TDC_arnett_growth_target_mlt, energy, ierr) write (*, 1) 'dt, gradT, conv_vel_start, conv_vel', dt, gradT%val, conv_vel_start, conv_vel%val if (report) stop diff --git a/turb/test/test_output b/turb/test/test_output index c858e00f4..aa71f6644 100644 --- a/turb/test/test_output +++ b/turb/test/test_output @@ -669,7 +669,7 @@ Convection model: tdc_with_acceleration_limit tau_phys[s] 5.1712339439846779E+04 -Carbon Burning +Carbon Burning Growth T[K] = 8.9448446840612292E+08 rho[g/cm^3] = 1.6585817351580659E+05 P[dyn/cm^2] = 8.7371150320499226E+21 L[erg/s] = 3.9705227734938969E+39 From ddb7500ab1f0b82a5716c63fce1a234e284cff01 Mon Sep 17 00:00:00 2001 From: Debraheem Date: Tue, 28 Apr 2026 19:43:43 -0400 Subject: [PATCH 06/12] clean up, remove remesh schemes --- star/defaults/controls_dev.defaults | 17 -- star/private/adjust_mesh_split_merge.f90 | 28 +--- star/private/ctrls_io.f90 | 3 - star/private/hydro_temperature.f90 | 18 +- star/private/mesh_adjust.f90 | 201 ++++------------------- star/private/turb_support.f90 | 2 +- star_data/private/star_controls_dev.inc | 1 - 7 files changed, 52 insertions(+), 218 deletions(-) diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 3cc21e254..411e6087a 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -301,23 +301,6 @@ TDC_enhanced_dissipation_v_floor = 1d0 - ! use_conservative_L_remesh - ! ~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! If use_conservative_L_remesh = .true., remesh luminosity by - ! conservatively remapping the cell-centered luminosity increment - ! dL/dq and then reconstructing face L from L_center. - ! - ! This applies to both the standard mesh-adjust path and the - ! split-AMR path. The default behavior remains the legacy direct - ! interpolation/averaging of face L. - ! Default = .false. keeps the old behavior. - - ! :: - - use_conservative_L_remesh = .false. - - ! use_face_values_eos_and_kap_mlt_tdc ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/star/private/adjust_mesh_split_merge.f90 b/star/private/adjust_mesh_split_merge.f90 index 58b4ec6c7..e8f3bbe10 100644 --- a/star/private/adjust_mesh_split_merge.f90 +++ b/star/private/adjust_mesh_split_merge.f90 @@ -20,7 +20,7 @@ module adjust_mesh_split_merge use star_private_def - use const_def, only: dp, qp, ln10, pi4, four_thirds_pi + use const_def, only: dp, ln10, pi4, four_thirds_pi use chem_def, only: ih1, ihe3, ihe4 use utils_lib use auto_diff_support @@ -832,7 +832,6 @@ subroutine do_split(s, i_split, species, tau_center, grad_xa, new_xa, ierr) grad_alpha, f, new_alphaL, new_alphaR, v_R, v_C, v_L, min_dm, & mlt_vcL, mlt_vcR, tauL, tauR, etrb, etrb_L, etrb_C, etrb_R, grad_etrb, & j_rot_new, dmbar_old, dmbar_p1_old, dmbar_new, dmbar_p1_new, dmbar_p2_new, J_old - real(qp) :: L_inner, dLdq_parent logical :: done, use_new_grad_rho include 'formats' @@ -1282,27 +1281,12 @@ subroutine do_split(s, i_split, species, tau_center, grad_xa, new_xa, ierr) end if if (s% i_lum /= 0) then - ! Keep the legacy split-face average unless the conservative L remap - ! option is enabled. - if (.not. s% use_conservative_L_remesh) then - if (ip < nz_old) then - s% xh(s% i_lum,ip) = & - 0.5d0*(s% xh(s% i_lum,i) + s% xh(s% i_lum,ip+1)) - else - s% xh(s% i_lum,ip) = & - 0.5d0*(s% xh(s% i_lum,i) + s% L_center) - end if + if (ip < nz_old) then + s% xh(s% i_lum,ip) = & + 0.5d0*(s% xh(s% i_lum,i) + s% xh(s% i_lum,ip+1)) else - if (ip < nz_old) then - L_inner = real(s% xh(s% i_lum,ip+1), qp) - else - L_inner = real(s% L_center, qp) - end if - ! Preserve the parent cell luminosity increment across the two - ! child cells instead of inserting the new face by averaging. - dLdq_parent = (real(s% xh(s% i_lum,i), qp) - L_inner)/ & - real(s% dq(i) + s% dq(ip), qp) - s% xh(s% i_lum,ip) = real(L_inner + dLdq_parent*real(s% dq(ip), qp), dp) + s% xh(s% i_lum,ip) = & + 0.5d0*(s% xh(s% i_lum,i) + s% L_center) end if end if diff --git a/star/private/ctrls_io.f90 b/star/private/ctrls_io.f90 index 20c440716..c785ec30b 100644 --- a/star/private/ctrls_io.f90 +++ b/star/private/ctrls_io.f90 @@ -114,7 +114,6 @@ module ctrls_io include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, & TDC_arnett_growth_target, use_TDC_acceleration_limit, use_TDC_Af_split, & use_TDC_enhanced_dissipation, TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor, & - use_conservative_L_remesh, & use_face_values_eos_and_kap_mlt_tdc, & TDC_include_eturb_in_energy_equation, & use_rsp_form_of_scale_height, include_mlt_in_velocity_time_centering, & @@ -2109,7 +2108,6 @@ subroutine store_controls(s, ierr) s% use_TDC_enhanced_dissipation = use_TDC_enhanced_dissipation s% TDC_enhanced_dissipation_c4 = TDC_enhanced_dissipation_c4 s% TDC_enhanced_dissipation_v_floor = TDC_enhanced_dissipation_v_floor - s% use_conservative_L_remesh = use_conservative_L_remesh s% use_face_values_eos_and_kap_mlt_tdc = use_face_values_eos_and_kap_mlt_tdc s% TDC_include_eturb_in_energy_equation = TDC_include_eturb_in_energy_equation s% use_rsp_form_of_scale_height = use_rsp_form_of_scale_height @@ -3829,7 +3827,6 @@ subroutine set_controls_for_writing(s, ierr) use_TDC_enhanced_dissipation = s% use_TDC_enhanced_dissipation TDC_enhanced_dissipation_c4 = s% TDC_enhanced_dissipation_c4 TDC_enhanced_dissipation_v_floor = s% TDC_enhanced_dissipation_v_floor - use_conservative_L_remesh = s% use_conservative_L_remesh use_face_values_eos_and_kap_mlt_tdc = s% use_face_values_eos_and_kap_mlt_tdc TDC_include_eturb_in_energy_equation = s% TDC_include_eturb_in_energy_equation use_rsp_form_of_scale_height = s% use_rsp_form_of_scale_height diff --git a/star/private/hydro_temperature.f90 b/star/private/hydro_temperature.f90 index c7f1e6c00..c6f15a31b 100644 --- a/star/private/hydro_temperature.f90 +++ b/star/private/hydro_temperature.f90 @@ -408,7 +408,7 @@ subroutine eval_dlnPdm_qhse(s, k, & ! calculate the expected dlnPdm for HSE type(auto_diff_real_star_order1), intent(out) :: dlnPdm_qhse, Ppoint integer, intent(out) :: ierr - real(dp) :: alfa + real(dp) :: alfa, P_theta type(auto_diff_real_star_order1) :: grav, area, P00, Pm1, inv_R2, mlt_Ptrb00, mlt_Ptrbm1, mlt_Ptrb_face type(auto_diff_real_star_order1) :: T_face, rho_face, P_face, Cp_face, ChiRho_face, ChiT_face, grada_face, opacity_face include 'formats' @@ -421,6 +421,14 @@ subroutine eval_dlnPdm_qhse(s, k, & ! calculate the expected dlnPdm for HSE ! for rotation, multiply gravity by factor fp. MESA 2, eqn 22. call expected_HSE_grav_term(s, k, grav, area, ierr) ! note that expected_HSE_grav_term is negative + if (s% using_velocity_time_centering .and. & + s% include_P_in_velocity_time_centering .and. & + s% lnT(k)/ln10 <= s% max_logT_for_include_P_and_L_in_velocity_time_centering) then + P_theta = s% P_theta_for_velocity_time_centering + else + P_theta = 1d0 + end if + if (s% use_face_values_eos_and_kap_mlt_tdc) then if (s% have_mlt_tdc_face_state(k)) then rho_face = s% mlt_tdc_rho_face_ad(k) @@ -431,8 +439,8 @@ subroutine eval_dlnPdm_qhse(s, k, & ! calculate the expected dlnPdm for HSE if (ierr /= 0) return Ppoint = P_face end if - if (s% using_velocity_time_centering) then - Ppoint = 0.5d0*(Ppoint + s% mlt_tdc_P_face_start(k)) + if (P_theta /= 1d0) then + Ppoint = P_theta*Ppoint + (1d0 - P_theta)*s% mlt_tdc_P_face_start(k) end if if ((s% have_mlt_vc .and. s% okay_to_set_mlt_vc) .and. s% include_mlt_Pturb_in_thermodynamic_gradients & .and. s% mlt_Pturb_factor > 0d0) then @@ -461,14 +469,14 @@ subroutine eval_dlnPdm_qhse(s, k, & ! calculate the expected dlnPdm for HSE P00 = wrap_Peos_00(s,k) ! mlt Pturb doesn't support time centering yet. - if (s% using_velocity_time_centering) P00 = 0.5d0*(P00 + s% Peos_start(k)) + if (P_theta /= 1d0) P00 = P_theta*P00 + (1d0 - P_theta)*s% Peos_start(k) if (k == 1) then Pm1 = 0d0 Ppoint = P00 + mlt_Ptrb00 else Pm1 = wrap_Peos_m1(s,k) - if (s% using_velocity_time_centering) Pm1 = 0.5d0*(Pm1 + s% Peos_start(k-1)) ! pm1 wasn't time centered until now + if (P_theta /= 1d0) Pm1 = P_theta*Pm1 + (1d0 - P_theta)*s% Peos_start(k-1) Pm1 = Pm1 + mlt_Ptrbm1 ! include mlt Ptrb in k-1 P00 = P00 + mlt_Ptrb00 ! include mlt Ptrb in k alfa = s% dq(k-1)/(s% dq(k-1) + s% dq(k)) diff --git a/star/private/mesh_adjust.f90 b/star/private/mesh_adjust.f90 index 7cae5b44f..ed8d363c1 100644 --- a/star/private/mesh_adjust.f90 +++ b/star/private/mesh_adjust.f90 @@ -19,7 +19,7 @@ module mesh_adjust - use const_def, only: dp, qp, ln10, one_third, four_thirds_pi + use const_def, only: dp, ln10, one_third, four_thirds_pi use star_private_def use chem_def use interp_1d_def, only: pm_work_size @@ -170,7 +170,7 @@ subroutine do_mesh_adjust( & if (dbg) write(*,*) 'call do_L' call do_L( & s, nz, nz_old, nzlo, nzhi, comes_from, & - xh, xh_old, dq, dq_old, xq, xq_old_plus1, xq_new, & + xh, xh_old, xq, xq_old_plus1, xq_new, & work, tmp1, tmp2, ierr) if (failed('do_L')) return @@ -697,7 +697,7 @@ end subroutine do_xh_pt_var subroutine do_L( & s, nz, nz_old, nzlo, nzhi, comes_from, xh, xh_old, & - dq, dq_old, xq, xq_old_plus1, xq_new, work, old_dLdq, new_dLdq, ierr) + xq, xq_old_plus1, xq_new, work, L_old_plus1, L_new, ierr) use interp_1d_def use interp_1d_lib type (star_info), pointer :: s @@ -705,11 +705,10 @@ subroutine do_L( & real(dp), dimension(:,:), pointer :: xh, xh_old real(dp), dimension(:), pointer :: work real(dp), dimension(:) :: & - dq, dq_old, xq, xq_old_plus1, old_dLdq, new_dLdq, xq_new + xq, xq_old_plus1, L_old_plus1, L_new, xq_new integer, intent(out) :: ierr - integer :: n, i_lum, k, k_old - real(qp) :: dLdq_integral, L_face + integer :: n, i_lum, k include 'formats' @@ -717,84 +716,42 @@ subroutine do_L( & i_lum = s% i_lum if (i_lum == 0) return - ! Preserve the historical face-L remap unless the new option is enabled. - if (.not. s% use_conservative_L_remesh) then - n = nzhi - nzlo + 1 - - do k=1,nz_old - old_dLdq(k) = xh_old(i_lum,k) - end do - old_dLdq(nz_old+1) = s% L_center - - call interpolate_vector( & - nz_old+1, xq_old_plus1, n, xq_new, & - old_dLdq, new_dLdq, interp_pm, nwork, work, & - 'mesh_adjust do_L', ierr) - if (ierr /= 0) then - return - - write(*,*) 'interpolate_vector failed in do_L for remesh' - call mesa_error(__FILE__,__LINE__,'debug: mesh adjust: do_L') - end if - - do k=nzlo,nzhi - xh(i_lum,k) = new_dLdq(k+1-nzlo) - end do - - n = nzlo - 1 - if (n > 0) then - do k=1,n - xh(i_lum,k) = xh_old(i_lum,k) - end do - end if + n = nzhi - nzlo + 1 - if (nzhi < nz) then - n = nz - nzhi - 1 ! nz-n = nzhi+1 - do k=0,n - xh(i_lum,nz-k) = xh_old(i_lum,nz_old-k) - end do - end if + do k=1,nz_old + L_old_plus1(k) = xh_old(i_lum,k) + end do + L_old_plus1(nz_old+1) = s% L_center + call interpolate_vector( & + nz_old+1, xq_old_plus1, n, xq_new, & + L_old_plus1, L_new, interp_pm, nwork, work, & + 'mesh_adjust do_L', ierr) + if (ierr /= 0) then return + + write(*,*) 'interpolate_vector failed in do_L for remesh' + call mesa_error(__FILE__,__LINE__,'debug: mesh adjust: do_L') end if - ! Conservative option: remap the cell quantity dL/dq, then rebuild the - ! cumulative face luminosity profile from the center outward. - do k=1,nz_old - if (k < nz_old) then - old_dLdq(k) = (xh_old(i_lum,k) - xh_old(i_lum,k+1))/dq_old(k) - else - old_dLdq(k) = (xh_old(i_lum,k) - s% L_center)/dq_old(k) - end if + do k=nzlo,nzhi + xh(i_lum,k) = L_new(k+1-nzlo) end do - do k=1,nz - k_old = comes_from(k) - if (k_old < 1 .or. k_old > nz_old) then - ierr = -1 - return - end if - new_dLdq(k) = old_dLdq(k_old) - end do + n = nzlo - 1 + if (n > 0) then + do k=1,n + xh(i_lum,k) = xh_old(i_lum,k) + end do + end if - do k=nzlo,nzhi - k_old = comes_from(k) - if (k_old < 1 .or. k_old > nz_old) then - ierr = -1 - return - end if - call get_old_value_integral_qp( & - k, k_old, nz_old, xq_old_plus1, dq_old, xq(k), dq(k), & - old_dLdq, dLdq_integral, dbg, ierr) - if (ierr /= 0) return - new_dLdq(k) = real(dLdq_integral/real(dq(k),qp), dp) - end do + if (nzhi < nz) then + n = nz - nzhi - 1 ! nz-n = nzhi+1 + do k=0,n + xh(i_lum,nz-k) = xh_old(i_lum,nz_old-k) + end do + end if - L_face = real(s% L_center, qp) - do k=nz,1,-1 - L_face = L_face + real(new_dLdq(k),qp)*real(dq(k),qp) - xh(i_lum,k) = real(L_face, dp) - end do end subroutine do_L @@ -1571,100 +1528,6 @@ subroutine get_old_value_integral( & value_old, p, integral, dbg, ierr) end subroutine get_old_value_integral - - subroutine get_old_value_integral_qp( & - k_new, k_old_in, nz_old, xq_old, dq_old, xq_outer, dq_range, & - value_old, integral, dbg, ierr) - integer, intent(in) :: k_new, k_old_in, nz_old - real(dp), intent(in) :: xq_old(:), dq_old(:), xq_outer, dq_range - real(dp), intent(in), dimension(:) :: value_old - real(qp), intent(out) :: integral - logical, intent(in) :: dbg - integer, intent(out) :: ierr - - integer :: k, k_old - real(qp) :: xq_inner, sum_dqs, old_xq_outer, old_xq_inner, & - dq_overlap, val, xq_outer_qp, dq_range_qp - - include 'formats' - - ! Use qp for the overlap geometry and accumulation because sign-changing - ! luminosity shells can make the reconstructed face L a small residual. - ierr = 0 - k_old = k_old_in - xq_outer_qp = real(xq_outer, qp) - dq_range_qp = real(dq_range, qp) - - do - if (k_old <= 1) exit - if (xq_old(k_old) <= xq_outer) exit - k_old = k_old - 1 - end do - - xq_inner = xq_outer_qp + dq_range_qp - old_xq_inner = real(xq_old(k_old), qp) - sum_dqs = 0.0_qp - integral = 0.0_qp - - if (dbg) write(*,*) - if (dbg) write(*,3) 'k_new k_old xq_outer xq_inner dq_range', & - k_new, k_old, xq_outer_qp, xq_inner, dq_range_qp - - do k = k_old, nz_old - - if (dq_range_qp <= sum_dqs) exit - old_xq_outer = old_xq_inner - if (k == nz_old) then - old_xq_inner = 1.0_qp - else - old_xq_inner = real(xq_old(k+1), qp) - end if - - if (dbg) write(*,3) 'k_new k_old old_xq_outer old_xq_inner', & - k_new, k, old_xq_outer, old_xq_inner - - val = real(value_old(k), qp) - - if (old_xq_inner <= xq_inner .and. old_xq_outer >= xq_outer_qp) then - - if (dbg) write(*,1) 'entire old cell is in new range' - - sum_dqs = sum_dqs + real(dq_old(k), qp) - integral = integral + val*real(dq_old(k), qp) - - else if (old_xq_inner >= xq_inner .and. old_xq_outer <= xq_outer_qp) then - - if (dbg) write(*,1) 'entire new range is in this old cell' - - sum_dqs = dq_range_qp - integral = val*dq_range_qp - - else - - if (xq_inner <= old_xq_inner) then - - if (dbg) write(*,1) 'last part of the new range' - - integral = integral + val*(dq_range_qp - sum_dqs) - sum_dqs = dq_range_qp - - else - - dq_overlap = max(0.0_qp, old_xq_inner - xq_outer_qp) - sum_dqs = sum_dqs + dq_overlap - integral = integral + val*dq_overlap - - if (dbg) write(*,1) 'partial overlap' - - end if - - end if - - end do - - end subroutine get_old_value_integral_qp - - subroutine get_old_integral( & k_new, k_old_in, nz_old, xq_old, dq_old, xq_outer, dq_range, & value_old, xh_old, integral, dbg, ierr) diff --git a/star/private/turb_support.f90 b/star/private/turb_support.f90 index aa4badc64..522f06158 100644 --- a/star/private/turb_support.f90 +++ b/star/private/turb_support.f90 @@ -50,7 +50,7 @@ logical function check_if_must_fall_back_to_MLT(s, k) result(fallback) integer, intent(in) :: k fallback = .false. - if (abs(s%mstar_dot) > 1d-99 .and. k < s% k_const_mass) then + if (s%mstar_dot > 1d-99 .and. k < s% k_const_mass) then fallback = .true. end if end function check_if_must_fall_back_to_MLT diff --git a/star_data/private/star_controls_dev.inc b/star_data/private/star_controls_dev.inc index fdd602f2c..f3bbe27b1 100644 --- a/star_data/private/star_controls_dev.inc +++ b/star_data/private/star_controls_dev.inc @@ -8,7 +8,6 @@ logical :: use_TDC_acceleration_limit logical :: use_TDC_Af_split logical :: use_TDC_enhanced_dissipation - logical :: use_conservative_L_remesh logical :: use_face_values_eos_and_kap_mlt_tdc integer :: TDC_arnett_growth_target logical :: include_mlt_in_velocity_time_centering From 86da93e07ea3debded1ea98ee47f71400593eb6e Mon Sep 17 00:00:00 2001 From: Debraheem Date: Mon, 4 May 2026 13:09:34 -0400 Subject: [PATCH 07/12] clean up, remove unusued controls --- star/defaults/controls_dev.defaults | 73 ++---- star/private/ctrls_io.f90 | 17 +- star/private/turb_support.f90 | 44 ++-- star_data/private/star_controls_dev.inc | 6 +- turb/private/tdc.f90 | 229 +++++++++++------- turb/private/tdc_support.f90 | 122 +--------- turb/public/turb.f90 | 64 ++--- .../test/src/test_time_dependence_support.f90 | 26 +- turb/test/src/test_turb.f90 | 17 +- turb/test/test_output | 150 ------------ 10 files changed, 266 insertions(+), 482 deletions(-) diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 411e6087a..6c43038e8 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -189,6 +189,20 @@ TDC_use_density_form_for_eddy_viscosity = .false. + ! TDC_adjust_mass_fallback_to_mlt + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! If TDC_adjust_mass_fallback_to_mlt = .true., use MLT instead of TDC + ! in cells touched by adjust_mass. This preserves the historical fallback + ! for cells where start-of-step convective velocities may be inconsistent + ! with the adjusted mass grid. If false, TDC is used there with the usual + ! start-of-step TDC quantities. + + ! :: + + TDC_adjust_mass_fallback_to_mlt = .true. + + ! use_TDC_enthalpy_flux_limiter ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -245,60 +259,21 @@ use_TDC_acceleration_limit = .false. - ! use_TDC_Af_split - ! ~~~~~~~~~~~~~~~~ - - ! If use_TDC_Af_split = .true., use a split-step closure for the TDC - ! convective velocity when the start-of-step and end-of-step thermal states - ! lie on opposite sides of Y = gradT - gradL = 0. - ! - ! This keeps the TDC solve implicit in the end-of-step Y, but changes the - ! A_f(Y) closure so that late stabilization and late destabilization do not - ! use one branch over the full timestep. - - ! :: - - use_TDC_Af_split = .false. - - - ! use_TDC_enhanced_dissipation + ! use_TDC_Y_face_seeded_newton ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ! If use_TDC_enhanced_dissipation = .true., replace the baseline Kuhfuss - ! local-TDC dissipation length in the xi2 damping term by a reduced - ! dissipation length following the Ahlborn/Kupka harmonic-sum correction. - ! - ! This change applies only to the Kuhfuss local-TDC closure. It does not - ! modify the optional Arnett velocity closure. - - ! :: - - use_TDC_enhanced_dissipation = .false. - - - ! TDC_enhanced_dissipation_c4 - ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! Effective stable-side dissipation-length coefficient c4 used in the - ! Ahlborn/Kupka reduction factor for the Kuhfuss local-TDC dissipation - ! length. Larger values give a shorter dissipation length in stable - ! regions and therefore stronger damping. - - ! :: - - TDC_enhanced_dissipation_c4 = 0.072d0 - - - ! TDC_enhanced_dissipation_v_floor - ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! Speed floor in cm s^-1 used together with the lagged start-of-step - ! convective speed when evaluating the Ahlborn/Kupka stable-side - ! dissipation-length correction for local TDC. + ! If use_TDC_Y_face_seeded_newton = .true., use the start-of-step TDC + ! Y_face on the first solver iteration, and the previous solver + ! iteration's TDC Y_face thereafter, to try a small local bracket before + ! the usual bracketing path on the positive-Y branch. The seed is only + ! used during structural solver iterations, and only seeds the end-of-step + ! luminosity-balance solve if a small window around the guess brackets the + ! current root. The negative-Y branch always uses the bracketing path + ! because its bracketing logic is part of root selection. ! :: - TDC_enhanced_dissipation_v_floor = 1d0 + use_TDC_Y_face_seeded_newton = .false. ! use_face_values_eos_and_kap_mlt_tdc diff --git a/star/private/ctrls_io.f90 b/star/private/ctrls_io.f90 index c785ec30b..b32980f06 100644 --- a/star/private/ctrls_io.f90 +++ b/star/private/ctrls_io.f90 @@ -108,12 +108,11 @@ module ctrls_io TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, TDC_alpha_M, & TDC_alpha_C, TDC_alpha_S, & TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation, & - TDC_use_density_form_for_eddy_viscosity, & + TDC_use_density_form_for_eddy_viscosity, TDC_adjust_mass_fallback_to_mlt, & TDC_num_innermost_cells_forced_nonturbulent, TDC_num_outermost_cells_forced_nonturbulent, & include_mlt_Pturb_in_thermodynamic_gradients, & include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, & - TDC_arnett_growth_target, use_TDC_acceleration_limit, use_TDC_Af_split, & - use_TDC_enhanced_dissipation, TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor, & + TDC_arnett_growth_target, use_TDC_acceleration_limit, use_TDC_Y_face_seeded_newton, & use_face_values_eos_and_kap_mlt_tdc, & TDC_include_eturb_in_energy_equation, & use_rsp_form_of_scale_height, include_mlt_in_velocity_time_centering, & @@ -2096,6 +2095,7 @@ subroutine store_controls(s, ierr) s% TDC_alpha_S = TDC_alpha_S s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation = TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation s% TDC_use_density_form_for_eddy_viscosity = TDC_use_density_form_for_eddy_viscosity + s% TDC_adjust_mass_fallback_to_mlt = TDC_adjust_mass_fallback_to_mlt s% TDC_num_innermost_cells_forced_nonturbulent = TDC_num_innermost_cells_forced_nonturbulent s% TDC_num_outermost_cells_forced_nonturbulent = TDC_num_outermost_cells_forced_nonturbulent s% include_mlt_Pturb_in_thermodynamic_gradients = include_mlt_Pturb_in_thermodynamic_gradients @@ -2104,10 +2104,7 @@ subroutine store_controls(s, ierr) s% use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure s% TDC_arnett_growth_target = TDC_arnett_growth_target s% use_TDC_acceleration_limit = use_TDC_acceleration_limit - s% use_TDC_Af_split = use_TDC_Af_split - s% use_TDC_enhanced_dissipation = use_TDC_enhanced_dissipation - s% TDC_enhanced_dissipation_c4 = TDC_enhanced_dissipation_c4 - s% TDC_enhanced_dissipation_v_floor = TDC_enhanced_dissipation_v_floor + s% use_TDC_Y_face_seeded_newton = use_TDC_Y_face_seeded_newton s% use_face_values_eos_and_kap_mlt_tdc = use_face_values_eos_and_kap_mlt_tdc s% TDC_include_eturb_in_energy_equation = TDC_include_eturb_in_energy_equation s% use_rsp_form_of_scale_height = use_rsp_form_of_scale_height @@ -3815,6 +3812,7 @@ subroutine set_controls_for_writing(s, ierr) TDC_alpha_S = s% TDC_alpha_S TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation = s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation TDC_use_density_form_for_eddy_viscosity = s% TDC_use_density_form_for_eddy_viscosity + TDC_adjust_mass_fallback_to_mlt = s% TDC_adjust_mass_fallback_to_mlt TDC_num_innermost_cells_forced_nonturbulent = s% TDC_num_innermost_cells_forced_nonturbulent TDC_num_outermost_cells_forced_nonturbulent = s% TDC_num_outermost_cells_forced_nonturbulent include_mlt_Pturb_in_thermodynamic_gradients = s% include_mlt_Pturb_in_thermodynamic_gradients @@ -3823,10 +3821,7 @@ subroutine set_controls_for_writing(s, ierr) use_TDC_arnett_velocity_closure = s% use_TDC_arnett_velocity_closure TDC_arnett_growth_target = s% TDC_arnett_growth_target use_TDC_acceleration_limit = s% use_TDC_acceleration_limit - use_TDC_Af_split = s% use_TDC_Af_split - use_TDC_enhanced_dissipation = s% use_TDC_enhanced_dissipation - TDC_enhanced_dissipation_c4 = s% TDC_enhanced_dissipation_c4 - TDC_enhanced_dissipation_v_floor = s% TDC_enhanced_dissipation_v_floor + use_TDC_Y_face_seeded_newton = s% use_TDC_Y_face_seeded_newton use_face_values_eos_and_kap_mlt_tdc = s% use_face_values_eos_and_kap_mlt_tdc TDC_include_eturb_in_energy_equation = s% TDC_include_eturb_in_energy_equation use_rsp_form_of_scale_height = s% use_rsp_form_of_scale_height diff --git a/star/private/turb_support.f90 b/star/private/turb_support.f90 index 522f06158..87002a659 100644 --- a/star/private/turb_support.f90 +++ b/star/private/turb_support.f90 @@ -38,9 +38,9 @@ module turb_support !> Determines if it is safe (physically) to use TDC instead of MLT. !! - !! Currently we only know we have to fall back to MLT in cells that get touched - !! by adjust_mass, because there the convection speeds at the start of the - !! step can be badly out of whack. + !! By default, fall back to MLT in cells that get touched by adjust_mass, + !! because there the convection speeds at the start of the step can be + !! badly out of whack. !! !! @param s star pointer !! @param k face index @@ -50,7 +50,7 @@ logical function check_if_must_fall_back_to_MLT(s, k) result(fallback) integer, intent(in) :: k fallback = .false. - if (s%mstar_dot > 1d-99 .and. k < s% k_const_mass) then + if (s% TDC_adjust_mass_fallback_to_mlt .and. s%mstar_dot > 1d-99 .and. k < s% k_const_mass) then fallback = .true. end if end function check_if_must_fall_back_to_MLT @@ -223,13 +223,13 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg integer, intent(out) :: ierr type(auto_diff_real_star_order1) :: Pr, Pg, grav, Lambda, gradL, beta - real(dp) :: conv_vel_start, scale, max_conv_vel + real(dp) :: conv_vel_start, scale, max_conv_vel, Y_face_guess ! these are used by use_superad_reduction real(dp) :: Gamma_limit, scale_value1, scale_value2, diff_grads_limit, reduction_limit, lambda_limit type(auto_diff_real_star_order1) :: Lrad_div_Ledd, Gamma_inv_threshold, Gamma_factor, alfa0, & diff_grads_factor, Gamma_term, exp_limit, grad_scale, gradr_scaled, Eq_div_w, check_Eq, mlt_Pturb, Ptot - logical :: test_partials, using_TDC, report + logical :: test_partials, using_TDC, report, have_Y_face_guess include 'formats' ! check if this particular k can be done with TDC @@ -324,6 +324,16 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg else conv_vel_start = s% mlt_vc(k) end if + have_Y_face_guess = s% use_TDC_Y_face_seeded_newton .and. s% doing_solver_iterations + if (have_Y_face_guess) then + if (s% solver_iter == 0) then + Y_face_guess = s% Y_face_start(k) + else + Y_face_guess = s% Y_face(k) + end if + else + Y_face_guess = 0d0 + end if ! Set scale for judging the TDC luminosity equation Q(Y)=0. ! Q has units of a luminosity, so the scale should be a luminosity. if (s% solver_iter == 0) then @@ -339,16 +349,15 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & - s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, & - s% use_TDC_enhanced_dissipation, s% TDC_enhanced_dissipation_c4, s% TDC_enhanced_dissipation_v_floor, & + s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, & s% TDC_arnett_growth_target, & - energy, ierr) - s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt + energy, ierr, have_Y_face_guess, Y_face_guess) - if (ierr /= 0) then - if (s% report_ierr) write(*,*) 'ierr from set_TDC' - return - end if + if (ierr /= 0) then + if (s% report_ierr) write(*,*) 'ierr from set_TDC' + return + end if + s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt ! Experimental method to lower superadiabaticity. Call TDC again with an artificially reduced ! gradr if the resulting gradT would lead to the radiative luminosity approaching the Eddington @@ -364,15 +373,14 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & - s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, s% use_TDC_Af_split, & - s% use_TDC_enhanced_dissipation, s% TDC_enhanced_dissipation_c4, s% TDC_enhanced_dissipation_v_floor, & + s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, & s% TDC_arnett_growth_target, & - energy, ierr) - s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt + energy, ierr, have_Y_face_guess, Y_face_guess) if (ierr /= 0) then if (s% report_ierr) write(*,*) 'ierr from set_TDC when using superad_reduction' return end if + s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt end if end if diff --git a/star_data/private/star_controls_dev.inc b/star_data/private/star_controls_dev.inc index f3bbe27b1..2e6969b78 100644 --- a/star_data/private/star_controls_dev.inc +++ b/star_data/private/star_controls_dev.inc @@ -2,18 +2,16 @@ logical :: compare_TDC_to_MLT logical :: TDC_use_density_form_for_eddy_viscosity + logical :: TDC_adjust_mass_fallback_to_mlt logical :: include_mlt_Pturb_in_thermodynamic_gradients logical :: use_TDC_enthalpy_flux_limiter logical :: use_TDC_arnett_velocity_closure logical :: use_TDC_acceleration_limit - logical :: use_TDC_Af_split - logical :: use_TDC_enhanced_dissipation + logical :: use_TDC_Y_face_seeded_newton logical :: use_face_values_eos_and_kap_mlt_tdc integer :: TDC_arnett_growth_target logical :: include_mlt_in_velocity_time_centering logical :: use_hydro_merge_limits_in_mesh_plan - real(dp) :: TDC_enhanced_dissipation_c4 - real(dp) :: TDC_enhanced_dissipation_v_floor real(dp) :: RSP2_Lsurf_factor real(dp) :: RSP2_alfap diff --git a/turb/private/tdc.f90 b/turb/private/tdc.f90 index e4d61cb0a..377ed61aa 100644 --- a/turb/private/tdc.f90 +++ b/turb/private/tdc.f90 @@ -47,12 +47,17 @@ module tdc !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. !! @param ierr Tracks errors (output). - subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr) + !! @param have_Y_face_guess If true, use Y_face_guess to try a small local positive-Y bracket. + !! @param Y_face_guess Candidate superadiabaticity for the local solve. + subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr, & + have_Y_face_guess, Y_face_guess) type(tdc_info), intent(in) :: info real(dp), intent(in) :: scale type(auto_diff_real_tdc), intent(in) :: Zlb, Zub type(auto_diff_real_star_order1),intent(out) :: conv_vel, Y_face integer, intent(out) :: tdc_num_iters, ierr + logical, intent(in), optional :: have_Y_face_guess + real(dp), intent(in), optional :: Y_face_guess logical :: Y_is_positive type(auto_diff_real_tdc) :: Af, Y, Y0, Y1, Z0, Z1, radY @@ -95,9 +100,10 @@ subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_ite ! Start down the chain of logic... if (Y_is_positive) then ! If Y > 0 then Q(Y) is monotone and we can jump straight to the search. - call bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr) - Y = convert(Y_face) + call bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr, & + have_Y_face_guess, Y_face_guess) if (ierr /= 0) return + Y = convert(Y_face) if (info%report) write(*,*) 'Y is positive, Y=',Y_face%val else if (info%report) write(*,*) 'Y is negative.' @@ -228,7 +234,10 @@ end subroutine get_TDC_solution !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. !! @param ierr Tracks errors (output). - subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr) + !! @param have_Y_face_guess If true, use Y_face_guess to try a small local positive-Y bracket. + !! @param Y_face_guess Candidate superadiabaticity for the local solve. + subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr, & + have_Y_face_guess, Y_face_guess) type(tdc_info), intent(in) :: info logical, intent(in) :: Y_is_positive real(dp), intent(in) :: scale @@ -237,117 +246,163 @@ subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_fa type(auto_diff_real_tdc), intent(out) :: Af integer, intent(out) :: tdc_num_iters integer, intent(out) :: ierr + logical, intent(in), optional :: have_Y_face_guess + real(dp), intent(in), optional :: Y_face_guess - type(auto_diff_real_tdc) :: Y, Z, Q, Qc, Z_new, correction, lower_bound_Z, upper_bound_Z + type(auto_diff_real_tdc) :: Y, Z, Q, Qc, Q_lb, Q_ub, Z_new, correction, lower_bound_Z, upper_bound_Z, & + Z_seed, Z_seed_lb, Z_seed_ub type(auto_diff_real_tdc) :: dQdZ - integer :: iter, line_iter - logical :: converged, have_derivatives, corr_has_derivatives + integer :: iter, line_iter, i_try, num_tries + logical :: converged, have_derivatives, corr_has_derivatives, use_seed, doing_seed, bad_seed_bracket real(dp), parameter :: correction_tolerance = 1d-13 real(dp), parameter :: residual_tolerance = 1d-8 + real(dp), parameter :: seed_bracket_half_width = 3d0 integer, parameter :: max_iter = 200 integer, parameter :: max_line_search_iter = 5 include 'formats' ierr = 0 - - ! We start by bisecting to find a narrow interval around the root. - lower_bound_Z = Zlb - upper_bound_Z = Zub - - ! Perform bisection search. - call Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Z, ierr) - if (ierr /= 0) return - - ! Set up Z from bisection search - Z%d1val1 = 1d0 ! Set derivative dZ/dZ=1 for Newton iterations. - if (info%report) write(*,*) 'Z from bisection search', Z%val - if (info%report) write(*,*) 'lower_bound_Z, upper_bound_Z',lower_bound_Z%val,upper_bound_Z%val - - ! Now we refine the solution with a Newton solve. - ! This also let's us pick up the derivative of the solution with respect to input parameters. - - ! Initialize starting values for TDC Newton iterations. - dQdz = 0d0 - converged = .false. - have_derivatives = .false. ! Tracks if we've done at least one Newton iteration. - ! Need to do this before returning to endow Y with partials - ! with respect to the structure variables. - do iter = 1, max_iter - Y = set_Y(Y_is_positive, Z) - call compute_Q(info, Y, Q, Af) - - if (abs(Q%val)/scale <= residual_tolerance .and. have_derivatives) then - ! Can't exit on the first iteration, otherwise we have no derivative information. - if (info%report) write(*,2) 'converged', iter, abs(Q%val)/scale, residual_tolerance - converged = .true. - exit + use_seed = .false. + if (Y_is_positive .and. present(have_Y_face_guess) .and. present(Y_face_guess)) then + if (have_Y_face_guess .and. .not. is_bad(Y_face_guess) .and. Y_face_guess > 0d0) then + Z_seed = log(Y_face_guess) + use_seed = .not. is_bad(Z_seed%val) .and. Z_seed%val >= Zlb%val .and. Z_seed%val <= Zub%val end if + end if + if (use_seed) then + Z_seed_lb = max(Zlb%val, Z_seed%val - seed_bracket_half_width) + Z_seed_ub = min(Zub%val, Z_seed%val + seed_bracket_half_width) + end if - ! We use the fact that Q(Y) is monotonic to iteratively refined bounds on Q. - dQdZ = differentiate_1(Q) - if (Q > 0d0 .and. dQdZ < 0d0) then - lower_bound_Z = Z - else if (Q > 0d0 .and. dQdZ > 0d0) then - upper_bound_Z = Z - else if (Q < 0d0 .and. dQdZ < 0d0) then - upper_bound_Z = Z + num_tries = 1 + if (use_seed) num_tries = 2 + + attempt_loop: do i_try = 1, num_tries + doing_seed = use_seed .and. i_try == 1 + + ! Try a small bracket around the Y_face guess, or + ! use the full interval if that does not bracket the current root. + ierr = 0 + if (doing_seed) then + lower_bound_Z = Z_seed_lb + upper_bound_Z = Z_seed_ub + Y = set_Y(Y_is_positive, lower_bound_Z) + call compute_Q(info, Y, Q_lb, Af) + Y = set_Y(Y_is_positive, upper_bound_Z) + call compute_Q(info, Y, Q_ub, Af) + bad_seed_bracket = is_bad(Q_lb%val) .or. is_bad(Q_ub%val) + if (.not. bad_seed_bracket) bad_seed_bracket = Q_lb * Q_ub > 0d0 + if (bad_seed_bracket) cycle attempt_loop + Z = Z_seed + if (info%report) write(*,*) 'Z from Y_face guess', Z%val else - lower_bound_Z = Z - end if - - if (is_bad(dQdZ%val) .or. abs(dQdZ%val) < 1d-99) then - ierr = 1 - exit + lower_bound_Z = Zlb + upper_bound_Z = Zub + call Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Z, ierr) + if (ierr /= 0) return + if (info%report) write(*,*) 'Z from bisection search', Z%val end if - correction = -Q/dQdz - corr_has_derivatives = .true. - - ! Do a line search to avoid steps that are too big. - do line_iter=1,max_line_search_iter + Z%d1val1 = 1d0 ! Set derivative dZ/dZ=1 for Newton iterations. + if (info%report) write(*,*) 'lower_bound_Z, upper_bound_Z',lower_bound_Z%val,upper_bound_Z%val + + ! Now we refine the solution with a Newton solve. + ! This also lets us pick up the derivative of the solution with respect to input parameters. + dQdz = 0d0 + converged = .false. + have_derivatives = .false. ! Tracks if we've done at least one Newton iteration. + ! Need to do this before returning to endow Y with partials + ! with respect to the structure variables. + do iter = 1, max_iter + Y = set_Y(Y_is_positive, Z) + call compute_Q(info, Y, Q, Af) + if (is_bad(Q%val)) then + ierr = 1 + exit + end if - if (abs(correction) < correction_tolerance .and. have_derivatives) then - ! Can't get much more precision than this. + if (abs(Q%val)/scale <= residual_tolerance .and. have_derivatives) then + ! Can't exit on the first iteration, otherwise we have no derivative information. + if (info%report) write(*,2) 'converged', iter, abs(Q%val)/scale, residual_tolerance converged = .true. exit end if - Z_new = Z + correction - if (corr_has_derivatives) then - have_derivatives = .true. + ! We use the fact that Q(Y) is monotonic to iteratively refined bounds on Q. + dQdZ = differentiate_1(Q) + if (Q > 0d0 .and. dQdZ < 0d0) then + lower_bound_Z = Z + else if (Q > 0d0 .and. dQdZ > 0d0) then + upper_bound_Z = Z + else if (Q < 0d0 .and. dQdZ < 0d0) then + upper_bound_Z = Z + else + lower_bound_Z = Z end if - ! If the correction pushes the solution out of bounds then we know - ! that was a bad step. Bad steps are still in the same direction, they just - ! go too far, so we replace that result with one that's halfway to the relevant bound. - if (Z_new > upper_bound_Z) then - Z_new = (Z + upper_bound_Z) / 2d0 - else if (Z_new < lower_bound_Z) then - Z_new = (Z + lower_bound_Z) / 2d0 + if (is_bad(dQdZ%val) .or. abs(dQdZ%val) < 1d-99) then + ierr = 1 + exit end if - Y = set_Y(Y_is_positive,Z_new) + correction = -Q/dQdz + corr_has_derivatives = .true. - call compute_Q(info, Y, Qc, Af) + ! Do a line search to avoid steps that are too big. + do line_iter=1,max_line_search_iter - if (abs(Qc) < abs(Q)) then - exit - else - correction = 0.5d0 * correction - end if - end do + if (abs(correction) < correction_tolerance .and. have_derivatives) then + ! Can't get much more precision than this. + converged = .true. + exit + end if + + Z_new = Z + correction + if (corr_has_derivatives) then + have_derivatives = .true. + end if + + ! If the correction pushes the solution out of bounds then we know + ! that was a bad step. Bad steps are still in the same direction, they just + ! go too far, so we replace that result with one that's halfway to the relevant bound. + if (Z_new > upper_bound_Z) then + Z_new = (Z + upper_bound_Z) / 2d0 + else if (Z_new < lower_bound_Z) then + Z_new = (Z + lower_bound_Z) / 2d0 + end if + + Y = set_Y(Y_is_positive,Z_new) + + call compute_Q(info, Y, Qc, Af) - if (info%report) write(*,3) 'i, li, Z_new, Z, low_bnd, upr_bnd, Q, dQdZ, corr', iter, line_iter, & - Z_new%val, Z%val, lower_bound_Z%val, upper_bound_Z%val, Q%val, dQdZ%val, correction%val - Z_new%d1val1 = 1d0 ! Ensures that dZ/dZ = 1. - Z = Z_new + if (is_bad(Qc%val)) then + correction = 0.5d0 * correction + else if (abs(Qc) < abs(Q)) then + exit + else + correction = 0.5d0 * correction + end if + end do + + if (info%report) write(*,3) 'i, li, Z_new, Z, low_bnd, upr_bnd, Q, dQdZ, corr', iter, line_iter, & + Z_new%val, Z%val, lower_bound_Z%val, upper_bound_Z%val, Q%val, dQdZ%val, correction%val + Z_new%d1val1 = 1d0 ! Ensures that dZ/dZ = 1. + Z = Z_new + + Y = set_Y(Y_is_positive,Z) + if (converged) exit - Y = set_Y(Y_is_positive,Z) - if (converged) exit + end do - end do + if (converged .and. doing_seed) then + call compute_Q(info, Y, Q, Af) + if (abs(Q%val)/scale > residual_tolerance) converged = .false. + if (is_bad(Y%val) .or. any(is_bad(Y%d1Array)) .or. & + is_bad(Af%val) .or. any(is_bad(Af%d1Array))) converged = .false. + end if + if (converged) exit attempt_loop + if (doing_seed) cycle attempt_loop - if (.not. converged) then ierr = 1 if (info%report) then !$OMP critical (tdc_crit0) @@ -372,7 +427,7 @@ subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_fa !$OMP end critical (tdc_crit0) end if return - end if + end do attempt_loop ! Unpack output Y_face = unconvert(Y) diff --git a/turb/private/tdc_support.f90 b/turb/private/tdc_support.f90 index 8615e3968..33485d29a 100644 --- a/turb/private/tdc_support.f90 +++ b/turb/private/tdc_support.f90 @@ -71,70 +71,15 @@ module tdc_support !! @param Gamma Gamma is the MLT Gamma efficiency parameter, which we evaluate in steady state from MLT. type tdc_info logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter - logical :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split - logical :: use_TDC_enhanced_dissipation + logical :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit integer :: TDC_arnett_growth_target real(dp) :: mixing_length_alpha, TDC_alpha_C, TDC_alpha_S, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, e - real(dp) :: TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor type(auto_diff_real_tdc) :: A0, A_mlt, c0, L, L0, gradL, grada, Y_start type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h, grav, chiT, chiRho, r end type tdc_info contains - ! Returns the dissipation length used in the Kuhfuss local-TDC damping term. - ! With the control on, this uses the Ahlborn/Kupka harmonic-sum length: - ! the geometric Wuchterl baseline for Y >= 0 and the stable-side reduced - ! length for Y < 0 using the lagged start-of-step convection speed scale. - type(auto_diff_real_tdc) function eval_tdc_dissipation_length(info, Y) result(Lambda_diss) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: Y - type(auto_diff_real_tdc) :: Lambda0, Lambda_geom, radius, N2_loc, N_loc, a_quad, b_quad, v_lag - real(dp) :: v_floor - real(dp), parameter :: tiny_len = 1d-30 - real(dp), parameter :: tiny_speed = 1d-30 - - Lambda0 = convert(info%mixing_length_alpha*info%Hp) - if (.not. info%use_TDC_enhanced_dissipation) then - Lambda_diss = Lambda0 - return - end if - - radius = convert(info%r) - if (Lambda0%val <= tiny_len .or. radius%val <= tiny_len) then - Lambda_diss = Lambda0 - return - end if - - ! Source-model baseline in the convection zone: the Wuchterl harmonic sum - ! between the mixing length and the local radius. - Lambda_geom = 1d0/(1d0/Lambda0 + 1d0/radius) - - if (Y%val >= 0d0 .or. info%TDC_enhanced_dissipation_c4 <= 0d0) then - Lambda_diss = Lambda_geom - return - end if - - N2_loc = -Y*convert(info%chiT/info%chiRho*info%grav/info%Hp) - if (N2_loc%val <= 0d0) then - Lambda_diss = Lambda_geom - return - end if - - N_loc = sqrt(N2_loc) - v_floor = max(info%TDC_enhanced_dissipation_v_floor, tiny_speed) - v_lag = sqrt(pow2(info%A0) + pow2(v_floor)) - - a_quad = info%TDC_enhanced_dissipation_c4*N_loc/(v_lag*radius) - if (a_quad%val <= 0d0) then - Lambda_diss = Lambda_geom - return - end if - - b_quad = 1d0/Lambda0 + 1d0/radius - Lambda_diss = 2d0/(b_quad + sqrt(pow2(b_quad) + 4d0*a_quad)) - end function eval_tdc_dissipation_length - subroutine eval_Af_state(dt, A0, xi0, xi1, xi2, Af) type(auto_diff_real_tdc), intent(in) :: dt, A0, xi0, xi1, xi2 type(auto_diff_real_tdc), intent(out) :: Af @@ -240,6 +185,11 @@ subroutine Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Y = set_Y(Y_is_positive, upper_bound_Z) call compute_Q(info, Y, Q_ub, Af) + if (is_bad(Q_lb%val) .or. is_bad(Q_ub%val)) then + ierr = 1 + return + end if + ! Check to make sure that the lower and upper bounds on Z actually bracket ! a solution to Q(Y(Z)) = 0. if (Q_lb * Q_ub > 0d0) then @@ -269,6 +219,10 @@ subroutine Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Y = set_Y(Y_is_positive, Z) call compute_Q(info, Y, Q, Af) + if (is_bad(Q%val)) then + ierr = 1 + return + end if if (Q > 0d0 .and. Q_ub > 0d0) then upper_bound_Z = Z @@ -602,53 +556,6 @@ type(auto_diff_real_tdc) function eval_Af_single_state(info, Y, A_start, dt_step end if end function eval_Af_single_state - type(auto_diff_real_tdc) function eval_Af_split(info, Y) result(Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: Y - type(auto_diff_real_tdc) :: dt_full, dt1, dt2, A1 - real(dp), parameter :: tiny = 1d-30 - - dt_full = info%dt - - ! Exact-boundary cases are handled by the limiting split: - ! if Y_start = 0, the crossing is at t = 0 and the end-state branch - ! applies for the full step; if Y = 0, the crossing is at t = dt and - ! the start-state branch applies for the full step. - if (abs(info%Y_start%val) <= tiny) then - Af = eval_Af_single_state(info, Y, info%A0, dt_full) - return - else if (abs(Y%val) <= tiny) then - Af = eval_Af_single_state(info, info%Y_start, info%A0, dt_full) - return - end if - - if ((info%Y_start > 0d0 .and. Y > 0d0) .or. (info%Y_start < 0d0 .and. Y < 0d0)) then - Af = eval_Af_single_state(info, Y, info%A0, dt_full) - return - end if - - dt1 = dt_full * info%Y_start / (info%Y_start - Y) - dt2 = dt_full - dt1 - - if (dt1%val <= tiny) then - Af = eval_Af_single_state(info, Y, info%A0, dt2) - return - else if (dt2%val <= tiny) then - Af = eval_Af_single_state(info, info%Y_start, info%A0, dt1) - return - end if - - if (info%Y_start < 0d0 .and. Y > 0d0) then - A1 = eval_Af_single_state(info, info%Y_start, info%A0, dt1) - Af = eval_Af_single_state(info, Y, A1, dt2) - else if (info%Y_start > 0d0 .and. Y < 0d0) then - A1 = eval_Af_single_state(info, info%Y_start, info%A0, dt1) - Af = eval_Af_single_state(info, Y, A1, dt2) - else - Af = eval_Af_single_state(info, Y, info%A0, dt_full) - end if - end function eval_Af_split - !> Q is the residual in the TDC equation, namely: !! !! Q = (L - L0 * gradL) - L0 * Y - c0 * Af * Y_env @@ -678,12 +585,7 @@ subroutine compute_Q(info, Y, Q, Af) Y_env = Y end if dt_step = info%dt - - if (info%use_TDC_Af_split) then - Af = eval_Af_split(info, Y) - else - Af = eval_Af_single_state(info, Y, info%A0, dt_step) - end if + Af = eval_Af_single_state(info, Y, info%A0, dt_step) ! Y_env sets the convective flux but not the radiative flux. Q = (info%L - info%L0*info%gradL) - info%L0 * Y - info%c0*Af*Y_env @@ -756,7 +658,7 @@ subroutine eval_xis(info, Y, xi0, xi1, xi2) S0 = S0*Y + convert(info%Eq_div_w) end if - Lambda_diss = eval_tdc_dissipation_length(info, Y) + Lambda_diss = convert(info%mixing_length_alpha*info%Hp) D0 = info%TDC_alpha_D*x_CEDE/Lambda_diss gammar_div_alfa = info%TDC_alpha_R*x_GAMMAR/(info%mixing_length_alpha*info%Hp) DR0 = convert(4d0*boltz_sigma*pow2(gammar_div_alfa)*pow3(info%T)/(pow2(info%rho)*info%Cp*info%kap)) diff --git a/turb/public/turb.f90 b/turb/public/turb.f90 index 9fb7c84fc..60fd58eef 100644 --- a/turb/public/turb.f90 +++ b/turb/public/turb.f90 @@ -93,8 +93,8 @@ end subroutine set_thermohaline !! (ADS: https://ui.adsabs.harvard.edu/abs/1969Ap%26SS...5..180A/abstract). !! !! @param conv_vel_start The convection speed at the start of the step. - !! @param Y_face_start Start-of-step superadiabaticity, used by the optional split-step A_f closure - !! and by the stable-side decay branch of the post-solve acceleration limiter. + !! @param Y_face_start Start-of-step superadiabaticity, used by the stable-side + !! decay branch of the post-solve acceleration limiter. !! @param mixing_length_alpha The mixing length parameter. !! @param TDC_alpha_D TDC turbulent damping parameter !! @param TDC_alpha_R TDC radiative damping parameter @@ -123,26 +123,20 @@ end subroutine set_thermohaline !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param gradT The temperature gradient dlnT/dlnP (output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. - !! @param use_TDC_Af_split If true, use the split-step A_f closure when the start/end - !! thermal states lie on opposite sides of Y = 0. - !! @param use_TDC_enhanced_dissipation If true, replace the baseline Kuhfuss - !! local-TDC dissipation length in xi2 by the Ahlborn/Kupka harmonic-sum - !! dissipation length. - !! @param TDC_enhanced_dissipation_c4 Stable-side dissipation-length coefficient - !! used in the Ahlborn/Kupka reduction factor. - !! @param TDC_enhanced_dissipation_v_floor Speed floor used with the lagged - !! start-of-step convective speed in the stable-side reduction factor. !! @param TDC_arnett_growth_target Unstable-side steady-state target for David Arnett's !! convection model in this implementation. + !! @param have_Y_face_guess If true, use Y_face_guess to try a small local + !! bracket before the usual positive-Y luminosity-balance bracketing. + !! @param Y_face_guess Candidate superadiabaticity used only to + !! seed the local solve. !! @param ierr Tracks errors (output). subroutine set_TDC( & conv_vel_start, Y_face_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, & max_conv_vel, Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, & - TDC_alpha_S, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split, & - use_TDC_enhanced_dissipation, TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor, & - TDC_arnett_growth_target, energy, ierr) + TDC_alpha_S, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, & + TDC_arnett_growth_target, energy, ierr, have_Y_face_guess, Y_face_guess) use tdc use tdc_support real(dp), intent(in) :: conv_vel_start, Y_face_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt @@ -150,11 +144,11 @@ subroutine set_TDC( & type(auto_diff_real_star_order1), intent(in) :: & chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, scale_height, gradL, grada, Eq_div_w, grav, energy logical, intent(in) :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter - logical, intent(in) :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, use_TDC_Af_split - logical, intent(in) :: use_TDC_enhanced_dissipation + logical, intent(in) :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit + logical, intent(in), optional :: have_Y_face_guess integer, intent(in) :: TDC_arnett_growth_target type(auto_diff_real_star_order1),intent(out) :: conv_vel, Y_face, gradT, D - real(dp), intent(in) :: TDC_enhanced_dissipation_c4, TDC_enhanced_dissipation_v_floor + real(dp), intent(in), optional :: Y_face_guess integer, intent(out) :: tdc_num_iters, mixing_type, ierr type(tdc_info) :: info type(auto_diff_real_star_order1) :: L, Lambda, Gamma @@ -163,31 +157,42 @@ subroutine set_TDC( & real(dp), parameter :: upper_bound_Z = 1d2 real(dp), parameter :: eps = 1d-2 ! Threshold in logY for separating multiple solutions. type(auto_diff_real_tdc) :: Zub, Zlb + logical :: need_cox_mlt include 'formats' - ! Do a call to MLT !grav = cgrav * m / pow2(r) L = 64d0 * pi * boltz_sigma * pow4(T) * grav * pow2(r) * gradr / (3d0 * P * opacity) Lambda = mixing_length_alpha * scale_height - call set_MLT('Cox', mixing_length_alpha, 0d0, 0d0, & - chiT, chiRho, Cp, grav, Lambda, rho, P, T, opacity, & - gradr, grada, gradL, & - Gamma, gradT, Y_face, conv_vel, D, mixing_type,1d99, ierr) + need_cox_mlt = include_mlt_corr_to_TDC .or. & + (use_TDC_arnett_velocity_closure .and. & + TDC_arnett_growth_target == TDC_arnett_growth_target_mlt) + if (need_cox_mlt) then + call set_MLT('Cox', mixing_length_alpha, 0d0, 0d0, & + chiT, chiRho, Cp, grav, Lambda, rho, P, T, opacity, & + gradr, grada, gradL, & + Gamma, gradT, Y_face, conv_vel, D, mixing_type,1d99, ierr) + else + ! set_MLT would normally initialize these. These quantities only + ! fill inactive entries in info, and get_TDC_solution overwrites them. + Gamma = 0d0 + gradT = gradr + Y_face = gradT - gradL + conv_vel = 0d0 + D = 0d0 + mixing_type = no_mixing + ierr = 0 + end if info%report = report info%include_mlt_corr_to_TDC = include_mlt_corr_to_TDC info%use_TDC_enthalpy_flux_limiter = use_TDC_enthalpy_flux_limiter info%use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure info%use_TDC_acceleration_limit = use_TDC_acceleration_limit - info%use_TDC_Af_split = use_TDC_Af_split - info%use_TDC_enhanced_dissipation = use_TDC_enhanced_dissipation info%TDC_arnett_growth_target = TDC_arnett_growth_target info%mixing_length_alpha = mixing_length_alpha info%TDC_alpha_D = TDC_alpha_D info%TDC_alpha_R = TDC_alpha_R info%TDC_alpha_Pt = TDC_alpha_Pt - info%TDC_enhanced_dissipation_c4 = TDC_enhanced_dissipation_c4 - info%TDC_enhanced_dissipation_v_floor = TDC_enhanced_dissipation_v_floor info%dt = dt info%L = convert(L) info%gradL = convert(gradL) @@ -216,7 +221,12 @@ subroutine set_TDC( & ! Get solution Zub = upper_bound_Z Zlb = lower_bound_Z - call get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr) + call get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr, & + have_Y_face_guess, Y_face_guess) + if (ierr /= 0) then + if (report) write(*,*) 'ierr from get_TDC_solution' + return + end if ! Cap conv_vel at max_conv_vel_div_csound*cs if (conv_vel%val > max_conv_vel) then diff --git a/turb/test/src/test_time_dependence_support.f90 b/turb/test/src/test_time_dependence_support.f90 index c4302f6bc..59c63665e 100644 --- a/turb/test/src/test_time_dependence_support.f90 +++ b/turb/test/src/test_time_dependence_support.f90 @@ -12,7 +12,6 @@ module test_time_dependence_support character(len=48) :: name logical :: use_arnett logical :: use_acceleration_limit - logical :: use_Af_split logical :: include_mlt_correction integer :: growth_target end type tdc_mode_data @@ -27,15 +26,14 @@ module test_time_dependence_support gradr, grada, scale_height, gradL, Eq_div_w, grav, energy end type tdc_case_data - integer, parameter :: num_tdc_modes = 7 + integer, parameter :: num_tdc_modes = 6 type(tdc_mode_data), parameter :: tdc_modes(num_tdc_modes) = [ & - tdc_mode_data('tdc', .false., .false., .false., .false., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_Af_split', .false., .false., .true., .false., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_mlt_corr', .false., .false., .false., .true., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_arnett_closure', .true., .false., .false., .true., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_arnett_closure_tdc_ss', .true., .false., .false., .false., TDC_arnett_growth_target_tdc_no_mlt_corr), & - tdc_mode_data('tdc_with_arnett_closure_tdc_ss_mlt_corr', .true., .false., .false., .true., TDC_arnett_growth_target_tdc_with_mlt_corr), & - tdc_mode_data('tdc_with_acceleration_limit', .false., .true., .false., .false., TDC_arnett_growth_target_mlt) ] + tdc_mode_data('tdc', .false., .false., .false., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_mlt_corr', .false., .false., .true., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_arnett_closure', .true., .false., .true., TDC_arnett_growth_target_mlt), & + tdc_mode_data('tdc_with_arnett_closure_tdc_ss', .true., .false., .false., TDC_arnett_growth_target_tdc_no_mlt_corr), & + tdc_mode_data('tdc_with_arnett_closure_tdc_ss_mlt_corr', .true., .false., .true., TDC_arnett_growth_target_tdc_with_mlt_corr), & + tdc_mode_data('tdc_with_acceleration_limit', .false., .true., .false., TDC_arnett_growth_target_mlt) ] private public :: write_time_dependence_csv @@ -773,9 +771,8 @@ subroutine call_tdc(case_data, mode, conv_vel_start, L_conv_start, dt, gradT, Y_ case_data%T, case_data%rho, case_data%dV, case_data%Cp, case_data%opacity, case_data%scale_height, & case_data%gradL, case_data%grada, conv_vel, D, Y_face, gradT, tdc_num_iters, case_data%max_conv_vel, & case_data%Eq_div_w, case_data%grav, mode%include_mlt_correction, case_data%TDC_alpha_C, case_data%TDC_alpha_S, & - case_data%use_TDC_enthalpy_flux_limiter, mode%use_arnett, mode%use_acceleration_limit, mode%use_Af_split, & - .false., 0d0, 0d0, mode%growth_target, & - case_data%energy, ierr) + case_data%use_TDC_enthalpy_flux_limiter, mode%use_arnett, mode%use_acceleration_limit, & + mode%growth_target, case_data%energy, ierr) end subroutine call_tdc @@ -977,11 +974,6 @@ subroutine print_mode_controls(mode) else write(*, '(a)') ' use_TDC_acceleration_limit = .false.' end if - if (mode%use_Af_split) then - write(*, '(a)') ' use_TDC_Af_split = .true.' - else - write(*, '(a)') ' use_TDC_Af_split = .false.' - end if write(*, '(a,a)') ' TDC_arnett_growth_target = ', trim(growth_target_name(mode%growth_target)) end subroutine print_mode_controls diff --git a/turb/test/src/test_turb.f90 b/turb/test/src/test_turb.f90 index 1f496eb1d..15d191abe 100644 --- a/turb/test/src/test_turb.f90 +++ b/turb/test/src/test_turb.f90 @@ -8,12 +8,11 @@ program test_turb implicit none - integer, parameter :: num_tdc_modes = 4 + integer, parameter :: num_tdc_modes = 3 character(len=32), parameter :: tdc_mode_names(num_tdc_modes) = [character(len=32) :: & - 'plain TDC', 'TDC + Af split', 'TDC + Arnett closure', 'TDC + acceleration limit'] - logical, parameter :: tdc_mode_use_arnett(num_tdc_modes) = [.false., .false., .true., .false.] - logical, parameter :: tdc_mode_use_accel(num_tdc_modes) = [.false., .false., .false., .true.] - logical, parameter :: tdc_mode_use_split(num_tdc_modes) = [.false., .true., .false., .false.] + 'plain TDC', 'TDC + Arnett closure', 'TDC + acceleration limit'] + logical, parameter :: tdc_mode_use_arnett(num_tdc_modes) = [.false., .true., .false.] + logical, parameter :: tdc_mode_use_accel(num_tdc_modes) = [.false., .false., .true.] call check_efficient_MLT_scaling() call check_TDC() @@ -171,8 +170,8 @@ subroutine compare_TDC_and_Cox_MLT() mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), & - .false., 0d0, 0d0, TDC_arnett_growth_target_mlt, energy, ierr) + tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), & + TDC_arnett_growth_target_mlt, energy, ierr) write (*, '(a)') 'Mode: ' // trim(tdc_mode_names(mode_i)) write (*, 1) 'Y, conv_vel_start, conv_vel, dt', Y_face%val, conv_vel_start, conv_vel%val, dt end do @@ -241,8 +240,8 @@ subroutine check_TDC() mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), tdc_mode_use_split(mode_i), & - .false., 0d0, 0d0, TDC_arnett_growth_target_mlt, energy, ierr) + tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), & + TDC_arnett_growth_target_mlt, energy, ierr) write (*, 1) 'dt, gradT, conv_vel_start, conv_vel', dt, gradT%val, conv_vel_start, conv_vel%val if (report) stop diff --git a/turb/test/test_output b/turb/test/test_output index aa71f6644..ba6877dc6 100644 --- a/turb/test/test_output +++ b/turb/test/test_output @@ -47,40 +47,6 @@ Running dt test dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 #################################### -Mode: TDC + Af split -Running dt test - dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5204370043250246D-01 5.2320587415154047D+07 6.0597238914198903D+06 - dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5204285749162930D-01 5.2320587415154047D+07 5.9050075093203261D+06 - dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5204196393651124D-01 5.2320587415154047D+07 5.7494001285570739D+06 - dt, gradT, conv_vel_start, conv_vel 5.3060399999999993D+02 2.5204101302204984D-01 5.2320587415154047D+07 5.5925658656495046D+06 - dt, gradT, conv_vel_start, conv_vel 5.4121608000000003D+02 2.5203999647052466D-01 5.2320587415154047D+07 5.4341006185611701D+06 - dt, gradT, conv_vel_start, conv_vel 5.5204040160000000D+02 2.5203890395733641D-01 5.2320587415154047D+07 5.2735100646096319D+06 - dt, gradT, conv_vel_start, conv_vel 5.6308120963200008D+02 2.5203772235599331D-01 5.2320587415154047D+07 5.1101775684554409D+06 - dt, gradT, conv_vel_start, conv_vel 5.7434283382464002D+02 2.5203643459023894D-01 5.2320587415154047D+07 4.9433157147388468D+06 - dt, gradT, conv_vel_start, conv_vel 5.8582969050113286D+02 2.5203501781331550D-01 5.2320587415154047D+07 4.7718899504500106D+06 - dt, gradT, conv_vel_start, conv_vel 5.9754628431115555D+02 2.5203344036462588D-01 5.2320587415154047D+07 4.5944918361562928D+06 - dt, gradT, conv_vel_start, conv_vel 6.0949720999737872D+02 2.5203165633254127D-01 5.2320587415154047D+07 4.4091141978058126D+06 - dt, gradT, conv_vel_start, conv_vel 6.2168715419732621D+02 2.5202959494944044D-01 5.2320587415154047D+07 4.2127157422839301D+06 - dt, gradT, conv_vel_start, conv_vel 6.3412089728127273D+02 2.5202713722579184D-01 5.2320587415154047D+07 4.0002689176325197D+06 - dt, gradT, conv_vel_start, conv_vel 6.4680331522689812D+02 2.5202405410296042D-01 5.2320587415154047D+07 3.7622592559380517D+06 - dt, gradT, conv_vel_start, conv_vel 6.5973938153143615D+02 2.5201978092426058D-01 5.2320587415154047D+07 3.4756430172060304D+06 - dt, gradT, conv_vel_start, conv_vel 6.7293416916206490D+02 2.5201140133059619D-01 5.2320587415154047D+07 3.0239000429141554D+06 - dt, gradT, conv_vel_start, conv_vel 6.8639285254530625D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.0012070959621246D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.1412312378813670D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.2840558626389941D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.4297369798917748D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.5783317194896108D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.7298983538794027D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 7.8844963209569903D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 8.0421862473761303D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 8.2030299723236533D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 8.3670905717701260D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 8.5344323832055295D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 - dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 -#################################### Mode: TDC + Arnett closure Running dt test dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5206418300800154D-01 5.2320587415154047D+07 1.6677542875162063D+07 @@ -158,8 +124,6 @@ Mode: MLT Y, conv_vel_start, conv_vel, Gamma 3.9999830300230244D-06 0.0000000000000000D+00 1.5051080930415759D+02 1.3740991947818479D-03 Mode: plain TDC Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 -Mode: TDC + Af split - Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 Mode: TDC + Arnett closure Y, conv_vel_start, conv_vel, dt 3.9999852207537568D-06 0.0000000000000000D+00 1.5051080930415756D+02 1.0000000000000000D+40 Mode: TDC + acceleration limit @@ -183,29 +147,6 @@ Convection model: tdc include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206216661731234E-01 -1.3706056122687329E-05 5.2320587415154047E+07 1.4223996656248299E+07 1.0000020969348418E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5205110632014682E-01 -2.4766353288167702E-05 1.4223996656248299E+07 7.8717643317566449E+06 1.0000020968428298E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5203572180572381E-01 -4.0150867711182339E-05 7.8717643317566449E+06 4.8555587348417640E+06 1.0000020967148442E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 4.8555587348417640E+06 0.0000000000000000E+00 -6.6613381477509392E-16 - 5 9.9763115748443909E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 6 1.1971573889813269E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 7 1.3966836204782148E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 8 1.5962098519751025E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 9 1.7957360834719902E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 10 1.9952623149688782E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 11 2.1947885464657661E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 12 2.3943147779626538E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - tau_phys[s] 2.4407158796310516E-02 - -Convection model: tdc_with_Af_split - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .true. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 @@ -227,7 +168,6 @@ Convection model: tdc_with_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 @@ -249,7 +189,6 @@ Convection model: tdc_with_arnett_closure include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 @@ -271,7 +210,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_no_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 @@ -293,7 +231,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_with_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 @@ -315,7 +252,6 @@ Convection model: tdc_with_acceleration_limit include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .true. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 @@ -347,30 +283,6 @@ Convection model: tdc include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397716939257E-01 3.9771693925558278E-06 0.0000000000000000E+00 2.7948760309172320E+02 7.1495234560010973E-02 5.7075947856866094E-08 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395493296970E-01 3.9549329696727386E-06 2.7948760309172320E+02 5.5477497861836196E+02 1.4191601625825195E-01 1.1266644917018453E-07 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393347167013E-01 3.9334716701094930E-06 5.5477497861836196E+02 8.2341845398708051E+02 2.1063723348590743E-01 1.6631916155418483E-07 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000391293777982E-01 3.9129377797828441E-06 8.2341845398708051E+02 1.0832121431338355E+03 2.7709460238989475E-01 2.1765337399060058E-07 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000389344979725E-01 3.8934497972205580E-06 1.0832121431338355E+03 1.3322532528000313E+03 3.4080137275718969E-01 2.6637284322728050E-07 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000387510756641E-01 3.8751075663634162E-06 1.3322532528000313E+03 1.5689873926498860E+03 4.0135991871664384E-01 3.1222796181840096E-07 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000385796830107E-01 3.8579683010650897E-06 1.5689873926498860E+03 1.7922298853375303E+03 4.5846719002995001E-01 3.5507569662307498E-07 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000384206410128E-01 3.8420641012738213E-06 1.7922298853375303E+03 2.0011670228765338E+03 5.1191503348133172E-01 3.9483579850063677E-07 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000382740094365E-01 3.8274009436087563E-06 2.0011670228765338E+03 2.1953387606570254E+03 5.6158576586435349E-01 4.3149332606962082E-07 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000381396225176E-01 3.8139622517159853E-06 2.1953387606570254E+03 2.3746071539845266E+03 6.0744409978816527E-01 4.6508971973668878E-07 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000380171283689E-01 3.8017128368745924E-06 2.3746071539845266E+03 2.5391150402843618E+03 6.4952657424453109E-01 4.9571295068773225E-07 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000379060290026E-01 3.7906029002259580E-06 2.5391150402843618E+03 2.6892393632450708E+03 6.8792961453865198E-01 5.2348751455877363E-07 - tau_phys[s] 1.5401478440959990E+05 - conv_vel_eq[cm/s] 3.9091780705625856E+03 - -Convection model: tdc_with_Af_split - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .true. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 @@ -393,7 +305,6 @@ Convection model: tdc_with_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 @@ -416,7 +327,6 @@ Convection model: tdc_with_arnett_closure include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 @@ -439,7 +349,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_no_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 @@ -462,7 +371,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_with_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 @@ -485,7 +393,6 @@ Convection model: tdc_with_acceleration_limit include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .true. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 @@ -518,7 +425,6 @@ Convection model: tdc include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 @@ -536,33 +442,10 @@ Convection model: tdc 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 tau_phys[s] 5.1712339439846779E+04 -Convection model: tdc_with_Af_split - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .true. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601233828330E-01 -3.9876617167210728E-06 1.5051080930415759E+02 1.5062723972850915E+02 -3.0846016851882041E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999600460753221E-01 -3.9953924678421233E-06 1.5062723972850915E+02 5.6140482309923982E+01 -1.1518945797206470E-08 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 5.6140482309923982E+01 0.0000000000000000E+00 -2.2204460492503131E-16 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - tau_phys[s] 5.1712339439846779E+04 - Convection model: tdc_with_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 @@ -584,7 +467,6 @@ Convection model: tdc_with_arnett_closure include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 @@ -606,7 +488,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_no_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 @@ -628,7 +509,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_with_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 @@ -650,7 +530,6 @@ Convection model: tdc_with_acceleration_limit include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .true. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 @@ -682,30 +561,6 @@ Convection model: tdc include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744393250170E-01 8.9397611087579920E-08 5.0383392852019933E+04 5.2121418074864210E+04 8.6482708264866570E-01 9.5759066825599037E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744154258327E-01 8.7007692642466247E-08 5.2121418074864210E+04 5.3553083901440143E+04 8.8858206526151517E-01 9.5759066861825992E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977743966686153E-01 8.5131970906460151E-08 5.3553083901440143E+04 5.4733024690056111E+04 9.0816028833386531E-01 9.5759066890258626E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743818030582E-01 8.3645415219367943E-08 5.4733024690056111E+04 5.5705746147751015E+04 9.2430021490454561E-01 9.5759066912792190E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743699319907E-01 8.2458308462769200E-08 5.5705746147751015E+04 5.6507711040586320E+04 9.3760685513565400E-01 9.5759066930786640E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743603953487E-01 8.1504644270383458E-08 5.6507711040586320E+04 5.7168892765873708E+04 9.4857754403286687E-01 9.5759066945242499E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743526975762E-01 8.0734867018686773E-08 5.7168892765873708E+04 5.7713977130908381E+04 9.5762188201563703E-01 9.5759066956910988E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743464604299E-01 8.0111152384924902E-08 5.7713977130908381E+04 5.8163315974492507E+04 9.6507755792720606E-01 9.5759066966365392E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743413912803E-01 7.9604237436080674E-08 5.8163315974492507E+04 5.8533696442506945E+04 9.7122311327573652E-01 9.5759066974049312E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743372612102E-01 7.9191230398618388E-08 5.8533696442506945E+04 5.8838967982603062E+04 9.7628834567324707E-01 9.5759066980309782E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743338895023E-01 7.8854059604312865E-08 5.8838967982603062E+04 5.9090556574501214E+04 9.8046284122604344E-01 9.5759066985420704E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743311324182E-01 7.8578351207862593E-08 5.9090556574501214E+04 5.9297888015708093E+04 9.8390299792290736E-01 9.5759066989599950E-01 - tau_phys[s] 1.3692865440101397E+04 - conv_vel_eq[cm/s] 6.0268022499057690E+04 - -Convection model: tdc_with_Af_split - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .true. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 @@ -728,7 +583,6 @@ Convection model: tdc_with_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 @@ -751,7 +605,6 @@ Convection model: tdc_with_arnett_closure include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356745E-01 9.5746449299924841E-01 @@ -774,7 +627,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_no_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 @@ -797,7 +649,6 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - use_TDC_Af_split = .false. TDC_arnett_growth_target = tdc_with_mlt_corr step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 @@ -820,7 +671,6 @@ Convection model: tdc_with_acceleration_limit include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .false. use_TDC_acceleration_limit = .true. - use_TDC_Af_split = .false. TDC_arnett_growth_target = mlt step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 From 1ff0e9564ebe2f4a686bc45f34e8b6ace369488e Mon Sep 17 00:00:00 2001 From: Debraheem Date: Mon, 4 May 2026 13:34:19 -0400 Subject: [PATCH 08/12] simplify arnett limiter controls --- star/defaults/controls_dev.defaults | 4 +-- turb/private/tdc_support.f90 | 26 ++++++------------- turb/public/turb.f90 | 6 ++--- .../test/src/test_time_dependence_support.f90 | 13 ++++------ turb/test/test_output | 16 ++++++------ 5 files changed, 25 insertions(+), 40 deletions(-) diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 6c43038e8..3a96598d4 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -237,8 +237,8 @@ ! Unstable-side steady-state target used by the Arnett 1969 closure in ! this implementation: ! 0 = steady-state MLT convective velocity - ! 1 = steady-state Kuhfuss 1986 closure velocity without the MLT correction - ! 2 = steady-state Kuhfuss 1986 closure velocity with the MLT correction + ! 1 = steady-state Kuhfuss 1986 closure velocity, using the active + ! include_mlt_corr_to_TDC setting ! :: diff --git a/turb/private/tdc_support.f90 b/turb/private/tdc_support.f90 index 33485d29a..d2bf890a2 100644 --- a/turb/private/tdc_support.f90 +++ b/turb/private/tdc_support.f90 @@ -27,8 +27,7 @@ module tdc_support implicit none integer, parameter :: TDC_arnett_growth_target_mlt = 0 -integer, parameter :: TDC_arnett_growth_target_tdc_no_mlt_corr = 1 -integer, parameter :: TDC_arnett_growth_target_tdc_with_mlt_corr = 2 +integer, parameter :: TDC_arnett_growth_target_tdc = 1 private public :: set_Y @@ -44,8 +43,7 @@ module tdc_support public :: compute_Q public :: apply_postsolve_TDC_acceleration_limit public :: TDC_arnett_growth_target_mlt -public :: TDC_arnett_growth_target_tdc_no_mlt_corr -public :: TDC_arnett_growth_target_tdc_with_mlt_corr +public :: TDC_arnett_growth_target_tdc !> Stores the information which is required to evaluate TDC-related quantities and which !! do not depend on Y. @@ -519,10 +517,8 @@ type(auto_diff_real_tdc) function eval_A_target_arnett_growth(info, Y) result(A_ select case (info%TDC_arnett_growth_target) case (TDC_arnett_growth_target_mlt) A_target = info%A_mlt - case (TDC_arnett_growth_target_tdc_no_mlt_corr) - A_target = eval_Af_tdc_steady_state(info, Y, .false.) - case (TDC_arnett_growth_target_tdc_with_mlt_corr) - A_target = eval_Af_tdc_steady_state(info, Y, .true.) + case (TDC_arnett_growth_target_tdc) + A_target = eval_Af_tdc_steady_state(info, Y) case default call mesa_error(__FILE__,__LINE__,'bad TDC_arnett_growth_target') end select @@ -837,20 +833,14 @@ end function eval_Af_arnett_decay_from_state_step !! !! @param info tdc_info type storing various quantities that are independent of Y. !! @param Y Superadiabaticity. - !! @param use_mlt_corr If true, use the MLT Gamma correction when forming Y_env. - type(auto_diff_real_tdc) function eval_Af_tdc_steady_state(info, Y, use_mlt_corr) result(Af_ss) + type(auto_diff_real_tdc) function eval_Af_tdc_steady_state(info, Y) result(Af_ss) type(tdc_info), intent(in) :: info type(auto_diff_real_tdc), intent(in) :: Y - logical, intent(in) :: use_mlt_corr type(auto_diff_real_tdc) :: Y_env, xi0, xi1, xi2, J2, J, root1, root2 real(dp), parameter :: tiny = 1d-30 - if (use_mlt_corr) then - if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then - Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) - else - Y_env = Y - end if + if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then + Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) else Y_env = Y end if @@ -893,7 +883,7 @@ subroutine apply_postsolve_TDC_acceleration_limit(info, Y, Af) type(auto_diff_real_tdc) :: Af_bound, Af_target, Af_excess0, numer, denom, Y_env_factor real(dp), parameter :: tiny = 1d-30 - Af_target = eval_Af_tdc_steady_state(info, Y, info%include_mlt_corr_to_TDC) + Af_target = eval_Af_tdc_steady_state(info, Y) if (Af_target > info%A0 + tiny) then Af_bound = eval_Af_arnett_growth_to_target(info, Af_target) diff --git a/turb/public/turb.f90 b/turb/public/turb.f90 index 60fd58eef..bad3a8ced 100644 --- a/turb/public/turb.f90 +++ b/turb/public/turb.f90 @@ -22,8 +22,7 @@ module turb use num_lib use utils_lib use auto_diff - use tdc_support, only: TDC_arnett_growth_target_mlt, TDC_arnett_growth_target_tdc_no_mlt_corr, & - TDC_arnett_growth_target_tdc_with_mlt_corr + use tdc_support, only: TDC_arnett_growth_target_mlt, TDC_arnett_growth_target_tdc implicit none @@ -33,8 +32,7 @@ module turb public :: set_tdc public :: set_semiconvection public :: TDC_arnett_growth_target_mlt - public :: TDC_arnett_growth_target_tdc_no_mlt_corr - public :: TDC_arnett_growth_target_tdc_with_mlt_corr + public :: TDC_arnett_growth_target_tdc contains diff --git a/turb/test/src/test_time_dependence_support.f90 b/turb/test/src/test_time_dependence_support.f90 index 59c63665e..437d8da71 100644 --- a/turb/test/src/test_time_dependence_support.f90 +++ b/turb/test/src/test_time_dependence_support.f90 @@ -3,8 +3,7 @@ module test_time_dependence_support use math_lib use auto_diff use const_def, only: dp, pi, rsun, lsun, msun, kerg, mp, boltz_sigma, standard_cgrav, sqrt_2_div_3 - use turb, only: set_MLT, set_TDC, TDC_arnett_growth_target_mlt, & - TDC_arnett_growth_target_tdc_no_mlt_corr, TDC_arnett_growth_target_tdc_with_mlt_corr + use turb, only: set_MLT, set_TDC, TDC_arnett_growth_target_mlt, TDC_arnett_growth_target_tdc implicit none @@ -31,8 +30,8 @@ module test_time_dependence_support tdc_mode_data('tdc', .false., .false., .false., TDC_arnett_growth_target_mlt), & tdc_mode_data('tdc_with_mlt_corr', .false., .false., .true., TDC_arnett_growth_target_mlt), & tdc_mode_data('tdc_with_arnett_closure', .true., .false., .true., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_arnett_closure_tdc_ss', .true., .false., .false., TDC_arnett_growth_target_tdc_no_mlt_corr), & - tdc_mode_data('tdc_with_arnett_closure_tdc_ss_mlt_corr', .true., .false., .true., TDC_arnett_growth_target_tdc_with_mlt_corr), & + tdc_mode_data('tdc_with_arnett_closure_tdc_ss', .true., .false., .false., TDC_arnett_growth_target_tdc), & + tdc_mode_data('tdc_with_arnett_closure_tdc_ss_mlt_corr', .true., .false., .true., TDC_arnett_growth_target_tdc), & tdc_mode_data('tdc_with_acceleration_limit', .false., .true., .false., TDC_arnett_growth_target_mlt) ] private @@ -1008,10 +1007,8 @@ character(len=32) function growth_target_name(growth_target) result(name) select case (growth_target) case (TDC_arnett_growth_target_mlt) name = 'mlt' - case (TDC_arnett_growth_target_tdc_no_mlt_corr) - name = 'tdc_no_mlt_corr' - case (TDC_arnett_growth_target_tdc_with_mlt_corr) - name = 'tdc_with_mlt_corr' + case (TDC_arnett_growth_target_tdc) + name = 'tdc' case default name = 'unknown' end select diff --git a/turb/test/test_output b/turb/test/test_output index ba6877dc6..7ec162658 100644 --- a/turb/test/test_output +++ b/turb/test/test_output @@ -210,7 +210,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_no_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 @@ -231,7 +231,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_with_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 @@ -349,7 +349,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_no_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397905964313E-01 3.9790596431254168E-06 0.0000000000000000E+00 2.5622791658289248E+02 6.5545214865593907E-02 5.2350368706655104E-08 @@ -371,7 +371,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_with_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000215053E-01 4.0000021504807583E-06 0.0000000000000000E+00 3.5486668024615414E-01 2.3577481558206366E-03 -5.3761439744448572E-12 @@ -488,7 +488,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_no_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 @@ -509,7 +509,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_with_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 @@ -627,7 +627,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss include_mlt_corr_to_tdc = .false. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_no_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744426707885E-01 8.9732188207931824E-08 5.0383392852019933E+04 5.1927077174868406E+04 8.6160247211828300E-01 9.5759066820527439E-01 @@ -649,7 +649,7 @@ Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr include_mlt_corr_to_tdc = .true. use_TDC_arnett_velocity_closure = .true. use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc_with_mlt_corr + TDC_arnett_growth_target = tdc step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744426708129E-01 8.9732190678829608E-08 5.0383392852019933E+04 5.1927077174868406E+04 8.6160247211828356E-01 9.5759066820527394E-01 From 670d07dd3e4a29047bc0e5bd193549e952d0bc73 Mon Sep 17 00:00:00 2001 From: Debraheem Date: Mon, 4 May 2026 14:10:29 -0400 Subject: [PATCH 09/12] add omp protections in tdc hydro and fix tdc_adjust_mass --- star/private/tdc_hydro.f90 | 36 ++++++++++++++++++++++++++++------- star/private/turb_support.f90 | 2 +- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/star/private/tdc_hydro.f90 b/star/private/tdc_hydro.f90 index 9be2e285a..d1259549e 100644 --- a/star/private/tdc_hydro.f90 +++ b/star/private/tdc_hydro.f90 @@ -61,6 +61,7 @@ subroutine set_viscosity_vars_TDC(s, ierr) if (s%use_face_values_eos_and_kap_mlt_tdc) then x = get_TDC_alpha_M_Hp_face(s, k, op_err) if (op_err /= 0) then + !$OMP ATOMIC WRITE ierr = op_err else if (s%Hp_face(k) <= 0d0) then s%Hp_face(k) = x%val @@ -68,7 +69,10 @@ subroutine set_viscosity_vars_TDC(s, ierr) else if (s%Hp_face(k) <= 0d0) then ! this scale height for face is already calculated in TDC s%Hp_face(k) = get_TDC_alpha_M_Hp_face_val(s, k, op_err) ! because this is called before s% scale_height(k) is updated in mlt_vars. - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if end if end do !$OMP END PARALLEL DO @@ -79,12 +83,21 @@ subroutine set_viscosity_vars_TDC(s, ierr) !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) do k = 1, s%nz call build_tdc_Chi_div_w_face_ad(s, k, s%tdc_Chi_div_w_face_ad(k), op_err) - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if call build_tdc_Eq_div_w_face_ad(s, k, s%tdc_Eq_div_w_face_ad(k), op_err) - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if if (s%v_flag) then call build_tdc_Chi_div_w_cell_ad(s, k, s%tdc_Chi_div_w_cell_ad(k), op_err) - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if else s%tdc_Chi_div_w_cell_ad(k) = 0d0 end if @@ -97,15 +110,24 @@ subroutine set_viscosity_vars_TDC(s, ierr) !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) do k = 1, s%nz x = compute_Chi_div_w_face(s, k, op_err) ! Sets Chi_face - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if x = compute_tdc_Eq_div_w_face(s, k, op_err) ! Sets Eq_face - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if if (s% v_flag) then x = compute_tdc_Uq_face(s, k, op_err) else if (s% u_flag) then x = compute_tdc_Uq_dm_cell(s, k, op_err) end if - if (op_err /= 0) ierr = op_err + if (op_err /= 0) then + !$OMP ATOMIC WRITE + ierr = op_err + end if end do !$OMP END PARALLEL DO if (ierr /= 0) then diff --git a/star/private/turb_support.f90 b/star/private/turb_support.f90 index 87002a659..7444b4c72 100644 --- a/star/private/turb_support.f90 +++ b/star/private/turb_support.f90 @@ -50,7 +50,7 @@ logical function check_if_must_fall_back_to_MLT(s, k) result(fallback) integer, intent(in) :: k fallback = .false. - if (s% TDC_adjust_mass_fallback_to_mlt .and. s%mstar_dot > 1d-99 .and. k < s% k_const_mass) then + if (s% TDC_adjust_mass_fallback_to_mlt .and. abs(s%mstar_dot) > 1d-99 .and. k < s% k_const_mass) then fallback = .true. end if end function check_if_must_fall_back_to_MLT From 8fc039878fbffc2c93c11340bf32054d32c2590c Mon Sep 17 00:00:00 2001 From: Debraheem Date: Mon, 4 May 2026 17:40:56 -0400 Subject: [PATCH 10/12] strip changes down to mlt_tdc_faces --- star/defaults/controls_dev.defaults | 76 -- star/private/ctrls_io.f90 | 15 +- star/private/mesh_adjust.f90 | 3 +- star/private/struct_burn_mix.f90 | 1 - star/private/turb_support.f90 | 52 +- star_data/private/star_controls_dev.inc | 5 - turb/Makefile | 3 +- turb/private/tdc.f90 | 230 ++-- turb/private/tdc_support.f90 | 328 +----- turb/public/turb.f90 | 81 +- turb/test/.gitignore | 5 - turb/test/plotter/mesa.mplstyle | 46 - turb/test/plotter/plot_time_dependence.py | 191 --- .../test/src/test_time_dependence_support.f90 | 1039 ----------------- turb/test/src/test_turb.f90 | 91 +- turb/test/test_output | 647 +--------- 16 files changed, 217 insertions(+), 2596 deletions(-) delete mode 100644 turb/test/.gitignore delete mode 100644 turb/test/plotter/mesa.mplstyle delete mode 100644 turb/test/plotter/plot_time_dependence.py delete mode 100644 turb/test/src/test_time_dependence_support.f90 diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 3a96598d4..e578abdfe 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -189,20 +189,6 @@ TDC_use_density_form_for_eddy_viscosity = .false. - ! TDC_adjust_mass_fallback_to_mlt - ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! If TDC_adjust_mass_fallback_to_mlt = .true., use MLT instead of TDC - ! in cells touched by adjust_mass. This preserves the historical fallback - ! for cells where start-of-step convective velocities may be inconsistent - ! with the adjusted mass grid. If false, TDC is used there with the usual - ! start-of-step TDC quantities. - - ! :: - - TDC_adjust_mass_fallback_to_mlt = .true. - - ! use_TDC_enthalpy_flux_limiter ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -214,68 +200,6 @@ use_TDC_enthalpy_flux_limiter = .false. - ! use_TDC_arnett_velocity_closure - ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! If use_TDC_arnett_velocity_closure = .true., use the Arnett 1969 - ! closure for the face convective velocity, in the form presented in Renzo et al. - ! 2020 (ADS: https://ui.adsabs.harvard.edu/abs/2020MNRAS.493.4333R/abstract), - ! which points to equation 11 of Arnett 1969 - ! (ADS: https://ui.adsabs.harvard.edu/abs/1969Ap%26SS...5..180A/abstract). - ! This replaces the Kuhfuss 1986 closure inside TDC, while keeping the - ! same luminosity-balance solve for Y = gradT - gradL. TDC implicitly solves - ! the Arnett 1969 closure in place of the Kuhfuss 1986 closure. - - ! :: - - use_TDC_arnett_velocity_closure = .false. - - - ! TDC_arnett_growth_target - ! ~~~~~~~~~~~~~~~~~~~~~~~~ - - ! Unstable-side steady-state target used by the Arnett 1969 closure in - ! this implementation: - ! 0 = steady-state MLT convective velocity - ! 1 = steady-state Kuhfuss 1986 closure velocity, using the active - ! include_mlt_corr_to_TDC setting - - ! :: - - TDC_arnett_growth_target = 0 - - - ! use_TDC_acceleration_limit - ! ~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! If use_TDC_acceleration_limit = .true., apply a post-solve limit to the - ! TDC convective velocity over a single step: - ! growth is capped by the Kuhfuss 1986 closure steady-state velocity at the - ! solved thermal state, while decay is bounded by the Arnett/Wood stable-side - ! decay law. - - ! :: - - use_TDC_acceleration_limit = .false. - - - ! use_TDC_Y_face_seeded_newton - ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - ! If use_TDC_Y_face_seeded_newton = .true., use the start-of-step TDC - ! Y_face on the first solver iteration, and the previous solver - ! iteration's TDC Y_face thereafter, to try a small local bracket before - ! the usual bracketing path on the positive-Y branch. The seed is only - ! used during structural solver iterations, and only seeds the end-of-step - ! luminosity-balance solve if a small window around the guess brackets the - ! current root. The negative-Y branch always uses the bracketing path - ! because its bracketing logic is part of root selection. - - ! :: - - use_TDC_Y_face_seeded_newton = .false. - - ! use_face_values_eos_and_kap_mlt_tdc ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/star/private/ctrls_io.f90 b/star/private/ctrls_io.f90 index b32980f06..21d1d2bfb 100644 --- a/star/private/ctrls_io.f90 +++ b/star/private/ctrls_io.f90 @@ -108,11 +108,10 @@ module ctrls_io TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, TDC_alpha_M, & TDC_alpha_C, TDC_alpha_S, & TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation, & - TDC_use_density_form_for_eddy_viscosity, TDC_adjust_mass_fallback_to_mlt, & + TDC_use_density_form_for_eddy_viscosity, & TDC_num_innermost_cells_forced_nonturbulent, TDC_num_outermost_cells_forced_nonturbulent, & include_mlt_Pturb_in_thermodynamic_gradients, & - include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, & - TDC_arnett_growth_target, use_TDC_acceleration_limit, use_TDC_Y_face_seeded_newton, & + include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter, & use_face_values_eos_and_kap_mlt_tdc, & TDC_include_eturb_in_energy_equation, & use_rsp_form_of_scale_height, include_mlt_in_velocity_time_centering, & @@ -2095,16 +2094,11 @@ subroutine store_controls(s, ierr) s% TDC_alpha_S = TDC_alpha_S s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation = TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation s% TDC_use_density_form_for_eddy_viscosity = TDC_use_density_form_for_eddy_viscosity - s% TDC_adjust_mass_fallback_to_mlt = TDC_adjust_mass_fallback_to_mlt s% TDC_num_innermost_cells_forced_nonturbulent = TDC_num_innermost_cells_forced_nonturbulent s% TDC_num_outermost_cells_forced_nonturbulent = TDC_num_outermost_cells_forced_nonturbulent s% include_mlt_Pturb_in_thermodynamic_gradients = include_mlt_Pturb_in_thermodynamic_gradients s% include_mlt_corr_to_TDC = include_mlt_corr_to_TDC s% use_TDC_enthalpy_flux_limiter = use_TDC_enthalpy_flux_limiter - s% use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure - s% TDC_arnett_growth_target = TDC_arnett_growth_target - s% use_TDC_acceleration_limit = use_TDC_acceleration_limit - s% use_TDC_Y_face_seeded_newton = use_TDC_Y_face_seeded_newton s% use_face_values_eos_and_kap_mlt_tdc = use_face_values_eos_and_kap_mlt_tdc s% TDC_include_eturb_in_energy_equation = TDC_include_eturb_in_energy_equation s% use_rsp_form_of_scale_height = use_rsp_form_of_scale_height @@ -3812,16 +3806,11 @@ subroutine set_controls_for_writing(s, ierr) TDC_alpha_S = s% TDC_alpha_S TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation = s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation TDC_use_density_form_for_eddy_viscosity = s% TDC_use_density_form_for_eddy_viscosity - TDC_adjust_mass_fallback_to_mlt = s% TDC_adjust_mass_fallback_to_mlt TDC_num_innermost_cells_forced_nonturbulent = s% TDC_num_innermost_cells_forced_nonturbulent TDC_num_outermost_cells_forced_nonturbulent = s% TDC_num_outermost_cells_forced_nonturbulent include_mlt_Pturb_in_thermodynamic_gradients = s% include_mlt_Pturb_in_thermodynamic_gradients include_mlt_corr_to_TDC = s% include_mlt_corr_to_TDC use_TDC_enthalpy_flux_limiter = s% use_TDC_enthalpy_flux_limiter - use_TDC_arnett_velocity_closure = s% use_TDC_arnett_velocity_closure - TDC_arnett_growth_target = s% TDC_arnett_growth_target - use_TDC_acceleration_limit = s% use_TDC_acceleration_limit - use_TDC_Y_face_seeded_newton = s% use_TDC_Y_face_seeded_newton use_face_values_eos_and_kap_mlt_tdc = s% use_face_values_eos_and_kap_mlt_tdc TDC_include_eturb_in_energy_equation = s% TDC_include_eturb_in_energy_equation use_rsp_form_of_scale_height = s% use_rsp_form_of_scale_height diff --git a/star/private/mesh_adjust.f90 b/star/private/mesh_adjust.f90 index ed8d363c1..3e939771a 100644 --- a/star/private/mesh_adjust.f90 +++ b/star/private/mesh_adjust.f90 @@ -715,7 +715,6 @@ subroutine do_L( & ierr = 0 i_lum = s% i_lum if (i_lum == 0) return - n = nzhi - nzlo + 1 do k=1,nz_old @@ -752,7 +751,6 @@ subroutine do_L( & end do end if - end subroutine do_L @@ -1528,6 +1526,7 @@ subroutine get_old_value_integral( & value_old, p, integral, dbg, ierr) end subroutine get_old_value_integral + subroutine get_old_integral( & k_new, k_old_in, nz_old, xq_old, dq_old, xq_outer, dq_range, & value_old, xh_old, integral, dbg, ierr) diff --git a/star/private/struct_burn_mix.f90 b/star/private/struct_burn_mix.f90 index 0aef11946..de0ef0b8f 100644 --- a/star/private/struct_burn_mix.f90 +++ b/star/private/struct_burn_mix.f90 @@ -320,7 +320,6 @@ subroutine save_start_values(s, ierr) s% u_face_start(k) = 0d0 ! s% u_face_ad(k)%val s% P_face_start(k) = -1d0 ! mark as unset s% P_face_ad(k)%val s% L_start(k) = s% L(k) - s% Y_face_start(k) = s% Y_face(k) s% omega_start(k) = s% omega(k) s% ye_start(k) = s% ye(k) s% j_rot_start(k) = s% j_rot(k) diff --git a/star/private/turb_support.f90 b/star/private/turb_support.f90 index 7444b4c72..66b2982d0 100644 --- a/star/private/turb_support.f90 +++ b/star/private/turb_support.f90 @@ -38,9 +38,9 @@ module turb_support !> Determines if it is safe (physically) to use TDC instead of MLT. !! - !! By default, fall back to MLT in cells that get touched by adjust_mass, - !! because there the convection speeds at the start of the step can be - !! badly out of whack. + !! Currently we only know we have to fall back to MLT in cells that get touched + !! by adjust_mass, because there the convection speeds at the start of the + !! step can be badly out of whack. !! !! @param s star pointer !! @param k face index @@ -50,7 +50,7 @@ logical function check_if_must_fall_back_to_MLT(s, k) result(fallback) integer, intent(in) :: k fallback = .false. - if (s% TDC_adjust_mass_fallback_to_mlt .and. abs(s%mstar_dot) > 1d-99 .and. k < s% k_const_mass) then + if (abs(s%mstar_dot) > 1d-99 .and. k < s% k_const_mass) then fallback = .true. end if end function check_if_must_fall_back_to_MLT @@ -223,13 +223,14 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg integer, intent(out) :: ierr type(auto_diff_real_star_order1) :: Pr, Pg, grav, Lambda, gradL, beta - real(dp) :: conv_vel_start, scale, max_conv_vel, Y_face_guess + real(dp) :: conv_vel_start, scale, max_conv_vel ! these are used by use_superad_reduction real(dp) :: Gamma_limit, scale_value1, scale_value2, diff_grads_limit, reduction_limit, lambda_limit type(auto_diff_real_star_order1) :: Lrad_div_Ledd, Gamma_inv_threshold, Gamma_factor, alfa0, & diff_grads_factor, Gamma_term, exp_limit, grad_scale, gradr_scaled, Eq_div_w, check_Eq, mlt_Pturb, Ptot - logical :: test_partials, using_TDC, report, have_Y_face_guess + logical :: test_partials, using_TDC + logical, parameter :: report = .false. include 'formats' ! check if this particular k can be done with TDC @@ -239,8 +240,6 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg if (k <= 0 .or. s%dt <= 0d0) using_TDC = .false. if (using_TDC) using_TDC = .not. check_if_must_fall_back_to_MLT(s, k) - report = .false. - ! Pre-calculate some things. Eq_div_w = 0d0 if ((s% v_flag .or. s% u_flag) .and. k > 0 ) then ! only include Eq_div_w if v_flag or u_flag is true. @@ -324,16 +323,7 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg else conv_vel_start = s% mlt_vc(k) end if - have_Y_face_guess = s% use_TDC_Y_face_seeded_newton .and. s% doing_solver_iterations - if (have_Y_face_guess) then - if (s% solver_iter == 0) then - Y_face_guess = s% Y_face_start(k) - else - Y_face_guess = s% Y_face(k) - end if - else - Y_face_guess = 0d0 - end if + ! Set scale for judging the TDC luminosity equation Q(Y)=0. ! Q has units of a luminosity, so the scale should be a luminosity. if (s% solver_iter == 0) then @@ -343,22 +333,19 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg end if call set_TDC(& - conv_vel_start, s%Y_face_start(k), mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & + conv_vel_start, mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & s%dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr, r, Ptot, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & - s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & - s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, & - s% TDC_arnett_growth_target, & - energy, ierr, have_Y_face_guess, Y_face_guess) - - if (ierr /= 0) then - if (s% report_ierr) write(*,*) 'ierr from set_TDC' - return - end if + s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, energy, ierr) s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt + if (ierr /= 0) then + if (s% report_ierr) write(*,*) 'ierr from set_TDC' + return + end if + ! Experimental method to lower superadiabaticity. Call TDC again with an artificially reduced ! gradr if the resulting gradT would lead to the radiative luminosity approaching the Eddington ! limit, or when a density inversion is expected to happen. @@ -367,20 +354,17 @@ subroutine Get_results(s, k, MLT_option, & ! NOTE: k=0 is a valid arg call set_superad_reduction if (Gamma_factor > 1d0) then call set_TDC(& - conv_vel_start, s%Y_face_start(k), mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & + conv_vel_start, mixing_length_alpha, s%TDC_alpha_D, s%TDC_alpha_R, s%TDC_alpha_Pt, & s%dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr_scaled, r, Ptot, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, s%tdc_num_iters(k), max_conv_vel, & Eq_div_w, grav, & - s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, & - s% use_TDC_arnett_velocity_closure, s% use_TDC_acceleration_limit, & - s% TDC_arnett_growth_target, & - energy, ierr, have_Y_face_guess, Y_face_guess) + s% include_mlt_corr_to_TDC, s% TDC_alpha_C, s% TDC_alpha_S, s% use_TDC_enthalpy_flux_limiter, energy, ierr) + s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt if (ierr /= 0) then if (s% report_ierr) write(*,*) 'ierr from set_TDC when using superad_reduction' return end if - s% dvc_dt_TDC(k) = (conv_vel%val - conv_vel_start) / s%dt end if end if diff --git a/star_data/private/star_controls_dev.inc b/star_data/private/star_controls_dev.inc index 2e6969b78..d778d43bc 100644 --- a/star_data/private/star_controls_dev.inc +++ b/star_data/private/star_controls_dev.inc @@ -2,14 +2,9 @@ logical :: compare_TDC_to_MLT logical :: TDC_use_density_form_for_eddy_viscosity - logical :: TDC_adjust_mass_fallback_to_mlt logical :: include_mlt_Pturb_in_thermodynamic_gradients logical :: use_TDC_enthalpy_flux_limiter - logical :: use_TDC_arnett_velocity_closure - logical :: use_TDC_acceleration_limit - logical :: use_TDC_Y_face_seeded_newton logical :: use_face_values_eos_and_kap_mlt_tdc - integer :: TDC_arnett_growth_target logical :: include_mlt_in_velocity_time_centering logical :: use_hydro_merge_limits_in_mesh_plan diff --git a/turb/Makefile b/turb/Makefile index 4ace0bc5f..1f168d2d6 100644 --- a/turb/Makefile +++ b/turb/Makefile @@ -9,8 +9,7 @@ SRCS := public/turb.f90 \ private/tdc.f90 \ private/thermohaline.f90 \ private/semiconvection.f90 -SRCS_CHECK := test/src/test_time_dependence_support.f90 \ - test/src/test_turb.f90 +SRCS_CHECK := test/src/test_turb.f90 INTERNAL_DEPENDS_ON := const utils auto_diff num chem # Test dependency INTERNAL_DEPENDS_ON += math diff --git a/turb/private/tdc.f90 b/turb/private/tdc.f90 index 377ed61aa..d8bfa7daa 100644 --- a/turb/private/tdc.f90 +++ b/turb/private/tdc.f90 @@ -47,17 +47,12 @@ module tdc !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. !! @param ierr Tracks errors (output). - !! @param have_Y_face_guess If true, use Y_face_guess to try a small local positive-Y bracket. - !! @param Y_face_guess Candidate superadiabaticity for the local solve. - subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr, & - have_Y_face_guess, Y_face_guess) + subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr) type(tdc_info), intent(in) :: info real(dp), intent(in) :: scale type(auto_diff_real_tdc), intent(in) :: Zlb, Zub type(auto_diff_real_star_order1),intent(out) :: conv_vel, Y_face integer, intent(out) :: tdc_num_iters, ierr - logical, intent(in), optional :: have_Y_face_guess - real(dp), intent(in), optional :: Y_face_guess logical :: Y_is_positive type(auto_diff_real_tdc) :: Af, Y, Y0, Y1, Z0, Z1, radY @@ -100,10 +95,9 @@ subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_ite ! Start down the chain of logic... if (Y_is_positive) then ! If Y > 0 then Q(Y) is monotone and we can jump straight to the search. - call bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr, & - have_Y_face_guess, Y_face_guess) - if (ierr /= 0) return + call bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr) Y = convert(Y_face) + if (ierr /= 0) return if (info%report) write(*,*) 'Y is positive, Y=',Y_face%val else if (info%report) write(*,*) 'Y is negative.' @@ -216,7 +210,6 @@ subroutine get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_ite ! Process Y into the various outputs. call compute_Q(info, Y, Q, Af) - if (info%use_TDC_acceleration_limit) call apply_postsolve_TDC_acceleration_limit(info, Y, Af) Y_face = unconvert(Y) conv_vel = sqrt_2_div_3*unconvert(Af) @@ -234,10 +227,7 @@ end subroutine get_TDC_solution !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. !! @param ierr Tracks errors (output). - !! @param have_Y_face_guess If true, use Y_face_guess to try a small local positive-Y bracket. - !! @param Y_face_guess Candidate superadiabaticity for the local solve. - subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr, & - have_Y_face_guess, Y_face_guess) + subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_face, Af, tdc_num_iters, ierr) type(tdc_info), intent(in) :: info logical, intent(in) :: Y_is_positive real(dp), intent(in) :: scale @@ -246,163 +236,117 @@ subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_fa type(auto_diff_real_tdc), intent(out) :: Af integer, intent(out) :: tdc_num_iters integer, intent(out) :: ierr - logical, intent(in), optional :: have_Y_face_guess - real(dp), intent(in), optional :: Y_face_guess - type(auto_diff_real_tdc) :: Y, Z, Q, Qc, Q_lb, Q_ub, Z_new, correction, lower_bound_Z, upper_bound_Z, & - Z_seed, Z_seed_lb, Z_seed_ub + type(auto_diff_real_tdc) :: Y, Z, Q, Qc, Z_new, correction, lower_bound_Z, upper_bound_Z type(auto_diff_real_tdc) :: dQdZ - integer :: iter, line_iter, i_try, num_tries - logical :: converged, have_derivatives, corr_has_derivatives, use_seed, doing_seed, bad_seed_bracket + integer :: iter, line_iter + logical :: converged, have_derivatives, corr_has_derivatives real(dp), parameter :: correction_tolerance = 1d-13 real(dp), parameter :: residual_tolerance = 1d-8 - real(dp), parameter :: seed_bracket_half_width = 3d0 integer, parameter :: max_iter = 200 integer, parameter :: max_line_search_iter = 5 include 'formats' ierr = 0 - use_seed = .false. - if (Y_is_positive .and. present(have_Y_face_guess) .and. present(Y_face_guess)) then - if (have_Y_face_guess .and. .not. is_bad(Y_face_guess) .and. Y_face_guess > 0d0) then - Z_seed = log(Y_face_guess) - use_seed = .not. is_bad(Z_seed%val) .and. Z_seed%val >= Zlb%val .and. Z_seed%val <= Zub%val + + ! We start by bisecting to find a narrow interval around the root. + lower_bound_Z = Zlb + upper_bound_Z = Zub + + ! Perform bisection search. + call Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Z, ierr) + if (ierr /= 0) return + + ! Set up Z from bisection search + Z%d1val1 = 1d0 ! Set derivative dZ/dZ=1 for Newton iterations. + if (info%report) write(*,*) 'Z from bisection search', Z%val + if (info%report) write(*,*) 'lower_bound_Z, upper_bound_Z',lower_bound_Z%val,upper_bound_Z%val + + ! Now we refine the solution with a Newton solve. + ! This also let's us pick up the derivative of the solution with respect to input parameters. + + ! Initialize starting values for TDC Newton iterations. + dQdz = 0d0 + converged = .false. + have_derivatives = .false. ! Tracks if we've done at least one Newton iteration. + ! Need to do this before returning to endow Y with partials + ! with respect to the structure variables. + do iter = 1, max_iter + Y = set_Y(Y_is_positive, Z) + call compute_Q(info, Y, Q, Af) + + if (abs(Q%val)/scale <= residual_tolerance .and. have_derivatives) then + ! Can't exit on the first iteration, otherwise we have no derivative information. + if (info%report) write(*,2) 'converged', iter, abs(Q%val)/scale, residual_tolerance + converged = .true. + exit end if - end if - if (use_seed) then - Z_seed_lb = max(Zlb%val, Z_seed%val - seed_bracket_half_width) - Z_seed_ub = min(Zub%val, Z_seed%val + seed_bracket_half_width) - end if - num_tries = 1 - if (use_seed) num_tries = 2 - - attempt_loop: do i_try = 1, num_tries - doing_seed = use_seed .and. i_try == 1 - - ! Try a small bracket around the Y_face guess, or - ! use the full interval if that does not bracket the current root. - ierr = 0 - if (doing_seed) then - lower_bound_Z = Z_seed_lb - upper_bound_Z = Z_seed_ub - Y = set_Y(Y_is_positive, lower_bound_Z) - call compute_Q(info, Y, Q_lb, Af) - Y = set_Y(Y_is_positive, upper_bound_Z) - call compute_Q(info, Y, Q_ub, Af) - bad_seed_bracket = is_bad(Q_lb%val) .or. is_bad(Q_ub%val) - if (.not. bad_seed_bracket) bad_seed_bracket = Q_lb * Q_ub > 0d0 - if (bad_seed_bracket) cycle attempt_loop - Z = Z_seed - if (info%report) write(*,*) 'Z from Y_face guess', Z%val + ! We use the fact that Q(Y) is monotonic to iteratively refined bounds on Q. + dQdZ = differentiate_1(Q) + if (Q > 0d0 .and. dQdZ < 0d0) then + lower_bound_Z = Z + else if (Q > 0d0 .and. dQdZ > 0d0) then + upper_bound_Z = Z + else if (Q < 0d0 .and. dQdZ < 0d0) then + upper_bound_Z = Z else - lower_bound_Z = Zlb - upper_bound_Z = Zub - call Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Z, ierr) - if (ierr /= 0) return - if (info%report) write(*,*) 'Z from bisection search', Z%val + lower_bound_Z = Z end if - Z%d1val1 = 1d0 ! Set derivative dZ/dZ=1 for Newton iterations. - if (info%report) write(*,*) 'lower_bound_Z, upper_bound_Z',lower_bound_Z%val,upper_bound_Z%val - - ! Now we refine the solution with a Newton solve. - ! This also lets us pick up the derivative of the solution with respect to input parameters. - dQdz = 0d0 - converged = .false. - have_derivatives = .false. ! Tracks if we've done at least one Newton iteration. - ! Need to do this before returning to endow Y with partials - ! with respect to the structure variables. - do iter = 1, max_iter - Y = set_Y(Y_is_positive, Z) - call compute_Q(info, Y, Q, Af) - if (is_bad(Q%val)) then - ierr = 1 - exit - end if + if (is_bad(dQdZ%val) .or. abs(dQdZ%val) < 1d-99) then + ierr = 1 + exit + end if + + correction = -Q/dQdz + corr_has_derivatives = .true. - if (abs(Q%val)/scale <= residual_tolerance .and. have_derivatives) then - ! Can't exit on the first iteration, otherwise we have no derivative information. - if (info%report) write(*,2) 'converged', iter, abs(Q%val)/scale, residual_tolerance + ! Do a line search to avoid steps that are too big. + do line_iter=1,max_line_search_iter + + if (abs(correction) < correction_tolerance .and. have_derivatives) then + ! Can't get much more precision than this. converged = .true. exit end if - ! We use the fact that Q(Y) is monotonic to iteratively refined bounds on Q. - dQdZ = differentiate_1(Q) - if (Q > 0d0 .and. dQdZ < 0d0) then - lower_bound_Z = Z - else if (Q > 0d0 .and. dQdZ > 0d0) then - upper_bound_Z = Z - else if (Q < 0d0 .and. dQdZ < 0d0) then - upper_bound_Z = Z - else - lower_bound_Z = Z + Z_new = Z + correction + if (corr_has_derivatives) then + have_derivatives = .true. end if - if (is_bad(dQdZ%val) .or. abs(dQdZ%val) < 1d-99) then - ierr = 1 - exit + ! If the correction pushes the solution out of bounds then we know + ! that was a bad step. Bad steps are still in the same direction, they just + ! go too far, so we replace that result with one that's halfway to the relevant bound. + if (Z_new > upper_bound_Z) then + Z_new = (Z + upper_bound_Z) / 2d0 + else if (Z_new < lower_bound_Z) then + Z_new = (Z + lower_bound_Z) / 2d0 end if - correction = -Q/dQdz - corr_has_derivatives = .true. - - ! Do a line search to avoid steps that are too big. - do line_iter=1,max_line_search_iter - - if (abs(correction) < correction_tolerance .and. have_derivatives) then - ! Can't get much more precision than this. - converged = .true. - exit - end if - - Z_new = Z + correction - if (corr_has_derivatives) then - have_derivatives = .true. - end if - - ! If the correction pushes the solution out of bounds then we know - ! that was a bad step. Bad steps are still in the same direction, they just - ! go too far, so we replace that result with one that's halfway to the relevant bound. - if (Z_new > upper_bound_Z) then - Z_new = (Z + upper_bound_Z) / 2d0 - else if (Z_new < lower_bound_Z) then - Z_new = (Z + lower_bound_Z) / 2d0 - end if - - Y = set_Y(Y_is_positive,Z_new) - - call compute_Q(info, Y, Qc, Af) + Y = set_Y(Y_is_positive,Z_new) - if (is_bad(Qc%val)) then - correction = 0.5d0 * correction - else if (abs(Qc) < abs(Q)) then - exit - else - correction = 0.5d0 * correction - end if - end do + call compute_Q(info, Y, Qc, Af) - if (info%report) write(*,3) 'i, li, Z_new, Z, low_bnd, upr_bnd, Q, dQdZ, corr', iter, line_iter, & - Z_new%val, Z%val, lower_bound_Z%val, upper_bound_Z%val, Q%val, dQdZ%val, correction%val - Z_new%d1val1 = 1d0 ! Ensures that dZ/dZ = 1. - Z = Z_new + if (abs(Qc) < abs(Q)) then + exit + else + correction = 0.5d0 * correction + end if + end do - Y = set_Y(Y_is_positive,Z) - if (converged) exit + if (info%report) write(*,3) 'i, li, Z_new, Z, low_bnd, upr_bnd, Q, dQdZ, corr', iter, line_iter, & + Z_new%val, Z%val, lower_bound_Z%val, upper_bound_Z%val, Q%val, dQdZ%val, correction%val + Z_new%d1val1 = 1d0 ! Ensures that dZ/dZ = 1. + Z = Z_new - end do + Y = set_Y(Y_is_positive,Z) + if (converged) exit - if (converged .and. doing_seed) then - call compute_Q(info, Y, Q, Af) - if (abs(Q%val)/scale > residual_tolerance) converged = .false. - if (is_bad(Y%val) .or. any(is_bad(Y%d1Array)) .or. & - is_bad(Af%val) .or. any(is_bad(Af%d1Array))) converged = .false. - end if - if (converged) exit attempt_loop - if (doing_seed) cycle attempt_loop + end do + if (.not. converged) then ierr = 1 if (info%report) then !$OMP critical (tdc_crit0) @@ -427,7 +371,7 @@ subroutine bracket_plus_Newton_search(info, scale, Y_is_positive, Zlb, Zub, Y_fa !$OMP end critical (tdc_crit0) end if return - end do attempt_loop + end if ! Unpack output Y_face = unconvert(Y) diff --git a/turb/private/tdc_support.f90 b/turb/private/tdc_support.f90 index d2bf890a2..99d02e5b7 100644 --- a/turb/private/tdc_support.f90 +++ b/turb/private/tdc_support.f90 @@ -26,9 +26,6 @@ module tdc_support implicit none -integer, parameter :: TDC_arnett_growth_target_mlt = 0 -integer, parameter :: TDC_arnett_growth_target_tdc = 1 - private public :: set_Y public :: Q_bisection_search @@ -41,9 +38,6 @@ module tdc_support public :: eval_Af public :: eval_xis public :: compute_Q -public :: apply_postsolve_TDC_acceleration_limit -public :: TDC_arnett_growth_target_mlt -public :: TDC_arnett_growth_target_tdc !> Stores the information which is required to evaluate TDC-related quantities and which !! do not depend on Y. @@ -69,62 +63,13 @@ module tdc_support !! @param Gamma Gamma is the MLT Gamma efficiency parameter, which we evaluate in steady state from MLT. type tdc_info logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter - logical :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit - integer :: TDC_arnett_growth_target real(dp) :: mixing_length_alpha, TDC_alpha_C, TDC_alpha_S, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, e - type(auto_diff_real_tdc) :: A0, A_mlt, c0, L, L0, gradL, grada, Y_start - type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h, grav, chiT, chiRho, r + type(auto_diff_real_tdc) :: A0, c0, L, L0, gradL, grada + type(auto_diff_real_star_order1) :: T, rho, dV, Cp, kap, Hp, Gamma, Eq_div_w, P, h end type tdc_info contains - subroutine eval_Af_state(dt, A0, xi0, xi1, xi2, Af) - type(auto_diff_real_tdc), intent(in) :: dt, A0, xi0, xi1, xi2 - type(auto_diff_real_tdc), intent(out) :: Af - - type(auto_diff_real_tdc) :: J, J2, Jt4, num, den, y_for_atan, root - - if (dt%val <= 0d0) then - Af = A0 - return - end if - - J2 = pow2(xi1) - 4d0 * xi0 * xi2 - - if (J2 > 0d0) then - J = sqrt(abs(J2)) - Jt4 = 0.25d0 * dt * J - num = safe_tanh(Jt4) * (2d0 * xi0 + A0 * xi1) + A0 * J - den = safe_tanh(Jt4) * (xi1 + 2d0 * A0 * xi2) - J - Af = num / den - if (Af < 0d0) Af = -Af - else if (J2 < 0d0) then - J = sqrt(abs(J2)) - Jt4 = 0.25d0 * dt * J - - y_for_atan = xi1 + 2d0 * A0 * xi2 - root = atan(xi1 / J) - atan(y_for_atan / J) - - if (root > pi) then - root = root - pi - else if (root < -pi) then - root = root + 2d0*pi - else if (root < 0d0) then - root = root + pi - end if - - if (Jt4 < root) then - num = -xi1 + J * tan(Jt4 + atan(y_for_atan / J)) - den = 2d0 * xi2 - Af = num / den - else - Af = 0d0 - end if - else - Af = A0 - end if - end subroutine eval_Af_state - !> Y = +- exp(Z) !! If Y > 0, Y = exp(Z) !! If Y < 0, Y = -exp(Z) @@ -183,11 +128,6 @@ subroutine Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Y = set_Y(Y_is_positive, upper_bound_Z) call compute_Q(info, Y, Q_ub, Af) - if (is_bad(Q_lb%val) .or. is_bad(Q_ub%val)) then - ierr = 1 - return - end if - ! Check to make sure that the lower and upper bounds on Z actually bracket ! a solution to Q(Y(Z)) = 0. if (Q_lb * Q_ub > 0d0) then @@ -217,10 +157,6 @@ subroutine Q_bisection_search(info, Y_is_positive, lower_bound_Z, upper_bound_Z, Y = set_Y(Y_is_positive, Z) call compute_Q(info, Y, Q, Af) - if (is_bad(Q%val)) then - ierr = 1 - return - end if if (Q > 0d0 .and. Q_ub > 0d0) then upper_bound_Z = Z @@ -510,51 +446,9 @@ type(auto_diff_real_star_order1) function unconvert(K_in) result(K) K%d1Array = K_in%d1Array(1:SIZE(K%d1Array)) end function unconvert - type(auto_diff_real_tdc) function eval_A_target_arnett_growth(info, Y) result(A_target) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: Y - - select case (info%TDC_arnett_growth_target) - case (TDC_arnett_growth_target_mlt) - A_target = info%A_mlt - case (TDC_arnett_growth_target_tdc) - A_target = eval_Af_tdc_steady_state(info, Y) - case default - call mesa_error(__FILE__,__LINE__,'bad TDC_arnett_growth_target') - end select - end function eval_A_target_arnett_growth - - type(auto_diff_real_tdc) function eval_Af_single_state(info, Y, A_start, dt_step) result(Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: Y, A_start, dt_step - type(auto_diff_real_tdc) :: xi0, xi1, xi2, Y_env, A_target - - if (dt_step%val <= 0d0) then - Af = A_start - return - end if - - if (info%use_TDC_arnett_velocity_closure) then - if (Y > 0d0) then - A_target = eval_A_target_arnett_growth(info, Y) - Af = eval_Af_arnett_growth_to_target_step(info, dt_step, A_start, A_target) - else - Af = eval_Af_arnett_decay_from_state_step(info, dt_step, Y, A_start) - end if - else - if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then - Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) - else - Y_env = Y - end if - call eval_xis(info, Y_env, xi0, xi1, xi2) - Af = eval_Af_ad(dt_step, A_start, xi0, xi1, xi2) - end if - end function eval_Af_single_state - !> Q is the residual in the TDC equation, namely: !! - !! Q = (L - L0 * gradL) - L0 * Y - c0 * Af * Y_env + !! Q = (L - L0 * gradL) - (L0 + c0 * Af) * Y !! !! @param info tdc_info type storing various quantities that are independent of Y. !! @param Y superadiabaticity @@ -564,7 +458,8 @@ subroutine compute_Q(info, Y, Q, Af) type(tdc_info), intent(in) :: info type(auto_diff_real_tdc), intent(in) :: Y type(auto_diff_real_tdc), intent(out) :: Q, Af - type(auto_diff_real_tdc) :: Y_env, dt_step + type(auto_diff_real_tdc) :: xi0, xi1, xi2, Y_env + real(dp), parameter :: x_ALFAS = (1.d0/2.d0)*sqrt_2_div_3 ! Y = grad-gradL ! Gamma=(grad-gradE)/(gradE-gradL) @@ -575,13 +470,15 @@ subroutine compute_Q(info, Y, Q, Af) ! We only use Y_env /= Y when Y > 0 (i.e. the system is convectively unstable) ! because we only have a Gamma from MLT in that case. ! so when Y < 0 we just use Y_env = Y. - if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then + if (Y > 0 .and. info%include_mlt_corr_to_TDC) then Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) else Y_env = Y end if - dt_step = info%dt - Af = eval_Af_single_state(info, Y, info%A0, dt_step) + + ! Y_env sets the acceleration of blobs. + call eval_xis(info, Y_env, xi0, xi1, xi2) + Af = eval_Af(info%dt, info%A0, xi0, xi1, xi2) ! Y_env sets the convective flux but not the radiative flux. Q = (info%L - info%L0*info%gradL) - info%L0 * Y - info%c0*Af*Y_env @@ -619,7 +516,7 @@ subroutine eval_xis(info, Y, xi0, xi1, xi2) type(tdc_info), intent(in) :: info type(auto_diff_real_tdc), intent(in) :: Y type(auto_diff_real_tdc), intent(out) :: xi0, xi1, xi2 - type(auto_diff_real_tdc) :: S0, D0, DR0, Lambda_diss + type(auto_diff_real_tdc) :: S0, D0, DR0 type(auto_diff_real_star_order1) :: gammar_div_alfa, Pt0, dVdt type(auto_diff_real_tdc) :: X, FL, scale real(dp), parameter :: x_ALFAS = (1.d0/2.d0)*sqrt_2_div_3 @@ -654,8 +551,7 @@ subroutine eval_xis(info, Y, xi0, xi1, xi2) S0 = S0*Y + convert(info%Eq_div_w) end if - Lambda_diss = convert(info%mixing_length_alpha*info%Hp) - D0 = info%TDC_alpha_D*x_CEDE/Lambda_diss + D0 = convert(info%TDC_alpha_D*x_CEDE/(info%mixing_length_alpha*info%Hp)) gammar_div_alfa = info%TDC_alpha_R*x_GAMMAR/(info%mixing_length_alpha*info%Hp) DR0 = convert(4d0*boltz_sigma*pow2(gammar_div_alfa)*pow3(info%T)/(pow2(info%rho)*info%Cp*info%kap)) Pt0 = info%TDC_alpha_Pt*x_ALFAP*info%rho @@ -734,174 +630,52 @@ function eval_Af(dt, A0, xi0, xi1, xi2) result(Af) real(dp), intent(in) :: dt type(auto_diff_real_tdc), intent(in) :: A0, xi0, xi1, xi2 type(auto_diff_real_tdc) :: Af ! output - type(auto_diff_real_tdc) :: dt_ad + type(auto_diff_real_tdc) :: J2, J, Jt4, num, den, y_for_atan, root - dt_ad = dt - Af = eval_Af_ad(dt_ad, A0, xi0, xi1, xi2) - end function eval_Af - - type(auto_diff_real_tdc) function eval_Af_ad(dt, A0, xi0, xi1, xi2) result(Af) - type(auto_diff_real_tdc), intent(in) :: dt, A0, xi0, xi1, xi2 - - call eval_Af_state(dt, A0, xi0, xi1, xi2, Af) - - end function eval_Af_ad - - !> Calculates the end-of-step convective speed on the unstable side for - !! the Arnett 1969 closure, given a steady-state target speed. - !! - !! @param info tdc_info type storing various quantities that are independent of Y. - !! @param A_target The steady-state target convective speed. - type(auto_diff_real_tdc) function eval_Af_arnett_growth_to_target(info, A_target) result(Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: A_target - type(auto_diff_real_tdc) :: dt_step - - dt_step = info%dt - Af = eval_Af_arnett_growth_to_target_step(info, dt_step, info%A0, A_target) - end function eval_Af_arnett_growth_to_target - - type(auto_diff_real_tdc) function eval_Af_arnett_growth_to_target_step(info, dt_step, A_start, A_target) result(Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: dt_step, A_start, A_target - type(auto_diff_real_tdc) :: Lambda, eta, coeff, disc - real(dp), parameter :: tiny = 1d-30 - - Lambda = convert(info%mixing_length_alpha*info%Hp) - if (Lambda%val <= tiny .or. dt_step%val <= 0d0) then - Af = A_start - return - end if - - eta = dt_step/Lambda - coeff = A_start + eta*pow2(A_target) - if (coeff%val <= 0d0) then - Af = 0d0 - else - disc = sqrt(1d0 + 4d0*eta*coeff) - Af = 2d0*coeff/(1d0 + disc) - end if - end function eval_Af_arnett_growth_to_target_step - - !> Calculates the end-of-step convective speed on the stable side for - !! the Arnett 1969 closure, given a reference buoyancy state and - !! a starting convective speed. - !! - !! @param info tdc_info type storing various quantities that are independent of Y. - !! @param Y_ref Reference superadiabaticity used to set the stable-side decay rate. - !! @param A_start Starting convective speed for the decay step. - type(auto_diff_real_tdc) function eval_Af_arnett_decay_from_state(info, Y_ref, A_start) result(Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: Y_ref - type(auto_diff_real_tdc), intent(in) :: A_start - type(auto_diff_real_tdc) :: dt_step - - dt_step = info%dt - Af = eval_Af_arnett_decay_from_state_step(info, dt_step, Y_ref, A_start) - end function eval_Af_arnett_decay_from_state - - type(auto_diff_real_tdc) function eval_Af_arnett_decay_from_state_step(info, dt_step, Y_ref, A_start) result(Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: dt_step, Y_ref, A_start - type(auto_diff_real_tdc) :: Lambda, eta, coeff, disc, N2, N - real(dp), parameter :: tiny = 1d-30 - - Lambda = convert(info%mixing_length_alpha*info%Hp) - if (Lambda%val <= tiny .or. dt_step%val <= 0d0) then - Af = A_start - return - end if - - eta = dt_step/Lambda - N2 = -Y_ref*convert(info%chiT/info%chiRho*info%grav/info%Hp) - if (N2 > 0d0) then - N = sqrt(N2) - else - N = 0d0 - end if - coeff = 1d0 + dt_step*N - if (A_start%val <= 0d0) then - Af = 0d0 - else - disc = sqrt(pow2(coeff) + 4d0*eta*A_start) - Af = 2d0*A_start/(coeff + disc) - end if - end function eval_Af_arnett_decay_from_state_step - - !> Calculates the steady-state convective speed for the Kuhfuss 1986 - !! closure at fixed Y. - !! - !! @param info tdc_info type storing various quantities that are independent of Y. - !! @param Y Superadiabaticity. - type(auto_diff_real_tdc) function eval_Af_tdc_steady_state(info, Y) result(Af_ss) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(in) :: Y - type(auto_diff_real_tdc) :: Y_env, xi0, xi1, xi2, J2, J, root1, root2 - real(dp), parameter :: tiny = 1d-30 - - if (Y > 0d0 .and. info%include_mlt_corr_to_TDC) then - Y_env = Y * convert(info%Gamma/(1d0+info%Gamma)) - else - Y_env = Y - end if - - call eval_xis(info, Y_env, xi0, xi1, xi2) + J2 = pow2(xi1) - 4d0 * xi0 * xi2 - Af_ss = 0d0 - if (abs(xi2%val) <= tiny) then - if (abs(xi1%val) > tiny) then - root1 = -xi0/xi1 - if (root1 > Af_ss) Af_ss = root1 + if (J2 > 0d0) then ! Hyperbolic branch + J = sqrt(abs(J2)) ! Only compute once we know J2 is not 0 + Jt4 = 0.25d0 * dt * J + num = safe_tanh(Jt4) * (2d0 * xi0 + A0 * xi1) + A0 * J + den = safe_tanh(Jt4) * (xi1 + 2d0 * A0 * xi2) - J + Af = num / den + if (Af < 0d0) then + Af = -Af end if - return - end if + else if (J2 < 0d0) then ! Trigonometric branch + J = sqrt(abs(J2)) ! Only compute once we know J2 is not 0 + Jt4 = 0.25d0 * dt * J - J2 = pow2(xi1) - 4d0*xi0*xi2 - if (J2 <= 0d0) return + ! This branch contains decaying solutions that reach A = 0, at which point + ! they switch onto the 'zero' branch. So we have to calculate the position of + ! the first root to check it against dt. + y_for_atan = xi1 + 2d0 * A0 * xi2 + root = atan(xi1 / J) - atan(y_for_atan / J) - J = sqrt(J2) - root1 = (-xi1 + J)/(2d0*xi2) - root2 = (-xi1 - J)/(2d0*xi2) - if (root1 > Af_ss) Af_ss = root1 - if (root2 > Af_ss) Af_ss = root2 - end function eval_Af_tdc_steady_state + ! The root enters into a tangent, so we can freely shift it by pi and + ! get another root. We care about the first positive root, and the above prescription + ! is guaranteed to give an answer between (-2*pi,2*pi) because atan produces an answer in [-pi,pi], + ! so we add/subtract a multiple of pi to get the root into [0,pi). + if (root > pi) then + root = root - pi + else if (root < -pi) then + root = root + 2d0*pi + else if (root < 0d0) then + root = root + pi + end if - !> Applies the optional post-solve acceleration limit to the TDC convective - !! speed and then recomputes Y from the luminosity balance at fixed Af. - !! - !! On the growth side the target is evaluated from the end-of-step TDC state. - !! On the decay side the target uses the explicit start-of-step thermal state. - !! - !! @param info tdc_info type storing various quantities that are independent of Y. - !! @param Y On input, the solved superadiabaticity. On output, the value - !! consistent with the limited convective speed. - !! @param Af On input, the solved convective speed variable. On output, the - !! limited convective speed variable. - subroutine apply_postsolve_TDC_acceleration_limit(info, Y, Af) - type(tdc_info), intent(in) :: info - type(auto_diff_real_tdc), intent(inout) :: Y, Af - type(auto_diff_real_tdc) :: Af_bound, Af_target, Af_excess0, numer, denom, Y_env_factor - real(dp), parameter :: tiny = 1d-30 - - Af_target = eval_Af_tdc_steady_state(info, Y) - - if (Af_target > info%A0 + tiny) then - Af_bound = eval_Af_arnett_growth_to_target(info, Af_target) - if (Af_bound < Af) Af = max(0d0, Af_bound) - else if (Af_target < info%A0 - tiny) then - Af_excess0 = info%A0 - Af_target - Af_bound = Af_target + eval_Af_arnett_decay_from_state(info, info%Y_start, Af_excess0) - if (Af_bound > Af) Af = max(0d0, Af_bound) + if (Jt4 < root) then + num = -xi1 + J * tan(Jt4 + atan(y_for_atan / J)) + den = 2d0 * xi2 + Af = num / den + else + Af = 0d0 + end if + else ! if (J2 == 0d0) then + Af = A0 end if - numer = info%L - info%L0*info%gradL - if (numer > 0d0 .and. info%include_mlt_corr_to_TDC) then - Y_env_factor = convert(info%Gamma/(1d0+info%Gamma)) - else - Y_env_factor = 1d0 - end if - denom = info%L0 + info%c0*Af*Y_env_factor - Y = numer/denom - end subroutine apply_postsolve_TDC_acceleration_limit + end function eval_Af end module tdc_support diff --git a/turb/public/turb.f90 b/turb/public/turb.f90 index bad3a8ced..94b47dadf 100644 --- a/turb/public/turb.f90 +++ b/turb/public/turb.f90 @@ -22,7 +22,6 @@ module turb use num_lib use utils_lib use auto_diff - use tdc_support, only: TDC_arnett_growth_target_mlt, TDC_arnett_growth_target_tdc implicit none @@ -31,8 +30,6 @@ module turb public :: set_mlt public :: set_tdc public :: set_semiconvection - public :: TDC_arnett_growth_target_mlt - public :: TDC_arnett_growth_target_tdc contains @@ -84,15 +81,7 @@ end subroutine set_thermohaline !! !! Internally this solves the equation L = L_conv + L_rad. !! - !! When use_TDC_arnett_velocity_closure is enabled, the velocity closure uses - !! the Arnett 1969 closure in the form presented in Renzo et al. 2020 - !! (ADS: https://ui.adsabs.harvard.edu/abs/2020MNRAS.493.4333R/abstract), - !! which points to equation 11 of Arnett 1969 - !! (ADS: https://ui.adsabs.harvard.edu/abs/1969Ap%26SS...5..180A/abstract). - !! !! @param conv_vel_start The convection speed at the start of the step. - !! @param Y_face_start Start-of-step superadiabaticity, used by the stable-side - !! decay branch of the post-solve acceleration limiter. !! @param mixing_length_alpha The mixing length parameter. !! @param TDC_alpha_D TDC turbulent damping parameter !! @param TDC_alpha_R TDC radiative damping parameter @@ -121,72 +110,45 @@ end subroutine set_thermohaline !! @param Y_face The superadiabaticity (dlnT/dlnP - grada, output). !! @param gradT The temperature gradient dlnT/dlnP (output). !! @param tdc_num_iters Number of iterations taken in the TDC solver. - !! @param TDC_arnett_growth_target Unstable-side steady-state target for David Arnett's - !! convection model in this implementation. - !! @param have_Y_face_guess If true, use Y_face_guess to try a small local - !! bracket before the usual positive-Y luminosity-balance bracketing. - !! @param Y_face_guess Candidate superadiabaticity used only to - !! seed the local solve. !! @param ierr Tracks errors (output). subroutine set_TDC( & - conv_vel_start, Y_face_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & + conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, & max_conv_vel, Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, & - TDC_alpha_S, use_TDC_enthalpy_flux_limiter, use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit, & - TDC_arnett_growth_target, energy, ierr, have_Y_face_guess, Y_face_guess) + TDC_alpha_S, use_TDC_enthalpy_flux_limiter, energy, ierr) use tdc use tdc_support - real(dp), intent(in) :: conv_vel_start, Y_face_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt + real(dp), intent(in) :: conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt real(dp), intent(in) :: dt, cgrav, m, scale, max_conv_vel, TDC_alpha_C, TDC_alpha_S type(auto_diff_real_star_order1), intent(in) :: & chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, scale_height, gradL, grada, Eq_div_w, grav, energy logical, intent(in) :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter - logical, intent(in) :: use_TDC_arnett_velocity_closure, use_TDC_acceleration_limit - logical, intent(in), optional :: have_Y_face_guess - integer, intent(in) :: TDC_arnett_growth_target type(auto_diff_real_star_order1),intent(out) :: conv_vel, Y_face, gradT, D - real(dp), intent(in), optional :: Y_face_guess integer, intent(out) :: tdc_num_iters, mixing_type, ierr type(tdc_info) :: info - type(auto_diff_real_star_order1) :: L, Lambda, Gamma + type(auto_diff_real_star_order1) :: L, Lambda, Gamma, h real(dp), parameter :: alpha_c = (1d0/2d0)*sqrt_2_div_3 real(dp), parameter :: lower_bound_Z = -1d2 real(dp), parameter :: upper_bound_Z = 1d2 real(dp), parameter :: eps = 1d-2 ! Threshold in logY for separating multiple solutions. type(auto_diff_real_tdc) :: Zub, Zlb - logical :: need_cox_mlt include 'formats' + ! Do a call to MLT !grav = cgrav * m / pow2(r) L = 64d0 * pi * boltz_sigma * pow4(T) * grav * pow2(r) * gradr / (3d0 * P * opacity) Lambda = mixing_length_alpha * scale_height - need_cox_mlt = include_mlt_corr_to_TDC .or. & - (use_TDC_arnett_velocity_closure .and. & - TDC_arnett_growth_target == TDC_arnett_growth_target_mlt) - if (need_cox_mlt) then - call set_MLT('Cox', mixing_length_alpha, 0d0, 0d0, & - chiT, chiRho, Cp, grav, Lambda, rho, P, T, opacity, & - gradr, grada, gradL, & - Gamma, gradT, Y_face, conv_vel, D, mixing_type,1d99, ierr) - else - ! set_MLT would normally initialize these. These quantities only - ! fill inactive entries in info, and get_TDC_solution overwrites them. - Gamma = 0d0 - gradT = gradr - Y_face = gradT - gradL - conv_vel = 0d0 - D = 0d0 - mixing_type = no_mixing - ierr = 0 - end if + call set_MLT('Cox', mixing_length_alpha, 0d0, 0d0, & + chiT, chiRho, Cp, grav, Lambda, rho, P, T, opacity, & + gradr, grada, gradL, & + Gamma, gradT, Y_face, conv_vel, D, mixing_type,1d99, ierr) + + ! Pack TDC info info%report = report info%include_mlt_corr_to_TDC = include_mlt_corr_to_TDC info%use_TDC_enthalpy_flux_limiter = use_TDC_enthalpy_flux_limiter - info%use_TDC_arnett_velocity_closure = use_TDC_arnett_velocity_closure - info%use_TDC_acceleration_limit = use_TDC_acceleration_limit - info%TDC_arnett_growth_target = TDC_arnett_growth_target info%mixing_length_alpha = mixing_length_alpha info%TDC_alpha_D = TDC_alpha_D info%TDC_alpha_R = TDC_alpha_R @@ -195,45 +157,36 @@ subroutine set_TDC( & info%L = convert(L) info%gradL = convert(gradL) info%grada = convert(grada) - info%Y_start = Y_face_start info%c0 = convert(TDC_alpha_C * mixing_length_alpha * alpha_c * rho * T * Cp * 4d0 * pi * pow2(r)) info%L0 = convert((16d0*pi*crad*clight/3d0)*cgrav*m*pow4(T)/(P*opacity)) ! assumes QHSE for dP/dm info%A0 = conv_vel_start/sqrt_2_div_3 - info%A_mlt = convert(conv_vel/sqrt_2_div_3) info%h = energy + P/rho ! actual enthalpy info%T = T info%rho = rho - info%r = r info%dV = dV info%Cp = Cp info%kap = opacity info%Hp = scale_height info%Gamma = Gamma info%Eq_div_w = Eq_div_w - info%grav = grav - info%chiT = chiT - info%chiRho = chiRho info%TDC_alpha_C = TDC_alpha_C info%TDC_alpha_S = TDC_alpha_S ! Get solution Zub = upper_bound_Z Zlb = lower_bound_Z - call get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr, & - have_Y_face_guess, Y_face_guess) - if (ierr /= 0) then - if (report) write(*,*) 'ierr from get_TDC_solution' - return - end if + call get_TDC_solution(info, scale, Zlb, Zub, conv_vel, Y_face, tdc_num_iters, ierr) ! Cap conv_vel at max_conv_vel_div_csound*cs if (conv_vel%val > max_conv_vel) then conv_vel = max_conv_vel - ! If conv_vel is capped, recompute Y_face from the uncapped luminosity balance. + ! if max_conv_vel = csound, + ! L = L0 * (gradL + Y) + c0 * Af * Y_env + ! L = L0 * (gradL + Y) + c0 * sqrt_2_div_3 * csound * (Gamma / (1 + Gamma)) * Y + ! L - L0 * gradL = Y * (L0 + c0 * sqrt_2_div_3 * csound * (Gamma / (1 + Gamma))) if (include_mlt_corr_to_TDC) then Y_face = unconvert(info%L - info%L0 * info%gradL) / & - (unconvert(info%L0) + unconvert(info%c0) * sqrt_2_div_3 * max_conv_vel * & - (info%Gamma / (1d0 + info%Gamma))) + (unconvert(info%L0) + unconvert(info%c0) * sqrt_2_div_3 * max_conv_vel * (info%Gamma / (1d0 + info%Gamma))) else Y_face = unconvert(info%L - info%L0 * info%gradL) / & (unconvert(info%L0) + unconvert(info%c0) * sqrt_2_div_3 * max_conv_vel) diff --git a/turb/test/.gitignore b/turb/test/.gitignore deleted file mode 100644 index 6d9b780e5..000000000 --- a/turb/test/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -!/plotter/ -!/plotter/** -/plotter/__pycache__/ -/plotter/*.csv -/plotter/plots/*.pdf diff --git a/turb/test/plotter/mesa.mplstyle b/turb/test/plotter/mesa.mplstyle deleted file mode 100644 index bf1e1ca86..000000000 --- a/turb/test/plotter/mesa.mplstyle +++ /dev/null @@ -1,46 +0,0 @@ -# matplotlib style sheet for MESA Instrument Papers - -#figure.figsize : 3.38, 2.535 # 4x3 with width=apjcolwidth -#figure.figsize : 14,14 -lines.markersize : 8 -lines.linewidth : 1.5 -axes.linewidth : 2.0 -text.usetex : True -font.size : 24 -font.family : sans -# Not sure about the right font to use... -font.serif : Computer Modern Roman # Times Roman? -axes.titlesize : large -axes.labelsize : large -legend.fontsize : 18 -legend.frameon : False -figure.dpi : 500 - -# New commandments from Rich for MESA4 -xtick.minor.visible : True -ytick.minor.visible : True - -# Some other things we should agree on. -savefig.bbox : tight # standard -savefig.pad_inches : 0.15 # Padding when bbox is tight. -savefig.dpi : 300 -savefig.format : pdf - -# Tweaks to get rid of some matplotlib 2.0 default changes I don't like. -xtick.direction : in -xtick.top : True -ytick.direction : in -ytick.right : True - -# Miscellanious -axes.formatter.use_mathtext : True -#figure.autolayout : True - -xtick.major.size : 14#10 # major tick size in points -xtick.minor.size : 12#8 # minor tick size in points -xtick.major.width : 1.75 # major tick width in points -xtick.minor.width : 1.5 # minor tick width in points -ytick.major.size : 14#10 # major tick size in points -ytick.minor.size : 10#8 # minor tick size in points -ytick.major.width : 1.75 # major tick width in points -ytick.minor.width : 1.5 # minor tick width in points diff --git a/turb/test/plotter/plot_time_dependence.py b/turb/test/plotter/plot_time_dependence.py deleted file mode 100644 index f55e8454a..000000000 --- a/turb/test/plotter/plot_time_dependence.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/env python - -import sys - -sys.dont_write_bytecode = True - -import csv -from pathlib import Path - -import matplotlib.pyplot as plt -from matplotlib.ticker import ScalarFormatter - - -HERE = Path(__file__).resolve().parent -CSV_PATH = HERE / "time_dependence.csv" -OUTPUT_DIR = HERE / "plots" -STYLE_PATH = HERE / "mesa.mplstyle" -OUTPUT_PATH = OUTPUT_DIR / "time_dependence_conv_vel_panels.pdf" - -MODE_ORDER = [ - "mlt", - "tdc", - "tdc_with_mlt_corr", - "tdc_with_arnett_closure", - "tdc_with_arnett_closure_tdc_ss", - "tdc_with_arnett_closure_tdc_ss_mlt_corr", - "tdc_with_acceleration_limit", -] - -MODE_LABELS = { - "mlt": "MLT", - "tdc": "plain TDC", - "tdc_with_mlt_corr": "TDC + MLT corr", - "tdc_with_arnett_closure": "TDC + Arnett (MLT steady state)", - "tdc_with_arnett_closure_tdc_ss": "TDC + Arnett (TDC steady state)", - "tdc_with_arnett_closure_tdc_ss_mlt_corr": "TDC + Arnett (TDC steady state, MLT corr)", - "tdc_with_acceleration_limit": "TDC + acceleration limit", -} - -MODE_COLORS = { - "mlt": plt.cm.tab10(0), - "tdc": plt.cm.tab10(1), - "tdc_with_mlt_corr": plt.cm.tab10(2), - "tdc_with_arnett_closure": plt.cm.tab10(3), - "tdc_with_arnett_closure_tdc_ss": plt.cm.tab10(4), - "tdc_with_arnett_closure_tdc_ss_mlt_corr": plt.cm.tab10(5), - "tdc_with_acceleration_limit": "black", -} - -MODE_LINEWIDTHS = { - "mlt": 5.0, - "tdc": 5.0, - "tdc_with_mlt_corr": 4.0, - "tdc_with_arnett_closure": 2.0, - "tdc_with_arnett_closure_tdc_ss": 2.0, - "tdc_with_arnett_closure_tdc_ss_mlt_corr": 2.0, - "tdc_with_acceleration_limit": 3.0, -} - -MODE_LINESTYLES = { - "mlt": "-", - "tdc": "-", - "tdc_with_mlt_corr": "--", - "tdc_with_arnett_closure": "-", - "tdc_with_arnett_closure_tdc_ss": "-", - "tdc_with_arnett_closure_tdc_ss_mlt_corr": "-", - "tdc_with_acceleration_limit": ":", -} - -MODE_ZORDERS = { - "mlt": 1, - "tdc": 1, - "tdc_with_mlt_corr": 2, - "tdc_with_acceleration_limit": 3, - "tdc_with_arnett_closure": 4, - "tdc_with_arnett_closure_tdc_ss": 4, - "tdc_with_arnett_closure_tdc_ss_mlt_corr": 4, -} - -PANEL_GROUPS = [ - "decay_evolution", - "growth_evolution", - "envelope_decay_evolution", - "cburn_growth_evolution", -] - -LINE_ALPHA = 0.8 - - -def read_rows(): - groups = {} - with CSV_PATH.open() as handle: - reader = csv.DictReader(handle) - for row in reader: - group = row["group"] - mode = row["mode"] - row["step"] = int(row["step"]) - row["time"] = float(row["time"]) - row["conv_vel"] = float(row["conv_vel"]) - groups.setdefault(group, {}).setdefault(mode, []).append(row) - - for tracks in groups.values(): - for rows in tracks.values(): - rows.sort(key=lambda row: row["step"]) - - return groups - - -if __name__ == "__main__": - if not CSV_PATH.exists(): - raise SystemExit(f"missing CSV: {CSV_PATH}") - - OUTPUT_DIR.mkdir(exist_ok=True) - - groups = read_rows() - - missing_groups = [group_name for group_name in PANEL_GROUPS if group_name not in groups] - if missing_groups: - raise SystemExit(f"missing groups in CSV: {', '.join(missing_groups)}") - - if STYLE_PATH.exists(): - plt.style.use(str(STYLE_PATH)) - - plt.rcParams["figure.facecolor"] = "white" - plt.rcParams["axes.facecolor"] = "white" - plt.rcParams["savefig.format"] = "pdf" - - fig, axes = plt.subplots(2, 2, figsize=(24.0, 16.0)) - axes = axes.flatten() - - for ax, group_name in zip(axes, PANEL_GROUPS): - tracks = groups[group_name] - - conv_vel_values = [] - for mode in MODE_ORDER: - rows = tracks.get(mode, []) - if not rows: - continue - - x = [row["time"] for row in rows] - y = [row["conv_vel"] for row in rows] - conv_vel_values.extend(y) - - ax.plot( - x, - y, - label=MODE_LABELS[mode], - color=MODE_COLORS[mode], - linewidth=MODE_LINEWIDTHS[mode], - linestyle=MODE_LINESTYLES[mode], - alpha=LINE_ALPHA, - zorder=MODE_ZORDERS[mode], - ) - - ymin = min(conv_vel_values) - ymax = max(conv_vel_values) - if ymax == ymin: - pad = max(1.0, abs(ymax)) * 0.05 - else: - pad = 0.05 * (ymax - ymin) - - ax.set_title( - group_name - .replace("cburn", "carbon burning") - .replace("_evolution", "") - .replace("_", " ") - .title() - ) - ax.set_xlabel("time [s]") - ax.set_ylabel("conv_vel [cm/s]") - ax.set_ylim(ymin - pad, ymax + pad) - ax.grid(True) - - x_formatter = ScalarFormatter(useMathText=True) - x_formatter.set_scientific(True) - x_formatter.set_powerlimits((-3, 3)) - x_formatter.set_useOffset(False) - ax.xaxis.set_major_formatter(x_formatter) - - y_formatter = ScalarFormatter(useMathText=True) - y_formatter.set_scientific(True) - y_formatter.set_powerlimits((-3, 3)) - y_formatter.set_useOffset(False) - ax.yaxis.set_major_formatter(y_formatter) - - axes[0].legend(loc="upper right") - fig.tight_layout(rect=(0.0, 0.0, 1.0, 0.97)) - fig.savefig(OUTPUT_PATH) - plt.close(fig) - - print(f"wrote {OUTPUT_PATH}") diff --git a/turb/test/src/test_time_dependence_support.f90 b/turb/test/src/test_time_dependence_support.f90 deleted file mode 100644 index 437d8da71..000000000 --- a/turb/test/src/test_time_dependence_support.f90 +++ /dev/null @@ -1,1039 +0,0 @@ -module test_time_dependence_support - - use math_lib - use auto_diff - use const_def, only: dp, pi, rsun, lsun, msun, kerg, mp, boltz_sigma, standard_cgrav, sqrt_2_div_3 - use turb, only: set_MLT, set_TDC, TDC_arnett_growth_target_mlt, TDC_arnett_growth_target_tdc - - implicit none - - type :: tdc_mode_data - character(len=48) :: name - logical :: use_arnett - logical :: use_acceleration_limit - logical :: include_mlt_correction - integer :: growth_target - end type tdc_mode_data - - type :: tdc_case_data - real(dp) :: mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt - real(dp) :: cgrav, m, scale, max_conv_vel, TDC_alpha_C, TDC_alpha_S - real(dp) :: conv_vel_start_ref - logical :: report, use_TDC_enthalpy_flux_limiter - type(auto_diff_real_star_order1) :: & - r, L, T, P, opacity, rho, dV, chiRho, chiT, Cp, & - gradr, grada, scale_height, gradL, Eq_div_w, grav, energy - end type tdc_case_data - - integer, parameter :: num_tdc_modes = 6 - type(tdc_mode_data), parameter :: tdc_modes(num_tdc_modes) = [ & - tdc_mode_data('tdc', .false., .false., .false., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_mlt_corr', .false., .false., .true., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_arnett_closure', .true., .false., .true., TDC_arnett_growth_target_mlt), & - tdc_mode_data('tdc_with_arnett_closure_tdc_ss', .true., .false., .false., TDC_arnett_growth_target_tdc), & - tdc_mode_data('tdc_with_arnett_closure_tdc_ss_mlt_corr', .true., .false., .true., TDC_arnett_growth_target_tdc), & - tdc_mode_data('tdc_with_acceleration_limit', .false., .true., .false., TDC_arnett_growth_target_mlt) ] - - private - public :: write_time_dependence_csv - public :: check_time_dependence - -contains - - subroutine write_time_dependence_csv(output_path, ierr) - character(len=*), intent(in) :: output_path - integer, intent(out) :: ierr - integer :: io, mode_i - - ierr = 0 - open(newunit=io, file=trim(output_path), status='replace', action='write', iostat=ierr) - if (ierr /= 0) return - - write(io, '(a)') 'mode,group,scenario,step,time,dt,conv_vel_start,L_conv_start,L,gradr,gradL,grada,gradT,Y_face,conv_vel,L_conv_end,L_conv_div_L,tau_phys,ierr' - - do mode_i = 1, num_tdc_modes - call run_mode(io, tdc_modes(mode_i)) - call run_cburn_growth_evolution(io, tdc_modes(mode_i)) - end do - - call run_mlt_evolution(io) - close(io) - end subroutine write_time_dependence_csv - - - subroutine check_time_dependence() - integer :: mode_i - type(tdc_case_data) :: decay_case, growth_case, envelope_decay_case, cburn_case - real(dp), parameter :: decay_gradT_start = 2.5204370043250246d-01 - real(dp), parameter :: cburn_gradT_start = 2.8060983127196415d-01 - real(dp) :: envelope_decay_gradT_start - write(*, '(a)') '' - write(*, '(a)') 'Decay' - write(*, '(a)') '' - call setup_decay_case(decay_case) - call print_case_setup(decay_case, decay_case%conv_vel_start_ref, decay_gradT_start, & - 'Idealized deep-interior decay test with a large inward luminosity; a generic strongly contracting negative-luminosity state.') - - do mode_i = 1, num_tdc_modes - call print_decay_track(tdc_modes(mode_i)) - end do - - write(*, '(a)') '' - write(*, '(a)') 'Growth' - write(*, '(a)') '' - call setup_growth_case(growth_case) - call print_case_setup(growth_case, 0d0, growth_case%gradr%val, & - 'Idealized generic onset test in a dilute, marginally unstable layer initialized on the radiative branch.') - - do mode_i = 1, num_tdc_modes - call print_growth_track(tdc_modes(mode_i)) - end do - - write(*, '(a)') '' - write(*, '(a)') 'Envelope Decay' - write(*, '(a)') '' - call setup_envelope_decay_case(envelope_decay_case, envelope_decay_gradT_start) - call print_case_setup(envelope_decay_case, envelope_decay_case%conv_vel_start_ref, envelope_decay_gradT_start, & - 'Idealized generic envelope decay test in a dilute, slightly stable layer initialized from a nearby unstable convective state.') - - do mode_i = 1, num_tdc_modes - call print_envelope_decay_track(tdc_modes(mode_i)) - end do - - write(*, '(a)') '' - write(*, '(a)') 'Carbon Burning Growth' - write(*, '(a)') '' - call setup_cburn_case(cburn_case) - call print_case_setup(cburn_case, cburn_case%conv_vel_start_ref, cburn_gradT_start, & - '12 Msun pre-core-collapse model at core-carbon depletion; a hot convective carbon-burning zone taken directly from the saved model.') - - do mode_i = 1, num_tdc_modes - call print_cburn_growth_track(tdc_modes(mode_i), mode_i < num_tdc_modes) - end do - end subroutine check_time_dependence - - - subroutine run_mode(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - - call run_decay_memory_sweep(io, mode) - call run_decay_velocity_sweep(io, mode) - call run_growth_sweep(io, mode) - call run_growth_flux_memory_sweep(io, mode) - call run_growth_velocity_sweep(io, mode) - call run_decay_evolution(io, mode) - call run_growth_evolution(io, mode) - call run_envelope_decay_evolution(io, mode) - end subroutine run_mode - - - subroutine print_decay_track(mode) - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: decay_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time - integer :: ierr, j - real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 - integer, parameter :: num_steps = 12 - - call setup_decay_case(decay_case) - conv_vel_start = decay_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) - tau_phys = arnett_relaxation_time(decay_case%mixing_length_alpha * decay_case%scale_height%val, decay_case%grav%val, & - decay_case%scale_height%val, decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, conv_vel_start) - dt = pow(10d0, 2.3d0) - - write(*, '(a)') 'Convection model: ' // trim(mode%name) - call print_mode_controls(mode) - write(*, '(a)') ' step time[s] dt[s] gradT' // & - ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L' - - gradT = gradT_start_old - Y_face = gradT_start_old - decay_case%gradL - conv_vel = conv_vel_start - call print_track_row(0, 0d0, dt, conv_vel_start, decay_case, gradT, Y_face, conv_vel) - - do j = 1, num_steps - call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call print_track_row(j, time, dt, conv_vel_start, decay_case, gradT, Y_face, conv_vel) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT%val) - end do - - write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys - write(*, '(a)') '' - end subroutine print_decay_track - - - subroutine print_growth_track(mode) - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: growth_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys - real(dp) :: time - integer :: ierr, j - integer, parameter :: num_steps = 12 - - call setup_growth_case(growth_case) - call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - if (ierr /= 0) return - - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, eq_conv_vel%val) - call reference_evolution_dt(growth_case, 0d0, 0d0, dt, ierr) - if (ierr /= 0) return - conv_vel_start = 0d0 - L_conv_start = 0d0 - - write(*, '(a)') 'Convection model: ' // trim(mode%name) - call print_mode_controls(mode) - write(*, '(a)') ' step time[s] dt[s] gradT' // & - ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L' - - gradT = growth_case%gradr - Y_face = growth_case%gradr - growth_case%gradL - conv_vel = 0d0 - call print_track_row(0, 0d0, dt, conv_vel_start, growth_case, gradT, Y_face, conv_vel, eq_conv_vel%val) - - do j = 1, num_steps - call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call print_track_row(j, time, dt, conv_vel_start, growth_case, gradT, Y_face, conv_vel, eq_conv_vel%val) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, gradT%val) - end do - - write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys - write(*, '(a,1x,es24.16)') ' conv_vel_eq[cm/s]', eq_conv_vel%val - write(*, '(a)') '' - end subroutine print_growth_track - - - subroutine print_envelope_decay_track(mode) - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: envelope_decay_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time, gradT_start - integer :: ierr, j - integer, parameter :: num_steps = 12 - - call setup_envelope_decay_case(envelope_decay_case, gradT_start) - conv_vel_start = envelope_decay_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT_start) - tau_phys = arnett_relaxation_time(envelope_decay_case%mixing_length_alpha * envelope_decay_case%scale_height%val, & - envelope_decay_case%grav%val, envelope_decay_case%scale_height%val, envelope_decay_case%gradL%val, & - envelope_decay_case%gradr%val, conv_vel_start, 0d0) - call reference_evolution_dt(envelope_decay_case, conv_vel_start, L_conv_start, dt, ierr) - if (ierr /= 0) return - - write(*, '(a)') 'Convection model: ' // trim(mode%name) - call print_mode_controls(mode) - write(*, '(a)') ' step time[s] dt[s] gradT' // & - ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L' - - gradT = gradT_start - Y_face = gradT_start - envelope_decay_case%gradL - conv_vel = conv_vel_start - call print_track_row(0, 0d0, dt, conv_vel_start, envelope_decay_case, gradT, Y_face, conv_vel) - - do j = 1, num_steps - call call_tdc(envelope_decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call print_track_row(j, time, dt, conv_vel_start, envelope_decay_case, gradT, Y_face, conv_vel) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT%val) - end do - - write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys - write(*, '(a)') '' - end subroutine print_envelope_decay_track - - - subroutine print_cburn_growth_track(mode, emit_blank_line) - type(tdc_mode_data), intent(in) :: mode - logical, intent(in), optional :: emit_blank_line - type(tdc_case_data) :: cburn_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time - logical :: do_blank_line - integer :: ierr, j - real(dp), parameter :: gradT_start = 2.8060983127196415d-01 - integer, parameter :: num_steps = 12 - - do_blank_line = .true. - if (present(emit_blank_line)) do_blank_line = emit_blank_line - - call setup_cburn_case(cburn_case) - conv_vel_start = cburn_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT_start) - call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - if (ierr /= 0) return - - tau_phys = arnett_relaxation_time(cburn_case%mixing_length_alpha * cburn_case%scale_height%val, cburn_case%grav%val, & - cburn_case%scale_height%val, cburn_case%gradL%val, cburn_case%gradr%val, conv_vel_start, eq_conv_vel%val) - call reference_evolution_dt(cburn_case, conv_vel_start, L_conv_start, dt, ierr) - if (ierr /= 0) return - - write(*, '(a)') 'Convection model: ' // trim(mode%name) - call print_mode_controls(mode) - write(*, '(a)') ' step time[s] dt[s] gradT' // & - ' Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L' - - gradT = gradT_start - Y_face = gradT_start - cburn_case%gradL - conv_vel = conv_vel_start - call print_track_row(0, 0d0, dt, conv_vel_start, cburn_case, gradT, Y_face, conv_vel, eq_conv_vel%val) - - do j = 1, num_steps - call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call print_track_row(j, time, dt, conv_vel_start, cburn_case, gradT, Y_face, conv_vel, eq_conv_vel%val) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT%val) - end do - - write(*, '(a,1x,es24.16)') ' tau_phys[s]', tau_phys - write(*, '(a,1x,es24.16)') ' conv_vel_eq[cm/s]', eq_conv_vel%val - if (do_blank_line) write(*, '(a)') '' - end subroutine print_cburn_growth_track - - - subroutine print_track_row(step, time, dt, conv_vel_start, case_data, gradT, Y_face, conv_vel, conv_vel_eq) - integer, intent(in) :: step - real(dp), intent(in) :: time, dt, conv_vel_start - type(tdc_case_data), intent(in) :: case_data - type(auto_diff_real_star_order1), intent(in) :: gradT, Y_face, conv_vel - real(dp), intent(in), optional :: conv_vel_eq - real(dp) :: L_conv_div_L, conv_vel_div_eq - real(dp), parameter :: tiny = 1d-99 - - L_conv_div_L = Lconv_from_gradT(case_data%L%val, case_data%gradr%val, gradT%val) / case_data%L%val - if (present(conv_vel_eq)) then - conv_vel_div_eq = conv_vel%val / max(abs(conv_vel_eq), tiny) - write(*, '(i10,8(1x,es24.16))') step, time, dt, gradT%val, Y_face%val, conv_vel_start, conv_vel%val, & - conv_vel_div_eq, L_conv_div_L - else - write(*, '(i10,7(1x,es24.16))') step, time, dt, gradT%val, Y_face%val, conv_vel_start, conv_vel%val, L_conv_div_L - end if - end subroutine print_track_row - - - subroutine run_decay_memory_sweep(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: decay_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, Lambda, L_conv_ref - integer :: i, j, ierr - real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 - real(dp), parameter :: memory_factors(5) = [0d0, 0.25d0, 0.5d0, 0.75d0, 1d0] - character(len=24), parameter :: names(5) = [character(len=24) :: & - 'zero_memory', 'quarter_memory', 'half_memory', 'three_quarter_memory', 'full_memory'] - - call setup_decay_case(decay_case) - conv_vel_start = decay_case%conv_vel_start_ref - L_conv_ref = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) - Lambda = decay_case%mixing_length_alpha * decay_case%scale_height%val - - do i = 1, size(memory_factors) - L_conv_start = memory_factors(i) * L_conv_ref - do j = 0, 40 - dt = pow(10d0, 2.3d0 + 0.02d0*j) - tau_phys = arnett_relaxation_time(Lambda, decay_case%grav%val, decay_case%scale_height%val, & - decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, conv_vel_start) - call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - call write_row(io, mode%name, 'decay_memory_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - end do - end subroutine run_decay_memory_sweep - - - subroutine run_decay_velocity_sweep(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: decay_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, Lambda, L_conv_ref - integer :: i, j, ierr - real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 - real(dp), parameter :: velocity_factors(4) = [0.25d0, 0.5d0, 0.75d0, 1d0] - character(len=24), parameter :: names(4) = [character(len=24) :: & - 'quarter_a0', 'half_a0', 'three_quarter_a0', 'full_a0'] - - call setup_decay_case(decay_case) - L_conv_ref = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) - Lambda = decay_case%mixing_length_alpha * decay_case%scale_height%val - L_conv_start = L_conv_ref - - do i = 1, size(velocity_factors) - conv_vel_start = velocity_factors(i) * decay_case%conv_vel_start_ref - do j = 0, 40 - dt = pow(10d0, 2.3d0 + 0.02d0*j) - tau_phys = arnett_relaxation_time(Lambda, decay_case%grav%val, decay_case%scale_height%val, & - decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, decay_case%conv_vel_start_ref) - call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - call write_row(io, mode%name, 'decay_velocity_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - end do - end subroutine run_decay_velocity_sweep - - - subroutine run_growth_sweep(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: growth_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Gamma - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, L_conv_eq - integer :: i, j, ierr - character(len=24), parameter :: names(2) = [character(len=24) :: 'radiative_start', 'equilibrium_start'] - - call setup_growth_case(growth_case) - call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - L_conv_eq = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, eq_gradT%val) - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, eq_conv_vel%val) - - call write_row(io, mode%name, 'reference', 'tdc_equilibrium', -1, -1d0, 1d40, 0d0, 0d0, & - growth_case, eq_gradT, eq_Y_face, eq_conv_vel, tau_phys, ierr) - - do i = 1, size(names) - do j = 0, 40 - dt = pow(10d0, -2d0 + 0.25d0*j) - if (i == 1) then - conv_vel_start = 0d0 - L_conv_start = 0d0 - else - conv_vel_start = eq_conv_vel%val - L_conv_start = L_conv_eq - end if - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, eq_conv_vel%val) - call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - call write_row(io, mode%name, 'growth_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - end do - - call call_cox_mlt(growth_case, gradT, Y_face, conv_vel, D, Gamma, ierr) - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, conv_vel%val) - call write_row(io, mode%name, 'reference', 'cox_mlt_equilibrium', -1, -1d0, 1d40, 0d0, 0d0, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end subroutine run_growth_sweep - - - subroutine run_growth_flux_memory_sweep(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: growth_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, L_conv_eq - integer :: i, j, ierr - real(dp), parameter :: memory_factors(5) = [0d0, 0.25d0, 0.5d0, 0.75d0, 1d0] - character(len=32), parameter :: names(5) = [character(len=32) :: & - 'zero_flux_memory', 'quarter_flux_memory', 'half_flux_memory', 'three_quarter_flux_memory', 'full_flux_memory'] - - call setup_growth_case(growth_case) - call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - L_conv_eq = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, eq_gradT%val) - conv_vel_start = 0d0 - - do i = 1, size(memory_factors) - L_conv_start = memory_factors(i) * L_conv_eq - do j = 0, 40 - dt = pow(10d0, -2d0 + 0.25d0*j) - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, eq_conv_vel%val) - call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - call write_row(io, mode%name, 'growth_flux_memory_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - end do - end subroutine run_growth_flux_memory_sweep - - - subroutine run_growth_velocity_sweep(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: growth_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys - integer :: i, j, ierr - real(dp), parameter :: velocity_factors(5) = [0d0, 0.25d0, 0.5d0, 0.75d0, 1d0] - character(len=32), parameter :: names(5) = [character(len=32) :: & - 'zero_velocity_memory', 'quarter_velocity_memory', 'half_velocity_memory', 'three_quarter_velocity_memory', 'full_velocity_memory'] - - call setup_growth_case(growth_case) - call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - L_conv_start = 0d0 - - do i = 1, size(velocity_factors) - conv_vel_start = velocity_factors(i) * eq_conv_vel%val - do j = 0, 40 - dt = pow(10d0, -2d0 + 0.25d0*j) - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, eq_conv_vel%val) - call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - call write_row(io, mode%name, 'growth_velocity_sweep', names(i), -1, -1d0, dt, conv_vel_start, L_conv_start, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - end do - end subroutine run_growth_velocity_sweep - - - subroutine run_decay_evolution(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: decay_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time - integer :: j, ierr - real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 - integer, parameter :: num_steps = 12 - integer, parameter :: num_steps_long = 400 - - call setup_decay_case(decay_case) - conv_vel_start = decay_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) - tau_phys = arnett_relaxation_time(decay_case%mixing_length_alpha * decay_case%scale_height%val, decay_case%grav%val, & - decay_case%scale_height%val, decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, conv_vel_start) - dt = pow(10d0, 2.3d0) - - gradT = gradT_start_old - Y_face = gradT_start_old - decay_case%gradL - conv_vel = conv_vel_start - call write_row(io, mode%name, 'decay_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, 0) - - do j = 1, num_steps - call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call write_row(io, mode%name, 'decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT%val) - end do - - conv_vel_start = decay_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) - gradT = gradT_start_old - Y_face = gradT_start_old - decay_case%gradL - conv_vel = conv_vel_start - call write_row(io, mode%name, 'decay_long_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, 0) - - do j = 1, num_steps_long - call call_tdc(decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call write_row(io, mode%name, 'decay_long_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT%val) - end do - end subroutine run_decay_evolution - - - subroutine run_growth_evolution(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: growth_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time - integer :: j, ierr - integer, parameter :: num_steps = 120 - - call setup_growth_case(growth_case) - call call_tdc(growth_case, mode, 0d0, 0d0, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - if (ierr /= 0) return - - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, eq_conv_vel%val) - call reference_evolution_dt(growth_case, 0d0, 0d0, dt, ierr) - if (ierr /= 0) return - conv_vel_start = 0d0 - L_conv_start = 0d0 - gradT = growth_case%gradr - Y_face = growth_case%gradr - growth_case%gradL - conv_vel = 0d0 - call write_row(io, mode%name, 'growth_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & - growth_case, gradT, Y_face, conv_vel, tau_phys, 0) - - do j = 1, num_steps - call call_tdc(growth_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call write_row(io, mode%name, 'growth_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, gradT%val) - end do - end subroutine run_growth_evolution - - - subroutine run_envelope_decay_evolution(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: envelope_decay_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time, gradT_start - integer :: j, ierr - integer, parameter :: num_steps = 120 - - call setup_envelope_decay_case(envelope_decay_case, gradT_start) - conv_vel_start = envelope_decay_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT_start) - tau_phys = arnett_relaxation_time(envelope_decay_case%mixing_length_alpha * envelope_decay_case%scale_height%val, & - envelope_decay_case%grav%val, envelope_decay_case%scale_height%val, envelope_decay_case%gradL%val, & - envelope_decay_case%gradr%val, conv_vel_start, 0d0) - call reference_evolution_dt(envelope_decay_case, conv_vel_start, L_conv_start, dt, ierr) - if (ierr /= 0) return - gradT = gradT_start - Y_face = gradT_start - envelope_decay_case%gradL - conv_vel = conv_vel_start - call write_row(io, mode%name, 'envelope_decay_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & - envelope_decay_case, gradT, Y_face, conv_vel, tau_phys, 0) - - do j = 1, num_steps - call call_tdc(envelope_decay_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call write_row(io, mode%name, 'envelope_decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - envelope_decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(envelope_decay_case%L%val, envelope_decay_case%gradr%val, gradT%val) - end do - end subroutine run_envelope_decay_evolution - - - subroutine run_cburn_growth_evolution(io, mode) - integer, intent(in) :: io - type(tdc_mode_data), intent(in) :: mode - type(tdc_case_data) :: cburn_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D - type(auto_diff_real_star_order1) :: eq_gradT, eq_Y_face, eq_conv_vel, eq_D - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time - integer :: j, ierr - real(dp), parameter :: gradT_start = 2.8060983127196415d-01 - integer, parameter :: num_steps = 120 - - call setup_cburn_case(cburn_case) - conv_vel_start = cburn_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT_start) - call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, 1d40, eq_gradT, eq_Y_face, eq_conv_vel, eq_D, ierr) - if (ierr /= 0) return - - tau_phys = arnett_relaxation_time(cburn_case%mixing_length_alpha * cburn_case%scale_height%val, cburn_case%grav%val, & - cburn_case%scale_height%val, cburn_case%gradL%val, cburn_case%gradr%val, conv_vel_start, eq_conv_vel%val) - call reference_evolution_dt(cburn_case, conv_vel_start, L_conv_start, dt, ierr) - if (ierr /= 0) return - gradT = gradT_start - Y_face = gradT_start - cburn_case%gradL - conv_vel = conv_vel_start - call write_row(io, mode%name, 'cburn_growth_evolution', 'track', 0, 0d0, dt, conv_vel_start, L_conv_start, & - cburn_case, gradT, Y_face, conv_vel, tau_phys, 0) - - do j = 1, num_steps - call call_tdc(cburn_case, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - time = j * dt - call write_row(io, mode%name, 'cburn_growth_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - cburn_case, gradT, Y_face, conv_vel, tau_phys, ierr) - conv_vel_start = conv_vel%val - L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, gradT%val) - end do - end subroutine run_cburn_growth_evolution - - - subroutine run_mlt_evolution(io) - integer, intent(in) :: io - type(tdc_case_data) :: decay_case, growth_case, cburn_case - type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Gamma - real(dp) :: conv_vel_start, L_conv_start, dt, tau_phys, time - integer :: ierr, j - real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 - integer, parameter :: decay_steps = 12 - integer, parameter :: decay_long_steps = 400 - integer, parameter :: growth_steps = 120 - real(dp) :: envelope_decay_gradT_start - - call setup_decay_case(decay_case) - conv_vel_start = decay_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(decay_case%L%val, decay_case%gradr%val, gradT_start_old) - tau_phys = arnett_relaxation_time(decay_case%mixing_length_alpha * decay_case%scale_height%val, decay_case%grav%val, & - decay_case%scale_height%val, decay_case%gradL%val, decay_case%gradr%val, conv_vel_start, 0d0) - dt = pow(10d0, 2.3d0) - - call call_cox_mlt(decay_case, gradT, Y_face, conv_vel, D, Gamma, ierr) - - do j = 0, decay_steps - time = j * dt - call write_row(io, 'mlt', 'decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - - do j = 0, decay_long_steps - time = j * dt - call write_row(io, 'mlt', 'decay_long_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - decay_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - - call setup_growth_case(growth_case) - call call_cox_mlt(growth_case, gradT, Y_face, conv_vel, D, Gamma, ierr) - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, 0d0, conv_vel%val) - call reference_evolution_dt(growth_case, 0d0, 0d0, dt, ierr) - if (ierr /= 0) return - - do j = 0, growth_steps - time = j * dt - call write_row(io, 'mlt', 'growth_evolution', 'track', j, time, dt, 0d0, 0d0, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - - call setup_envelope_decay_case(growth_case, envelope_decay_gradT_start) - conv_vel_start = growth_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(growth_case%L%val, growth_case%gradr%val, envelope_decay_gradT_start) - call call_cox_mlt(growth_case, gradT, Y_face, conv_vel, D, Gamma, ierr) - tau_phys = arnett_relaxation_time(growth_case%mixing_length_alpha * growth_case%scale_height%val, growth_case%grav%val, & - growth_case%scale_height%val, growth_case%gradL%val, growth_case%gradr%val, conv_vel_start, 0d0) - call reference_evolution_dt(growth_case, conv_vel_start, L_conv_start, dt, ierr) - if (ierr /= 0) return - - do j = 0, growth_steps - time = j * dt - call write_row(io, 'mlt', 'envelope_decay_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - growth_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - - call setup_cburn_case(cburn_case) - conv_vel_start = cburn_case%conv_vel_start_ref - L_conv_start = Lconv_from_gradT(cburn_case%L%val, cburn_case%gradr%val, 2.8060983127196415d-01) - call call_cox_mlt(cburn_case, gradT, Y_face, conv_vel, D, Gamma, ierr) - tau_phys = arnett_relaxation_time(cburn_case%mixing_length_alpha * cburn_case%scale_height%val, cburn_case%grav%val, & - cburn_case%scale_height%val, cburn_case%gradL%val, cburn_case%gradr%val, conv_vel_start, conv_vel%val) - call reference_evolution_dt(cburn_case, conv_vel_start, L_conv_start, dt, ierr) - if (ierr /= 0) return - - do j = 0, growth_steps - time = j * dt - call write_row(io, 'mlt', 'cburn_growth_evolution', 'track', j, time, dt, conv_vel_start, L_conv_start, & - cburn_case, gradT, Y_face, conv_vel, tau_phys, ierr) - end do - end subroutine run_mlt_evolution - - - subroutine reference_evolution_dt(case_data, conv_vel_start, L_conv_start, dt, ierr) - type(tdc_case_data), intent(in) :: case_data - real(dp), intent(in) :: conv_vel_start, L_conv_start - real(dp), intent(out) :: dt - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: ref_gradT, ref_Y_face, ref_conv_vel, ref_D - real(dp) :: tau_ref - - call call_tdc(case_data, tdc_modes(1), conv_vel_start, L_conv_start, 1d40, ref_gradT, ref_Y_face, ref_conv_vel, ref_D, ierr) - if (ierr /= 0) return - - tau_ref = arnett_relaxation_time(case_data%mixing_length_alpha * case_data%scale_height%val, case_data%grav%val, & - case_data%scale_height%val, case_data%gradL%val, case_data%gradr%val, conv_vel_start, ref_conv_vel%val) - dt = max(1d-6, 5d-2 * tau_ref) - end subroutine reference_evolution_dt - - - subroutine call_tdc(case_data, mode, conv_vel_start, L_conv_start, dt, gradT, Y_face, conv_vel, D, ierr) - type(tdc_case_data), intent(in) :: case_data - type(tdc_mode_data), intent(in) :: mode - real(dp), intent(in) :: conv_vel_start, L_conv_start, dt - type(auto_diff_real_star_order1), intent(out) :: gradT, Y_face, conv_vel, D - integer, intent(out) :: ierr - integer :: mixing_type, tdc_num_iters - real(dp) :: gradT_start, Y_face_start - real(dp), parameter :: tiny = 1d-30 - - if (abs(case_data%L%val) <= tiny .or. abs(case_data%gradr%val) <= tiny) then - gradT_start = case_data%gradL%val - else - gradT_start = case_data%gradr%val * (1d0 - L_conv_start/case_data%L%val) - end if - Y_face_start = gradT_start - case_data%gradL%val - - call set_TDC( & - conv_vel_start, Y_face_start, case_data%mixing_length_alpha, case_data%TDC_alpha_D, case_data%TDC_alpha_R, & - case_data%TDC_alpha_Pt, dt, case_data%cgrav, case_data%m, case_data%report, & - mixing_type, case_data%scale, case_data%chiT, case_data%chiRho, case_data%gradr, case_data%r, case_data%P, & - case_data%T, case_data%rho, case_data%dV, case_data%Cp, case_data%opacity, case_data%scale_height, & - case_data%gradL, case_data%grada, conv_vel, D, Y_face, gradT, tdc_num_iters, case_data%max_conv_vel, & - case_data%Eq_div_w, case_data%grav, mode%include_mlt_correction, case_data%TDC_alpha_C, case_data%TDC_alpha_S, & - case_data%use_TDC_enthalpy_flux_limiter, mode%use_arnett, mode%use_acceleration_limit, & - mode%growth_target, case_data%energy, ierr) - end subroutine call_tdc - - - subroutine call_cox_mlt(case_data, gradT, Y_face, conv_vel, D, Gamma, ierr) - type(tdc_case_data), intent(in) :: case_data - type(auto_diff_real_star_order1), intent(out) :: gradT, Y_face, conv_vel, D, Gamma - integer, intent(out) :: ierr - integer :: mixing_type - real(dp) :: Henyey_MLT_nu_param, Henyey_MLT_y_param - - Henyey_MLT_nu_param = 0d0 - Henyey_MLT_y_param = 0d0 - - call set_MLT('Cox', case_data%mixing_length_alpha, Henyey_MLT_nu_param, Henyey_MLT_y_param, & - case_data%chiT, case_data%chiRho, case_data%Cp, case_data%grav, & - case_data%mixing_length_alpha*case_data%scale_height, case_data%rho, case_data%P, case_data%T, & - case_data%opacity, case_data%gradr, case_data%grada, case_data%gradL, & - Gamma, gradT, Y_face, conv_vel, D, mixing_type, case_data%max_conv_vel, ierr) - end subroutine call_cox_mlt - - - subroutine setup_decay_case(case_data) - type(tdc_case_data), intent(out) :: case_data - - case_data%max_conv_vel = 1d99 - case_data%conv_vel_start_ref = 52320587.415154047d0 - case_data%mixing_length_alpha = 2.0d0 - case_data%TDC_alpha_D = 1.0d0 - case_data%TDC_alpha_R = 0.0d0 - case_data%TDC_alpha_Pt = 0.0d0 - case_data%TDC_alpha_C = 1.0d0 - case_data%TDC_alpha_S = 1.0d0 - case_data%cgrav = 6.6743000000000004d-8 - case_data%m = 5.8707400456875664d34 - case_data%scale = 5.0386519362246294d45 - case_data%L = 1.0941528815883500015d0*(-5.0386519362246294d45) - case_data%r = 10314294541.567163d0 - case_data%P = 5.0581587249808894d20 - case_data%T = 613193666.51783681d0 - case_data%rho = 5204.5732574745753d0 - case_data%dV = 3.8256494463482604d-7 - case_data%Cp = 6628075118.4606590d0 - case_data%opacity = 9.0750171231469945d-2 - case_data%scale_height = 2638686602.0063782d0 - case_data%gradL = 0.25207587267343501d0 - case_data%grada = 0.25204697256872738d0 - case_data%report = .false. - case_data%chiT = 1d0 - case_data%chiRho = 1d0 - case_data%grav = case_data%m*case_data%cgrav/pow2(case_data%r) - case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & - (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%cgrav*case_data%m) - case_data%Eq_div_w = 0d0 - case_data%energy = 0d0 - case_data%use_TDC_enthalpy_flux_limiter = .false. - end subroutine setup_decay_case - - - subroutine setup_growth_case(case_data) - type(tdc_case_data), intent(out) :: case_data - - case_data%max_conv_vel = 1d99 - case_data%conv_vel_start_ref = 0d0 - case_data%mixing_length_alpha = 2.0d0 - case_data%chiT = 1d0 - case_data%chiRho = 1d0 - case_data%T = 1d5 - case_data%rho = 1d-5 - case_data%r = Rsun - case_data%m = Msun - case_data%cgrav = standard_cgrav - case_data%grav = case_data%m*case_data%cgrav/pow2(case_data%r) - case_data%Cp = 2.5d0*kerg/mp - case_data%P = case_data%rho*case_data%T*kerg/mp - case_data%scale_height = case_data%P/(case_data%rho*case_data%grav) - case_data%opacity = 1d0 - case_data%grada = 0.4d0 - case_data%gradL = case_data%grada - case_data%L = 70d0*Lsun - case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & - (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%grav*pow2(case_data%r)) - case_data%L = case_data%L*(1d0 + 1d-5)*(case_data%grada/case_data%gradr) - case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & - (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%grav*pow2(case_data%r)) - case_data%TDC_alpha_D = 1.0d0 - case_data%TDC_alpha_R = 0.0d0 - case_data%TDC_alpha_Pt = 0.0d0 - case_data%TDC_alpha_C = 1.0d0 - case_data%TDC_alpha_S = 1.0d0 - case_data%dV = 0d0 - case_data%energy = 0d0 - case_data%scale = case_data%L%val*1d-3 - case_data%report = .false. - case_data%Eq_div_w = 0d0 - case_data%use_TDC_enthalpy_flux_limiter = .false. - end subroutine setup_growth_case - - - subroutine setup_envelope_decay_case(case_data, gradT_start_ref) - type(tdc_case_data), intent(out) :: case_data - real(dp), intent(out) :: gradT_start_ref - type(tdc_case_data) :: unstable_case - type(auto_diff_real_star_order1) :: gradT_start, Y_face_start, conv_vel_start, D_start, Gamma_start - integer :: ierr - - call setup_growth_case(unstable_case) - call call_cox_mlt(unstable_case, gradT_start, Y_face_start, conv_vel_start, D_start, Gamma_start, ierr) - - case_data = unstable_case - case_data%conv_vel_start_ref = conv_vel_start%val - gradT_start_ref = gradT_start%val - case_data%L = unstable_case%L * ((1d0 - 1d-5)/(1d0 + 1d-5)) - case_data%gradr = 3d0*case_data%P*case_data%opacity*case_data%L / & - (64d0*pi*boltz_sigma*pow4(case_data%T)*case_data%grav*pow2(case_data%r)) - case_data%scale = case_data%L%val*1d-3 - end subroutine setup_envelope_decay_case - - - subroutine setup_cburn_case(case_data) - type(tdc_case_data), intent(out) :: case_data - - case_data%max_conv_vel = 1d99 - case_data%conv_vel_start_ref = 5.0383392852019933d4 - case_data%mixing_length_alpha = 2.0d0 - case_data%TDC_alpha_D = 1.0d0 - case_data%TDC_alpha_R = 0.0d0 - case_data%TDC_alpha_Pt = 0.0d0 - case_data%TDC_alpha_C = 1.0d0 - case_data%TDC_alpha_S = 1.0d0 - case_data%cgrav = standard_cgrav - case_data%m = 1.1259123990149387d0*Msun - case_data%scale = 1.0372316545177369d6*Lsun*1d-3 - case_data%L = 1.0372316545177369d6*Lsun - case_data%r = 1.0818528002666345d9 - case_data%P = 8.7371150320499226d21 - case_data%T = 8.9448446840612292d8 - case_data%rho = 1.6585817351580659d5 - case_data%dV = 0d0 - case_data%Cp = 3.7545969237063849d8 - case_data%opacity = 6.8854059514891264d-2 - case_data%scale_height = 4.1262096121030027d8 - case_data%grada = 2.7977735453489061d-1 - ! The saved model provides gradT - grada, so use gradL = grada here. - case_data%gradL = case_data%grada - case_data%report = .false. - case_data%chiT = 1.5046551755548503d0 - case_data%chiRho = 8.4356679250011213d-1 - case_data%grav = case_data%m*case_data%cgrav/pow2(case_data%r) - case_data%gradr = 6.5970726825239474d0 - case_data%Eq_div_w = 0d0 - case_data%energy = 0d0 - case_data%use_TDC_enthalpy_flux_limiter = .false. - end subroutine setup_cburn_case - - - real(dp) function arnett_relaxation_time(Lambda, grav, Hp, gradL, gradr, conv_vel_start, conv_vel_eq) result(tau_phys) - real(dp), intent(in) :: Lambda, grav, Hp, gradL, gradr, conv_vel_start, conv_vel_eq - real(dp), parameter :: tiny = 1d-99 - real(dp) :: N, rate - - if (gradr > gradL) then - tau_phys = max(Lambda, tiny) / max(abs(conv_vel_eq), tiny) - else - N = sqrt(max(0d0, grav/max(Hp, tiny) * (gradL - gradr))) - rate = N + abs(conv_vel_start)/max(Lambda, tiny) - tau_phys = 1d0 / max(rate, tiny) - end if - end function arnett_relaxation_time - - - real(dp) function Lconv_from_gradT(L, gradr, gradT) result(L_conv) - real(dp), intent(in) :: L, gradr, gradT - - if (gradr == 0d0) then - L_conv = 0d0 - else - L_conv = L * (1d0 - gradT/gradr) - end if - end function Lconv_from_gradT - - - subroutine print_mode_controls(mode) - type(tdc_mode_data), intent(in) :: mode - - if (mode%include_mlt_correction) then - write(*, '(a)') ' include_mlt_corr_to_tdc = .true.' - else - write(*, '(a)') ' include_mlt_corr_to_tdc = .false.' - end if - - if (mode%use_arnett) then - write(*, '(a)') ' use_TDC_arnett_velocity_closure = .true.' - else - write(*, '(a)') ' use_TDC_arnett_velocity_closure = .false.' - end if - - if (mode%use_acceleration_limit) then - write(*, '(a)') ' use_TDC_acceleration_limit = .true.' - else - write(*, '(a)') ' use_TDC_acceleration_limit = .false.' - end if - write(*, '(a,a)') ' TDC_arnett_growth_target = ', trim(growth_target_name(mode%growth_target)) - end subroutine print_mode_controls - - - subroutine print_case_setup(case_data, conv_vel_start, gradT_start, interpretation) - type(tdc_case_data), intent(in) :: case_data - real(dp), intent(in) :: conv_vel_start, gradT_start - character(len=*), intent(in) :: interpretation - real(dp) :: L_conv_start, L_conv_div_L - - L_conv_start = Lconv_from_gradT(case_data%L%val, case_data%gradr%val, gradT_start) - if (case_data%L%val == 0d0) then - L_conv_div_L = 0d0 - else - L_conv_div_L = L_conv_start/case_data%L%val - end if - - write(*, '(a,1x,es24.16,1x,a,1x,es24.16)') ' T[K] =', case_data%T%val, 'rho[g/cm^3] =', case_data%rho%val - write(*, '(a,1x,es24.16,1x,a,1x,es24.16)') ' P[dyn/cm^2] =', case_data%P%val, 'L[erg/s] =', case_data%L%val - write(*, '(a,1x,es24.16,1x,a,1x,es24.16)') ' r[cm] =', case_data%r%val, 'Hp[cm] =', case_data%scale_height%val - write(*, '(a,1x,es24.16,1x,a,1x,es24.16,1x,a,1x,es24.16)') ' gradL =', case_data%gradL%val, & - 'gradr =', case_data%gradr%val, 'grada =', case_data%grada%val - write(*, '(a,1x,es24.16,1x,a,1x,es24.16,1x,a,1x,es24.16)') ' conv_vel_start[cm/s] =', conv_vel_start, & - 'gradT_start =', gradT_start, 'L_conv_start/L =', L_conv_div_L - write(*, '(a,a)') ' Interpretation: ', trim(interpretation) - write(*, '(a)') '' - end subroutine print_case_setup - - character(len=32) function growth_target_name(growth_target) result(name) - integer, intent(in) :: growth_target - - select case (growth_target) - case (TDC_arnett_growth_target_mlt) - name = 'mlt' - case (TDC_arnett_growth_target_tdc) - name = 'tdc' - case default - name = 'unknown' - end select - end function growth_target_name - - - subroutine write_row(io, mode_name, group_name, scenario_name, step, time, dt, conv_vel_start, L_conv_start, & - case_data, gradT, Y_face, conv_vel, tau_phys, ierr) - integer, intent(in) :: io, step, ierr - character(len=*), intent(in) :: mode_name, group_name, scenario_name - real(dp), intent(in) :: time, dt, conv_vel_start, L_conv_start, tau_phys - type(tdc_case_data), intent(in) :: case_data - type(auto_diff_real_star_order1), intent(in) :: gradT, Y_face, conv_vel - real(dp) :: L_conv_end, L_conv_div_L - - L_conv_end = Lconv_from_gradT(case_data%L%val, case_data%gradr%val, gradT%val) - if (case_data%L%val == 0d0) then - L_conv_div_L = 0d0 - else - L_conv_div_L = L_conv_end / case_data%L%val - end if - - write(io, '(a,",",a,",",a,",",*(g0,:,","))') trim(mode_name), trim(group_name), trim(scenario_name), & - step, time, dt, conv_vel_start, L_conv_start, case_data%L%val, case_data%gradr%val, case_data%gradL%val, & - case_data%grada%val, gradT%val, Y_face%val, conv_vel%val, L_conv_end, L_conv_div_L, tau_phys, ierr - end subroutine write_row - -end module test_time_dependence_support diff --git a/turb/test/src/test_turb.f90 b/turb/test/src/test_turb.f90 index 15d191abe..2e71a34b3 100644 --- a/turb/test/src/test_turb.f90 +++ b/turb/test/src/test_turb.f90 @@ -4,22 +4,12 @@ program test_turb use auto_diff use const_def, only: dp, pi, rsun, lsun, msun, kerg, mp, boltz_sigma, standard_cgrav use turb - use test_time_dependence_support, only: check_time_dependence, write_time_dependence_csv implicit none - integer, parameter :: num_tdc_modes = 3 - character(len=32), parameter :: tdc_mode_names(num_tdc_modes) = [character(len=32) :: & - 'plain TDC', 'TDC + Arnett closure', 'TDC + acceleration limit'] - logical, parameter :: tdc_mode_use_arnett(num_tdc_modes) = [.false., .true., .false.] - logical, parameter :: tdc_mode_use_accel(num_tdc_modes) = [.false., .false., .true.] - call check_efficient_MLT_scaling() call check_TDC() call compare_TDC_and_Cox_MLT() - call header('Test Time Dependence') - call check_time_dependence() - call write_test_time_dependence_csv() contains @@ -91,19 +81,19 @@ end subroutine check_efficient_MLT_scaling subroutine compare_TDC_and_Cox_MLT() real(dp) :: mixing_length_alpha, conv_vel_start, & - TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, TDC_alpha_C, TDC_alpha_S + TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, L_start, TDC_alpha_C, TDC_alpha_S type(auto_diff_real_star_order1) :: & r, L, T, P, opacity, rho, dV, chiRho, chiT, Cp, gradr, grada, scale_height, gradL, grav, Lambda type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Gamma, Eq_div_w, energy real(dp) :: Henyey_MLT_nu_param, Henyey_MLT_y_param, max_conv_vel character(len=3) :: MLT_option - integer :: mixing_type, ierr, tdc_num_iters, mode_i + integer :: mixing_type, ierr, tdc_num_iters logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter include 'formats' - call header('Compare MLT and TDC Modes') + call header('Compare TDC with MLT Cox') ! For limiting the conv_vel coming out of mlt/TDC with Csound. max_conv_vel = 1d99 ! we don't limit the conv_vel for testing. @@ -148,6 +138,7 @@ subroutine compare_TDC_and_Cox_MLT() Eq_div_w = 0d0 ! TDC_alpha_M is implicit in this term include_mlt_corr_to_TDC = .true. use_TDC_enthalpy_flux_limiter = .false. + ! MLT MLT_option = 'Cox' Henyey_MLT_nu_param = 0d0 @@ -155,43 +146,38 @@ subroutine compare_TDC_and_Cox_MLT() write (*, 1) 'gradR - gradA', gradr%val - grada%val + call set_TDC( & + conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & + mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & + scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & + Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & + energy, ierr) + + + write (*, 1) 'TDC: Y, conv_vel_start, conv_vel, dt ', Y_face%val, conv_vel_start, conv_vel%val, dt + call set_MLT(MLT_option, mixing_length_alpha, Henyey_MLT_nu_param, Henyey_MLT_y_param, & chiT, chiRho, Cp, grav, Lambda, rho, P, T, opacity, & gradr, grada, gradL, & Gamma, gradT, Y_face, conv_vel, D, mixing_type, max_conv_vel, ierr) - write (*, '(a)') 'Mode: MLT' - write (*, 1) 'Y, conv_vel_start, conv_vel, Gamma', Y_face%val, conv_vel_start, conv_vel%val, Gamma%val - - do mode_i = 1, num_tdc_modes - conv_vel_start = 0d0 - call set_TDC( & - conv_vel_start, 0d0, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & - mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & - scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & - Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), & - TDC_arnett_growth_target_mlt, energy, ierr) - write (*, '(a)') 'Mode: ' // trim(tdc_mode_names(mode_i)) - write (*, 1) 'Y, conv_vel_start, conv_vel, dt', Y_face%val, conv_vel_start, conv_vel%val, dt - end do + write (*, 1) 'MLT: Y, conv_vel_start, conv_vel, Gamma', Y_face%val, conv_vel_start, conv_vel%val, Gamma%val end subroutine compare_TDC_and_Cox_MLT subroutine check_TDC() real(dp) :: mixing_length_alpha, conv_vel_start - real(dp) :: TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, max_conv_vel, TDC_alpha_C, TDC_alpha_S + real(dp) :: TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, scale, max_conv_vel, L_start, TDC_alpha_C, TDC_alpha_S type(auto_diff_real_star_order1) :: & r, L, T, P, opacity, rho, dV, chiRho, chiT, Cp, gradr, grada, scale_height, gradL type(auto_diff_real_star_order1) :: gradT, Y_face, conv_vel, D, Eq_div_w, grav, energy - integer :: mixing_type, ierr, tdc_num_iters, mode_i + integer :: mixing_type, ierr, tdc_num_iters logical :: report, include_mlt_corr_to_TDC, use_TDC_enthalpy_flux_limiter integer :: j - real(dp), parameter :: gradT_start_old = 2.5204370043250246d-01 include 'formats' - call header('Test TDC Modes') + call header('Test TDC') ! For limiting the conv_vel coming out of mlt/TDC with Csound. max_conv_vel = 1d99 ! we don't limit the conv_vel for testing. @@ -228,33 +214,24 @@ subroutine check_TDC() energy = 0d0 include_mlt_corr_to_TDC = .true. use_TDC_enthalpy_flux_limiter = .false. - do mode_i = 1, num_tdc_modes - write (*, '(a)') '####################################' - write (*, '(a)') 'Mode: ' // trim(tdc_mode_names(mode_i)) - write (*, '(a)') 'Running dt test' - - do j = 0, 30 - dt = 500d0*pow(1.02d0, j) - call set_TDC( & - conv_vel_start, gradT_start_old - gradL%val, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & - mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & - scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & - Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & - tdc_mode_use_arnett(mode_i), tdc_mode_use_accel(mode_i), & - TDC_arnett_growth_target_mlt, energy, ierr) - - write (*, 1) 'dt, gradT, conv_vel_start, conv_vel', dt, gradT%val, conv_vel_start, conv_vel%val - if (report) stop - end do - end do - end subroutine check_TDC + write (*, *) "####################################" + write (*, *) "Running dt test" + + do j = 0, 30 + dt = 500d0*pow(1.02d0, j) + call set_TDC( & + conv_vel_start, mixing_length_alpha, TDC_alpha_D, TDC_alpha_R, TDC_alpha_Pt, dt, cgrav, m, report, & + mixing_type, scale, chiT, chiRho, gradr, r, P, T, rho, dV, Cp, opacity, & + scale_height, gradL, grada, conv_vel, D, Y_face, gradT, tdc_num_iters, max_conv_vel, & + Eq_div_w, grav, include_mlt_corr_to_TDC, TDC_alpha_C, TDC_alpha_S, use_TDC_enthalpy_flux_limiter, & + energy, ierr) - subroutine write_test_time_dependence_csv() - integer :: ierr - call write_time_dependence_csv('plotter/time_dependence.csv', ierr) - if (ierr /= 0) stop 1 - end subroutine write_test_time_dependence_csv + write (*, 1) 'dt, gradT, conv_vel_start, conv_vel', dt, gradT%val, conv_vel_start, conv_vel%val + if (report) stop + end do + + end subroutine check_TDC end program test_turb diff --git a/turb/test/test_output b/turb/test/test_output index 7ec162658..454ffeb53 100644 --- a/turb/test/test_output +++ b/turb/test/test_output @@ -9,12 +9,11 @@ Expected ~10 because in the efficient limit vc ~ L^{1/3} ---------------------------------------------------------------- - Test TDC Modes + Test TDC ---------------------------------------------------------------- -#################################### -Mode: plain TDC -Running dt test + #################################### + Running dt test dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5204370043250246D-01 5.2320587415154047D+07 6.0597238914198903D+06 dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5204285749162930D-01 5.2320587415154047D+07 5.9050075093203261D+06 dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5204196393651124D-01 5.2320587415154047D+07 5.7494001285570739D+06 @@ -46,645 +45,11 @@ Running dt test dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 -1.2020505435123705D+05 5.2320587415154047D+07 0.0000000000000000D+00 -#################################### -Mode: TDC + Arnett closure -Running dt test - dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5206418300800154D-01 5.2320587415154047D+07 1.6677542875162063D+07 - dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5206408290709337D-01 5.2320587415154047D+07 1.6535942343005361D+07 - dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5206398162348564D-01 5.2320587415154047D+07 1.6395095276109921D+07 - dt, gradT, conv_vel_start, conv_vel 5.3060399999999993D+02 2.5206387914177358D-01 5.2320587415154047D+07 1.6255003277390720D+07 - dt, gradT, conv_vel_start, conv_vel 5.4121608000000003D+02 2.5206377544613878D-01 5.2320587415154047D+07 1.6115667806304075D+07 - dt, gradT, conv_vel_start, conv_vel 5.5204040160000000D+02 2.5206367052053480D-01 5.2320587415154047D+07 1.5977090186487976D+07 - dt, gradT, conv_vel_start, conv_vel 5.6308120963200008D+02 2.5206356434883304D-01 5.2320587415154047D+07 1.5839271612211445D+07 - dt, gradT, conv_vel_start, conv_vel 5.7434283382464002D+02 2.5206345691428195D-01 5.2320587415154047D+07 1.5702213135614676D+07 - dt, gradT, conv_vel_start, conv_vel 5.8582969050113286D+02 2.5206334820006576D-01 5.2320587415154047D+07 1.5565915684761290D+07 - dt, gradT, conv_vel_start, conv_vel 5.9754628431115555D+02 2.5206323818901338D-01 5.2320587415154047D+07 1.5430380057873391D+07 - dt, gradT, conv_vel_start, conv_vel 6.0949720999737872D+02 2.5206312686364857D-01 5.2320587415154047D+07 1.5295606927139120D+07 - dt, gradT, conv_vel_start, conv_vel 6.2168715419732621D+02 2.5206301420618338D-01 5.2320587415154047D+07 1.5161596840912011D+07 - dt, gradT, conv_vel_start, conv_vel 6.3412089728127273D+02 2.5206290019851052D-01 5.2320587415154047D+07 1.5028350225903768D+07 - dt, gradT, conv_vel_start, conv_vel 6.4680331522689812D+02 2.5206278482219630D-01 5.2320587415154047D+07 1.4895867389369542D+07 - dt, gradT, conv_vel_start, conv_vel 6.5973938153143615D+02 2.5206266805847288D-01 5.2320587415154047D+07 1.4764148521284653D+07 - dt, gradT, conv_vel_start, conv_vel 6.7293416916206490D+02 2.5206254988823046D-01 5.2320587415154047D+07 1.4633193696512120D+07 - dt, gradT, conv_vel_start, conv_vel 6.8639285254530625D+02 2.5206243029200931D-01 5.2320587415154047D+07 1.4503002876959939D+07 - dt, gradT, conv_vel_start, conv_vel 7.0012070959621246D+02 2.5206230924999140D-01 5.2320587415154047D+07 1.4373575913727390D+07 - dt, gradT, conv_vel_start, conv_vel 7.1412312378813670D+02 2.5206218674199193D-01 5.2320587415154047D+07 1.4244912549239578D+07 - dt, gradT, conv_vel_start, conv_vel 7.2840558626389941D+02 2.5206206274745041D-01 5.2320587415154047D+07 1.4117012419369336D+07 - dt, gradT, conv_vel_start, conv_vel 7.4297369798917748D+02 2.5206193724542159D-01 5.2320587415154047D+07 1.3989875055545826D+07 - dt, gradT, conv_vel_start, conv_vel 7.5783317194896108D+02 2.5206181021456614D-01 5.2320587415154047D+07 1.3863499886848994D+07 - dt, gradT, conv_vel_start, conv_vel 7.7298983538794027D+02 2.5206168163314091D-01 5.2320587415154047D+07 1.3737886242089199D+07 - dt, gradT, conv_vel_start, conv_vel 7.8844963209569903D+02 2.5206155147898895D-01 5.2320587415154047D+07 1.3613033351871220D+07 - dt, gradT, conv_vel_start, conv_vel 8.0421862473761303D+02 2.5206141972952911D-01 5.2320587415154047D+07 1.3488940350641957D+07 - dt, gradT, conv_vel_start, conv_vel 8.2030299723236533D+02 2.5206128636194908D-01 5.2320587415154047D+07 1.3365606284074448D+07 - dt, gradT, conv_vel_start, conv_vel 8.3670905717701260D+02 2.5206115135247592D-01 5.2320587415154047D+07 1.3243030092187464D+07 - dt, gradT, conv_vel_start, conv_vel 8.5344323832055295D+02 2.5206101467733599D-01 5.2320587415154047D+07 1.3121210636905069D+07 - dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 2.5206087631215318D-01 5.2320587415154047D+07 1.3000146688504113D+07 - dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 2.5206073623207331D-01 5.2320587415154047D+07 1.2879836931164706D+07 - dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 2.5206059441175166D-01 5.2320587415154047D+07 1.2760279964925412D+07 -#################################### -Mode: TDC + acceleration limit -Running dt test - dt, gradT, conv_vel_start, conv_vel 5.0000000000000000D+02 2.5206387323614471D-01 5.2320587415154047D+07 1.6247003234033018D+07 - dt, gradT, conv_vel_start, conv_vel 5.1000000000000000D+02 2.5206376930092206D-01 5.2320587415154047D+07 1.6107485434631741D+07 - dt, gradT, conv_vel_start, conv_vel 5.2020000000000005D+02 2.5206366415898146D-01 5.2320587415154047D+07 1.5968764848771460D+07 - dt, gradT, conv_vel_start, conv_vel 5.3060399999999993D+02 2.5206355779572454D-01 5.2320587415154047D+07 1.5830843070094654D+07 - dt, gradT, conv_vel_start, conv_vel 5.4121608000000003D+02 2.5206345019634430D-01 5.2320587415154047D+07 1.5693721553130953D+07 - dt, gradT, conv_vel_start, conv_vel 5.5204040160000000D+02 2.5206334134582137D-01 5.2320587415154047D+07 1.5557401615557974D+07 - dt, gradT, conv_vel_start, conv_vel 5.6308120963200008D+02 2.5206323122892066D-01 5.2320587415154047D+07 1.5421884440460186D+07 - dt, gradT, conv_vel_start, conv_vel 5.7434283382464002D+02 2.5206311983018764D-01 5.2320587415154047D+07 1.5287171078584744D+07 - dt, gradT, conv_vel_start, conv_vel 5.8582969050113286D+02 2.5206300713394497D-01 5.2320587415154047D+07 1.5153262450593071D+07 - dt, gradT, conv_vel_start, conv_vel 5.9754628431115555D+02 2.5206289312428865D-01 5.2320587415154047D+07 1.5020159349307271D+07 - dt, gradT, conv_vel_start, conv_vel 6.0949720999737872D+02 2.5206277778508412D-01 5.2320587415154047D+07 1.4887862441950262D+07 - dt, gradT, conv_vel_start, conv_vel 6.2168715419732621D+02 2.5206266109996278D-01 5.2320587415154047D+07 1.4756372272378715D+07 - dt, gradT, conv_vel_start, conv_vel 6.3412089728127273D+02 2.5206254305231768D-01 5.2320587415154047D+07 1.4625689263307815D+07 - dt, gradT, conv_vel_start, conv_vel 6.4680331522689812D+02 2.5206242362529979D-01 5.2320587415154047D+07 1.4495813718527034D+07 - dt, gradT, conv_vel_start, conv_vel 6.5973938153143615D+02 2.5206230280181391D-01 5.2320587415154047D+07 1.4366745825105909D+07 - dt, gradT, conv_vel_start, conv_vel 6.7293416916206490D+02 2.5206218056451452D-01 5.2320587415154047D+07 1.4238485655589178D+07 - dt, gradT, conv_vel_start, conv_vel 6.8639285254530625D+02 2.5206205689580141D-01 5.2320587415154047D+07 1.4111033170180386D+07 - dt, gradT, conv_vel_start, conv_vel 7.0012070959621246D+02 2.5206193177781577D-01 5.2320587415154047D+07 1.3984388218913175D+07 - dt, gradT, conv_vel_start, conv_vel 7.1412312378813670D+02 2.5206180519243526D-01 5.2320587415154047D+07 1.3858550543809673D+07 - dt, gradT, conv_vel_start, conv_vel 7.2840558626389941D+02 2.5206167712127014D-01 5.2320587415154047D+07 1.3733519781025143D+07 - dt, gradT, conv_vel_start, conv_vel 7.4297369798917748D+02 2.5206154754565829D-01 5.2320587415154047D+07 1.3609295462978393D+07 - dt, gradT, conv_vel_start, conv_vel 7.5783317194896108D+02 2.5206141644666069D-01 5.2320587415154047D+07 1.3485877020467168D+07 - dt, gradT, conv_vel_start, conv_vel 7.7298983538794027D+02 2.5206128380505688D-01 5.2320587415154047D+07 1.3363263784768103D+07 - dt, gradT, conv_vel_start, conv_vel 7.8844963209569903D+02 2.5206114960133991D-01 5.2320587415154047D+07 1.3241454989720535D+07 - dt, gradT, conv_vel_start, conv_vel 8.0421862473761303D+02 2.5206101381571150D-01 5.2320587415154047D+07 1.3120449773793729D+07 - dt, gradT, conv_vel_start, conv_vel 8.2030299723236533D+02 2.5206087642807706D-01 5.2320587415154047D+07 1.3000247182137012D+07 - dt, gradT, conv_vel_start, conv_vel 8.3670905717701260D+02 2.5206073741804069D-01 5.2320587415154047D+07 1.2880846168612307D+07 - dt, gradT, conv_vel_start, conv_vel 8.5344323832055295D+02 2.5206059676489972D-01 5.2320587415154047D+07 1.2762245597808629D+07 - dt, gradT, conv_vel_start, conv_vel 8.7051210308696398D+02 2.5206045444763975D-01 5.2320587415154047D+07 1.2644444247038215D+07 - dt, gradT, conv_vel_start, conv_vel 8.8792234514870324D+02 2.5206031044492883D-01 5.2320587415154047D+07 1.2527440808313739D+07 - dt, gradT, conv_vel_start, conv_vel 9.0568079205167737D+02 2.5206016473511245D-01 5.2320587415154047D+07 1.2411233890306359D+07 ---------------------------------------------------------------- - Compare MLT and TDC Modes + Compare TDC with MLT Cox ---------------------------------------------------------------- gradR - gradA 4.0000000000040004D-06 -Mode: MLT - Y, conv_vel_start, conv_vel, Gamma 3.9999830300230244D-06 0.0000000000000000D+00 1.5051080930415759D+02 1.3740991947818479D-03 -Mode: plain TDC - Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 -Mode: TDC + Arnett closure - Y, conv_vel_start, conv_vel, dt 3.9999852207537568D-06 0.0000000000000000D+00 1.5051080930415756D+02 1.0000000000000000D+40 -Mode: TDC + acceleration limit - Y, conv_vel_start, conv_vel, dt 3.9999830300861647D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 - ---------------------------------------------------------------- - - Test Time Dependence - - ---------------------------------------------------------------- - -Decay - - T[K] = 6.1319366651783681E+08 rho[g/cm^3] = 5.2045732574745753E+03 - P[dyn/cm^2] = 5.0581587249808894E+20 L[erg/s] = -5.5130555353408978E+45 - r[cm] = 1.0314294541567163E+10 Hp[cm] = 2.6386866020063782E+09 - gradL = 2.5207587267343501E-01 gradr = -1.2020505435123698E+05 grada = 2.5204697256872738E-01 - conv_vel_start[cm/s] = 5.2320587415154047E+07 gradT_start = 2.5204370043250246E-01 L_conv_start/L = 1.0000020967812193E+00 - Interpretation: Idealized deep-interior decay test with a large inward luminosity; a generic strongly contracting negative-luminosity state. - -Convection model: tdc - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206216661731234E-01 -1.3706056122687329E-05 5.2320587415154047E+07 1.4223996656248299E+07 1.0000020969348418E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5205110632014682E-01 -2.4766353288167702E-05 1.4223996656248299E+07 7.8717643317566449E+06 1.0000020968428298E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5203572180572381E-01 -4.0150867711182339E-05 7.8717643317566449E+06 4.8555587348417640E+06 1.0000020967148442E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 4.8555587348417640E+06 0.0000000000000000E+00 -6.6613381477509392E-16 - 5 9.9763115748443909E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 6 1.1971573889813269E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 7 1.3966836204782148E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 8 1.5962098519751025E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 9 1.7957360834719902E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 10 1.9952623149688782E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 11 2.1947885464657661E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 12 2.3943147779626538E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - tau_phys[s] 2.4407158796310516E-02 - -Convection model: tdc_with_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206216661731234E-01 -1.3706056122687329E-05 5.2320587415154047E+07 1.4223996656248299E+07 1.0000020969348418E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5205110632014682E-01 -2.4766353288167702E-05 1.4223996656248299E+07 7.8717643317566449E+06 1.0000020968428298E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5203572180572381E-01 -4.0150867711182339E-05 7.8717643317566449E+06 4.8555587348417640E+06 1.0000020967148442E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 4.8555587348417640E+06 0.0000000000000000E+00 -6.6613381477509392E-16 - 5 9.9763115748443909E+02 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 6 1.1971573889813269E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 7 1.3966836204782148E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 8 1.5962098519751025E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 9 1.7957360834719902E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 10 1.9952623149688782E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 11 2.1947885464657661E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - 12 2.3943147779626538E+03 1.9952623149688782E+02 -1.2020505435123705E+05 -1.2020530642710972E+05 0.0000000000000000E+00 0.0000000000000000E+00 -6.6613381477509392E-16 - tau_phys[s] 2.4407158796310516E-02 - -Convection model: tdc_with_arnett_closure - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206182001458954E-01 -1.4052658845437666E-05 2.4011193072444737E+07 1.3873167997163163E+07 1.0000020969319583E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205438149247528E-01 -2.1491180959748781E-05 1.3873167997163163E+07 9.0713905769964289E+06 1.0000020968700762E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204524357187114E-01 -3.0629101563847604E-05 9.0713905769964289E+06 6.3650217225108435E+06 1.0000020967940568E+00 - 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203397101831237E-01 -4.1901655122646402E-05 6.3650217225108435E+06 4.6526777007509712E+06 1.0000020967002792E+00 - 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5201982717062937E-01 -5.6045502805643498E-05 4.6526777007509712E+06 3.4785109711089474E+06 1.0000020965826149E+00 - 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200162875243959E-01 -7.4243920995430379E-05 3.4785109711089474E+06 2.6258701553926971E+06 1.0000020964312202E+00 - 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5197745619178208E-01 -9.8416481652949052E-05 2.6258701553926971E+06 1.9809171497260793E+06 1.0000020962301257E+00 - 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5194408147891123E-01 -1.3179119452377133E-04 1.9809171497260793E+06 1.4792710315161166E+06 1.0000020959524776E+00 - 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5189578380675709E-01 -1.8008886667794557E-04 1.4792710315161166E+06 1.0825483000777548E+06 1.0000020955506834E+00 - 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5182170737495413E-01 -2.5416529848086930E-04 1.0825483000777548E+06 7.6703978566282836E+05 1.0000020949344330E+00 - 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5169935498816232E-01 -3.7651768527268890E-04 7.6703978566282836E+05 5.1778416657852300E+05 1.0000020939165690E+00 - tau_phys[s] 2.4407158796310516E-02 - -Convection model: tdc_with_arnett_closure_tdc_ss - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206182001458954E-01 -1.4052658845437666E-05 2.4011193072444737E+07 1.3873167997163163E+07 1.0000020969319583E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205438149247528E-01 -2.1491180959748781E-05 1.3873167997163163E+07 9.0713905769964289E+06 1.0000020968700762E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204524357187114E-01 -3.0629101563847604E-05 9.0713905769964289E+06 6.3650217225108435E+06 1.0000020967940568E+00 - 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203397101831237E-01 -4.1901655122646402E-05 6.3650217225108435E+06 4.6526777007509712E+06 1.0000020967002792E+00 - 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5201982717062937E-01 -5.6045502805643498E-05 4.6526777007509712E+06 3.4785109711089474E+06 1.0000020965826149E+00 - 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200162875243959E-01 -7.4243920995430379E-05 3.4785109711089474E+06 2.6258701553926971E+06 1.0000020964312202E+00 - 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5197745619178208E-01 -9.8416481652949052E-05 2.6258701553926971E+06 1.9809171497260793E+06 1.0000020962301257E+00 - 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5194408147891123E-01 -1.3179119452377133E-04 1.9809171497260793E+06 1.4792710315161166E+06 1.0000020959524776E+00 - 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5189578380675709E-01 -1.8008886667794557E-04 1.4792710315161166E+06 1.0825483000777548E+06 1.0000020955506834E+00 - 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5182170737495413E-01 -2.5416529848086930E-04 1.0825483000777548E+06 7.6703978566282836E+05 1.0000020949344330E+00 - 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5169935498816232E-01 -3.7651768527268890E-04 7.6703978566282836E+05 5.1778416657852300E+05 1.0000020939165690E+00 - tau_phys[s] 2.4407158796310516E-02 - -Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206775333942771E-01 -8.1193340072817136E-06 5.2320587415154047E+07 2.4011193072444737E+07 1.0000020969813184E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206182001458954E-01 -1.4052658845437666E-05 2.4011193072444737E+07 1.3873167997163163E+07 1.0000020969319583E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205438149247528E-01 -2.1491180959748781E-05 1.3873167997163163E+07 9.0713905769964289E+06 1.0000020968700762E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204524357187114E-01 -3.0629101563847604E-05 9.0713905769964289E+06 6.3650217225108435E+06 1.0000020967940568E+00 - 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203397101831237E-01 -4.1901655122646402E-05 6.3650217225108435E+06 4.6526777007509712E+06 1.0000020967002792E+00 - 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5201982717062937E-01 -5.6045502805643498E-05 4.6526777007509712E+06 3.4785109711089474E+06 1.0000020965826149E+00 - 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200162875243959E-01 -7.4243920995430379E-05 3.4785109711089474E+06 2.6258701553926971E+06 1.0000020964312202E+00 - 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5197745619178208E-01 -9.8416481652949052E-05 2.6258701553926971E+06 1.9809171497260793E+06 1.0000020962301257E+00 - 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5194408147891123E-01 -1.3179119452377133E-04 1.9809171497260793E+06 1.4792710315161166E+06 1.0000020959524776E+00 - 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5189578380675709E-01 -1.8008886667794557E-04 1.4792710315161166E+06 1.0825483000777548E+06 1.0000020955506834E+00 - 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5182170737495413E-01 -2.5416529848086930E-04 1.0825483000777548E+06 7.6703978566282836E+05 1.0000020949344330E+00 - 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5169935498816232E-01 -3.7651768527268890E-04 7.6703978566282836E+05 5.1778416657852300E+05 1.0000020939165690E+00 - tau_phys[s] 2.4407158796310516E-02 - -Convection model: tdc_with_acceleration_limit - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .true. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 1.9952623149688782E+02 2.5204370043250246E-01 -3.2172240932548668E-05 5.2320587415154047E+07 5.2320587415154047E+07 1.0000020967812193E+00 - 1 1.9952623149688782E+02 1.9952623149688782E+02 2.5206758806058704E-01 -8.2846128479657675E-06 5.2320587415154047E+07 2.3532167410343025E+07 1.0000020969799432E+00 - 2 3.9905246299377563E+02 1.9952623149688782E+02 2.5206173568375961E-01 -1.4136989675374021E-05 2.3532167410343025E+07 1.3790410896198066E+07 1.0000020969312566E+00 - 3 5.9857869449066345E+02 1.9952623149688782E+02 2.5205450899117010E-01 -2.1363682264881386E-05 1.3790410896198066E+07 9.1255287375001255E+06 1.0000020968711369E+00 - 4 7.9810492598755127E+02 1.9952623149688782E+02 2.5204577378855098E-01 -3.0098884884035677E-05 9.1255287375001255E+06 6.4771468173637539E+06 1.0000020967984677E+00 - 5 9.9763115748443909E+02 1.9952623149688782E+02 2.5203520056883455E-01 -4.0672104600445126E-05 6.4771468173637539E+06 4.7933318998581618E+06 1.0000020967105079E+00 - 6 1.1971573889813269E+03 1.9952623149688782E+02 2.5202224016998098E-01 -5.3632503454028986E-05 4.7933318998581618E+06 3.6350139158013938E+06 1.0000020966026888E+00 - 7 1.3966836204782148E+03 1.9952623149688782E+02 2.5200604740238397E-01 -6.9825271051036477E-05 3.6350139158013938E+06 2.7920392349913488E+06 1.0000020964679794E+00 - 8 1.5962098519751025E+03 1.9952623149688782E+02 2.5198533132299578E-01 -9.0541350439236155E-05 2.7920392349913488E+06 2.1532139225782664E+06 1.0000020962956397E+00 - 9 1.7957360834719902E+03 1.9952623149688782E+02 2.5195808332967567E-01 -1.1778934375932993E-04 2.1532139225782664E+06 1.6551148861899225E+06 1.0000020960689606E+00 - 10 1.9952623149688782E+03 1.9952623149688782E+02 2.5192107875150627E-01 -1.5479392192872549E-04 1.6551148861899225E+06 1.2594480054608323E+06 1.0000020957611151E+00 - 11 2.1947885464657661E+03 1.9952623149688782E+02 2.5186892727679827E-01 -2.0694539663674628E-04 1.2594480054608323E+06 9.4205959308299061E+05 1.0000020953272608E+00 - 12 2.3943147779626538E+03 1.9952623149688782E+02 2.5179216466102777E-01 -2.8370801240722605E-04 9.4205959308299061E+05 6.8716739568737103E+05 1.0000020946886636E+00 - tau_phys[s] 2.4407158796310516E-02 - - -Growth - - T[K] = 1.0000000000000000E+05 rho[g/cm^3] = 1.0000000000000001E-05 - P[dyn/cm^2] = 8.2543997567252174E+07 L[erg/s] = 2.4440540110725111E+35 - r[cm] = 6.9570000000000000E+10 Hp[cm] = 3.0103560887821615E+08 - gradL = 4.0000000000000002E-01 gradr = 4.0000400000000003E-01 grada = 4.0000000000000002E-01 - conv_vel_start[cm/s] = 0.0000000000000000E+00 gradT_start = 4.0000400000000003E-01 L_conv_start/L = 0.0000000000000000E+00 - Interpretation: Idealized generic onset test in a dilute, marginally unstable layer initialized on the radiative branch. - -Convection model: tdc - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397716939257E-01 3.9771693925558278E-06 0.0000000000000000E+00 2.7948760309172320E+02 7.1495234560010973E-02 5.7075947856866094E-08 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395493296970E-01 3.9549329696727386E-06 2.7948760309172320E+02 5.5477497861836196E+02 1.4191601625825195E-01 1.1266644917018453E-07 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393347167013E-01 3.9334716701094930E-06 5.5477497861836196E+02 8.2341845398708051E+02 2.1063723348590743E-01 1.6631916155418483E-07 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000391293777982E-01 3.9129377797828441E-06 8.2341845398708051E+02 1.0832121431338355E+03 2.7709460238989475E-01 2.1765337399060058E-07 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000389344979725E-01 3.8934497972205580E-06 1.0832121431338355E+03 1.3322532528000313E+03 3.4080137275718969E-01 2.6637284322728050E-07 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000387510756641E-01 3.8751075663634162E-06 1.3322532528000313E+03 1.5689873926498860E+03 4.0135991871664384E-01 3.1222796181840096E-07 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000385796830107E-01 3.8579683010650897E-06 1.5689873926498860E+03 1.7922298853375303E+03 4.5846719002995001E-01 3.5507569662307498E-07 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000384206410128E-01 3.8420641012738213E-06 1.7922298853375303E+03 2.0011670228765338E+03 5.1191503348133172E-01 3.9483579850063677E-07 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000382740094365E-01 3.8274009436087563E-06 2.0011670228765338E+03 2.1953387606570254E+03 5.6158576586435349E-01 4.3149332606962082E-07 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000381396225176E-01 3.8139622517159853E-06 2.1953387606570254E+03 2.3746071539845266E+03 6.0744409978816527E-01 4.6508971973668878E-07 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000380171283689E-01 3.8017128368745924E-06 2.3746071539845266E+03 2.5391150402843618E+03 6.4952657424453109E-01 4.9571295068773225E-07 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000379060290026E-01 3.7906029002259580E-06 2.5391150402843618E+03 2.6892393632450708E+03 6.8792961453865198E-01 5.2348751455877363E-07 - tau_phys[s] 1.5401478440959990E+05 - conv_vel_eq[cm/s] 3.9091780705625856E+03 - -Convection model: tdc_with_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000214698E-01 4.0000021469332226E-06 0.0000000000000000E+00 3.8633120695816348E-01 2.5667997066102185E-03 -5.3672621902478568E-12 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000400000210340E-01 4.0000021033756866E-06 3.8633120695816348E-01 7.7265731910856306E-01 5.1335655631176286E-03 -5.2584603338345914E-12 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000400000205982E-01 4.0000020598193017E-06 7.7265731910856306E-01 1.1589732461189168E+00 7.7002637491546998E-03 -5.1494364328164019E-12 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000400000201630E-01 4.0000020162646295E-06 1.1589732461189168E+00 1.5452738981937484E+00 1.0266860447920460E-02 -5.0406345764031357E-12 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000400000197273E-01 4.0000019727122672E-06 1.5452738981937484E+00 1.9315541863426069E+00 1.2833321847962554E-02 -4.9316106753849454E-12 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000400000192921E-01 4.0000019291627696E-06 1.9315541863426069E+00 2.3178090226481904E+00 1.5399614144958678E-02 -4.8228088189716800E-12 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000400000188563E-01 4.0000018856167177E-06 2.3178090226481904E+00 2.7040333205343550E+00 1.7965703543497226E-02 -4.7140069625584147E-12 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000400000184211E-01 4.0000018420746816E-06 2.7040333205343550E+00 3.0902219950339695E+00 2.0531556258856939E-02 -4.6052051061451493E-12 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000400000179853E-01 4.0000017985372355E-06 3.0902219950339695E+00 3.4763699630565950E+00 2.3097138518785379E-02 -4.4961812051269590E-12 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000400000175501E-01 4.0000017550049487E-06 3.4763699630565950E+00 3.8624721436559484E+00 2.5662416565275962E-02 -4.3873793487136936E-12 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000400000171149E-01 4.0000017114784031E-06 3.8624721436559484E+00 4.2485234582971305E+00 2.8227356656343426E-02 -4.2785774923004283E-12 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000400000166797E-01 4.0000016679581679E-06 4.2485234582971305E+00 4.6345188311235814E+00 3.0791925067797508E-02 -4.1697756358871629E-12 - tau_phys[s] 4.0001848084279178E+06 - conv_vel_eq[cm/s] 1.5051085052069075E+02 - -Convection model: tdc_with_arnett_closure - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000215053E-01 4.0000021504806016E-06 0.0000000000000000E+00 3.5486498395614025E-01 2.3577375312560877E-03 -5.3761439744448572E-12 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000400000211050E-01 4.0000021104709140E-06 3.5486498395614025E-01 7.0972405000613070E-01 4.7154357437006085E-03 -5.2762239022285931E-12 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000400000207048E-01 4.0000020704623351E-06 7.0972405000613070E-01 1.0645732532520236E+00 7.0730684272695410E-03 -5.1760817854074048E-12 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000400000203046E-01 4.0000020304553189E-06 1.0645732532520236E+00 1.4194086493002254E+00 9.4306093752498151E-03 -5.0759396685862157E-12 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000400000199049E-01 4.0000019904503078E-06 1.4194086493002254E+00 1.7742262944368432E+00 1.1788032385444317E-02 -4.9760195963699516E-12 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000400000195047E-01 4.0000019504477335E-06 1.7742262944368432E+00 2.1290222458029628E+00 1.4145311261336450E-02 -4.8760995241536875E-12 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000400000191050E-01 4.0000019104480594E-06 2.1290222458029628E+00 2.4837925615698393E+00 1.6502419813254100E-02 -4.7761794519374234E-12 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000400000187047E-01 4.0000018704517176E-06 2.4837925615698393E+00 2.8385333011139875E+00 1.8859331859532952E-02 -4.6760373351162343E-12 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000400000183051E-01 4.0000018304591570E-06 2.8385333011139875E+00 3.1932405251921545E+00 2.1216021227679013E-02 -4.5761172628999702E-12 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000400000179048E-01 4.0000017904708162E-06 3.1932405251921545E+00 3.5479102961161524E+00 2.3572461755530197E-02 -4.4761971906837061E-12 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000400000175051E-01 4.0000017504871452E-06 3.5479102961161524E+00 3.9025386779275455E+00 2.5928627292416968E-02 -4.3762771184674421E-12 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000400000171055E-01 4.0000017105085826E-06 3.9025386779275455E+00 4.2571217365721683E+00 2.8284491700321844E-02 -4.2763570462511780E-12 - tau_phys[s] 4.0001859038558854E+06 - conv_vel_eq[cm/s] 1.5051080930415756E+02 - -Convection model: tdc_with_arnett_closure_tdc_ss - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397905964313E-01 3.9790596431254168E-06 0.0000000000000000E+00 2.5622791658289248E+02 6.5545214865593907E-02 5.2350368706655104E-08 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395868380273E-01 3.9586838027330971E-06 2.5622791658289248E+02 5.0812241374390942E+02 1.2998190529365766E-01 1.0328946031812336E-07 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393900405307E-01 3.9390040530690553E-06 5.0812241374390942E+02 7.5388597854220450E+02 1.9285025264497857E-01 1.5248834250858323E-07 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000392012896901E-01 3.9201289690074889E-06 7.5388597854220450E+02 9.9191947411124386E+02 2.5374118451669631E-01 1.9967558073652467E-07 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000390214122467E-01 3.9021412246235627E-06 9.9191947411124386E+02 1.2208544242941691E+03 3.1230463341836739E-01 2.4464449199790295E-07 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000388511314366E-01 3.8851131436649770E-06 1.2208544242941691E+03 1.4395732327535929E+03 3.6825470898705265E-01 2.8721426881261891E-07 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000386908437530E-01 3.8690843752875792E-06 1.4395732327535929E+03 1.6472153079290754E+03 4.2137126480196846E-01 3.2728578891472182E-07 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000385407841926E-01 3.8540784192664383E-06 1.6472153079290754E+03 1.8431728577811130E+03 4.7149882264530724E-01 3.6480030385366291E-07 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000384010097301E-01 3.8401009729872936E-06 1.8431728577811130E+03 2.0270770882940803E+03 5.1854304196543177E-01 3.9974357013417006E-07 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000382714228588E-01 3.8271422858515486E-06 2.0270770882940803E+03 2.1987773001609389E+03 5.6246537263637719E-01 4.3213996392399418E-07 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000381517966382E-01 3.8151796637934343E-06 2.1987773001609389E+03 2.3583151952953904E+03 6.0327648235169695E-01 4.6204622006218443E-07 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000380417997322E-01 3.8041799732138720E-06 2.3583151952953904E+03 2.5058965519565550E+03 6.4102901088768294E-01 4.8954517151145183E-07 - tau_phys[s] 1.5401478440959990E+05 - conv_vel_eq[cm/s] 3.9091780705625856E+03 - -Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000400000215053E-01 4.0000021504807583E-06 0.0000000000000000E+00 3.5486668024615414E-01 2.3577481558206366E-03 -5.3761439744448572E-12 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000400000211050E-01 4.0000021104708784E-06 3.5486668024615414E-01 7.0972743898010049E-01 4.7154569688816830E-03 -5.2762239022285931E-12 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000400000207048E-01 4.0000020704621148E-06 7.0972743898010049E-01 1.0645783312664758E+00 7.0731002288777056E-03 -5.1760817854074048E-12 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000400000203046E-01 4.0000020304549073E-06 1.0645783312664758E+00 1.4194154126744352E+00 9.4306517288553094E-03 -5.0759396685862157E-12 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000400000199049E-01 4.0000019904497038E-06 1.4194154126744352E+00 1.7742347394530025E+00 1.1788085266378175E-02 -4.9760195963699516E-12 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000400000195047E-01 4.0000019504469449E-06 1.7742347394530025E+00 2.1290323687063499E+00 1.4145374644691623E-02 -4.8760995241536875E-12 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000400000191044E-01 4.0000019104470786E-06 2.1290323687063499E+00 2.4838043585689924E+00 1.6502493673886610E-02 -4.7759574073324984E-12 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000400000187047E-01 4.0000018704505453E-06 2.4838043585689924E+00 2.8385467683808785E+00 1.8859416172063045E-02 -4.6760373351162343E-12 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000400000183051E-01 4.0000018304577992E-06 2.8385467683808785E+00 3.1932556588623648E+00 2.1216115966492314E-02 -4.5761172628999702E-12 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000400000179048E-01 4.0000017904692746E-06 3.1932556588623648E+00 3.5479270922890560E+00 2.3572566894778938E-02 -4.4761971906837061E-12 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000400000175051E-01 4.0000017504854113E-06 3.5479270922890560E+00 3.9025571326664878E+00 2.5928742806021168E-02 -4.3762771184674421E-12 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000400000171055E-01 4.0000017105066649E-06 3.9025571326664878E+00 4.2571418459046519E+00 2.8284617561970538E-02 -4.2763570462511780E-12 - tau_phys[s] 4.0001848084279178E+06 - conv_vel_eq[cm/s] 1.5051085052069075E+02 - -Convection model: tdc_with_acceleration_limit - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .true. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 7.7007392204799953E+03 4.0000400000000003E-01 4.0000000000040004E-06 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 0.0000000000000000E+00 - 1 7.7007392204799953E+03 7.7007392204799953E+03 4.0000397906682761E-01 3.9790668275639272E-06 0.0000000000000000E+00 2.5610668006689633E+02 6.5514201564637081E-02 5.2332407740607323E-08 - 2 1.5401478440959991E+04 7.7007392204799953E+03 4.0000395870019106E-01 3.9587001910622614E-06 2.5610668006689633E+02 5.0788164619975976E+02 1.2992031496960393E-01 1.0324848986886792E-07 - 3 2.3102217661439987E+04 7.7007392204799953E+03 4.0000393902906861E-01 3.9390290685648684E-06 5.0788164619975976E+02 7.5353032017462010E+02 1.9275927230047529E-01 1.5242580431173991E-07 - 4 3.0802956881919981E+04 7.7007392204799953E+03 4.0000392016185576E-01 3.9201618557629890E-06 7.5353032017462010E+02 9.9145617735202836E+02 2.5362266938362926E-01 1.9959336472474831E-07 - 5 3.8503696102399976E+04 7.7007392204799953E+03 4.0000390218513221E-01 3.9021851322061936E-06 9.9145617735202836E+02 1.2202929165191219E+03 3.1216099509723910E-01 2.4453472424745826E-07 - 6 4.6204435322879974E+04 7.7007392204799953E+03 4.0000388516342067E-01 3.8851634206675437E-06 1.2202929165191219E+03 1.4389246229381201E+03 3.6808878924541771E-01 2.8708857746639893E-07 - 7 5.3905174543359964E+04 7.7007392204799953E+03 4.0000386913999231E-01 3.8691399922794135E-06 1.4389246229381201E+03 1.6464918522109924E+03 4.2118619886098951E-01 3.2714674780276454E-07 - 8 6.1605913763839962E+04 7.7007392204799953E+03 4.0000385413833245E-01 3.8541383324098155E-06 1.6464918522109924E+03 1.8423874388500608E+03 4.7129790600327282E-01 3.6465052244416535E-07 - 9 6.9306652984319953E+04 7.7007392204799953E+03 4.0000384016415824E-01 3.8401641581925262E-06 1.8423874388500608E+03 2.0262427348297099E+03 5.1832960746607926E-01 3.9958560860142711E-07 - 10 7.7007392204799951E+04 7.7007392204799953E+03 4.0000382720776673E-01 3.8272077666912246E-06 2.0262427348297099E+03 2.1979067682379173E+03 5.6224268338884031E-01 4.3197626353741470E-07 - 11 8.4708131425279949E+04 7.7007392204799953E+03 4.0000381524653283E-01 3.8152465328255701E-06 2.1979067682379173E+03 2.3574206248425303E+03 6.0304764384991660E-01 4.6187904922945222E-07 - 12 9.2408870645759947E+04 7.7007392204799953E+03 4.0000380424740695E-01 3.8042474068968323E-06 2.3574206248425303E+03 2.5049892033251745E+03 6.4079690362242092E-01 4.8937658891912150E-07 - tau_phys[s] 1.5401478440959990E+05 - conv_vel_eq[cm/s] 3.9091780705625856E+03 - - -Envelope Decay - - T[K] = 1.0000000000000000E+05 rho[g/cm^3] = 1.0000000000000001E-05 - P[dyn/cm^2] = 8.2543997567252174E+07 L[erg/s] = 2.4440051304810954E+35 - r[cm] = 6.9570000000000000E+10 Hp[cm] = 3.0103560887821615E+08 - gradL = 4.0000000000000002E-01 gradr = 3.9999599999999996E-01 grada = 4.0000000000000002E-01 - conv_vel_start[cm/s] = 1.5051080930415759E+02 gradT_start = 4.0000399998303005E-01 L_conv_start/L = -2.0000157576749444E-05 - Interpretation: Idealized generic envelope decay test in a dilute, slightly stable layer initialized from a nearby unstable convective state. - -Convection model: tdc - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999600459798040E-01 -3.9954020196233482E-06 1.5051080930415759E+02 5.6023963943454127E+01 -1.1495066010169808E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 5.6023963943454127E+01 0.0000000000000000E+00 -2.2204460492503131E-16 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - tau_phys[s] 5.1712339439846779E+04 - -Convection model: tdc_with_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999600459798040E-01 -3.9954020196233482E-06 1.5051080930415759E+02 5.6023963943454127E+01 -1.1495066010169808E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 5.6023963943454127E+01 0.0000000000000000E+00 -2.2204460492503131E-16 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600000000002E-01 -3.9999999999773197E-06 0.0000000000000000E+00 0.0000000000000000E+00 -2.2204460492503131E-16 - tau_phys[s] 5.1712339439846779E+04 - -Convection model: tdc_with_arnett_closure - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601118303718E-01 -3.9888169628287702E-06 1.4333884136075864E+02 1.3651284352704997E+02 -2.7957872683614937E-08 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601065211243E-01 -3.9893478875881710E-06 1.3651284352704997E+02 1.3001573464797281E+02 -2.6630547544925776E-08 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601014660824E-01 -3.9898533917723057E-06 1.3001573464797281E+02 1.2383131323690023E+02 -2.5366774458746022E-08 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600966528720E-01 -3.9903347128151052E-06 1.2383131323690023E+02 1.1794420882538631E+02 -2.4163459677595256E-08 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600920697398E-01 -3.9907930260371550E-06 1.1794420882538631E+02 1.1233983630660511E+02 -2.3017665107261109E-08 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600877055208E-01 -3.9912294479361355E-06 1.1233983630660511E+02 1.0700435306171352E+02 -2.1926599647059675E-08 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600835496074E-01 -3.9916450392873039E-06 1.0700435306171352E+02 1.0192461867543554E+02 -2.0887610752140517E-08 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600795919193E-01 -3.9920408080663319E-06 1.0192461867543554E+02 9.7088157062666198E+01 -1.9898178882371553E-08 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600758228782E-01 -3.9924177122059408E-06 9.7088157062666198E+01 9.2483120841990669E+01 -1.8955909286688666E-08 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600722333783E-01 -3.9927766621969745E-06 9.2483120841990669E+01 8.8098257804847563E+01 -1.8058525341757559E-08 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600688147646E-01 -3.9931185235436489E-06 8.8098257804847563E+01 8.3922879340761455E+01 -1.7203863222903237E-08 - tau_phys[s] 5.1712339439846779E+04 - -Convection model: tdc_with_arnett_closure_tdc_ss - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601118303718E-01 -3.9888169628287702E-06 1.4333884136075864E+02 1.3651284352704997E+02 -2.7957872683614937E-08 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601065211243E-01 -3.9893478875881710E-06 1.3651284352704997E+02 1.3001573464797281E+02 -2.6630547544925776E-08 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601014660824E-01 -3.9898533917723057E-06 1.3001573464797281E+02 1.2383131323690023E+02 -2.5366774458746022E-08 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600966528720E-01 -3.9903347128151052E-06 1.2383131323690023E+02 1.1794420882538631E+02 -2.4163459677595256E-08 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600920697398E-01 -3.9907930260371550E-06 1.1794420882538631E+02 1.1233983630660511E+02 -2.3017665107261109E-08 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600877055208E-01 -3.9912294479361355E-06 1.1233983630660511E+02 1.0700435306171352E+02 -2.1926599647059675E-08 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600835496074E-01 -3.9916450392873039E-06 1.0700435306171352E+02 1.0192461867543554E+02 -2.0887610752140517E-08 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600795919193E-01 -3.9920408080663319E-06 1.0192461867543554E+02 9.7088157062666198E+01 -1.9898178882371553E-08 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600758228782E-01 -3.9924177122059408E-06 9.7088157062666198E+01 9.2483120841990669E+01 -1.8955909286688666E-08 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600722333783E-01 -3.9927766621969745E-06 9.2483120841990669E+01 8.8098257804847563E+01 -1.8058525341757559E-08 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600688147646E-01 -3.9931185235436489E-06 8.8098257804847563E+01 8.3922879340761455E+01 -1.7203863222903237E-08 - tau_phys[s] 5.1712339439846779E+04 - -Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601174068555E-01 -3.9882593144530407E-06 1.5051080930415759E+02 1.4333884136075864E+02 -2.9352007491212365E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601118303718E-01 -3.9888169628287702E-06 1.4333884136075864E+02 1.3651284352704997E+02 -2.7957872683614937E-08 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601065211243E-01 -3.9893478875881710E-06 1.3651284352704997E+02 1.3001573464797281E+02 -2.6630547544925776E-08 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601014660824E-01 -3.9898533917723057E-06 1.3001573464797281E+02 1.2383131323690023E+02 -2.5366774458746022E-08 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999600966528720E-01 -3.9903347128151052E-06 1.2383131323690023E+02 1.1794420882538631E+02 -2.4163459677595256E-08 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600920697398E-01 -3.9907930260371550E-06 1.1794420882538631E+02 1.1233983630660511E+02 -2.3017665107261109E-08 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600877055208E-01 -3.9912294479361355E-06 1.1233983630660511E+02 1.0700435306171352E+02 -2.1926599647059675E-08 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600835496074E-01 -3.9916450392873039E-06 1.0700435306171352E+02 1.0192461867543554E+02 -2.0887610752140517E-08 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600795919193E-01 -3.9920408080663319E-06 1.0192461867543554E+02 9.7088157062666198E+01 -1.9898178882371553E-08 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600758228782E-01 -3.9924177122059408E-06 9.7088157062666198E+01 9.2483120841990669E+01 -1.8955909286688666E-08 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600722333783E-01 -3.9927766621969745E-06 9.2483120841990669E+01 8.8098257804847563E+01 -1.8058525341757559E-08 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600688147646E-01 -3.9931185235436489E-06 8.8098257804847563E+01 8.3922879340761455E+01 -1.7203863222903237E-08 - tau_phys[s] 5.1712339439846779E+04 - -Convection model: tdc_with_acceleration_limit - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .true. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] L_conv/L - 0 0.0000000000000000E+00 2.5856169719923391E+03 4.0000399998303005E-01 3.9999830300230244E-06 1.5051080930415759E+02 1.5051080930415759E+02 -2.0000157576749444E-05 - 1 2.5856169719923391E+03 2.5856169719923391E+03 3.9999601231906107E-01 -3.9876809389473039E-06 1.5051080930415759E+02 1.5039184667947683E+02 -3.0797960848261141E-08 - 2 5.1712339439846783E+03 2.5856169719923391E+03 3.9999601173381572E-01 -3.9882661842796214E-06 1.5039184667947683E+02 1.4322611570825293E+02 -2.9334832785110617E-08 - 3 7.7568509159770174E+03 2.5856169719923391E+03 3.9999601117663830E-01 -3.9888233617351223E-06 1.4322611570825293E+02 1.3640600108423521E+02 -2.7941875258008505E-08 - 4 1.0342467887969357E+04 2.5856169719923391E+03 3.9999601064615808E-01 -3.9893538419139621E-06 1.3640600108423521E+02 1.2991444404870444E+02 -2.6615661452566997E-08 - 5 1.2928084859961695E+04 2.5856169719923391E+03 3.9999601014107378E-01 -3.9898589262223817E-06 1.2991444404870444E+02 1.2373526389999549E+02 -2.5352937971234724E-08 - 6 1.5513701831954035E+04 2.5856169719923391E+03 3.9999600966014942E-01 -3.9903398505742943E-06 1.2373526389999549E+02 1.1785310947451343E+02 -2.4150615063334158E-08 - 7 1.8099318803946375E+04 2.5856169719923391E+03 3.9999600920221112E-01 -3.9907977888759667E-06 1.1785310947451343E+02 1.1225341360941988E+02 -2.3005757965322001E-08 - 8 2.0684935775938713E+04 2.5856169719923391E+03 3.9999600876614372E-01 -3.9912338563081760E-06 1.1225341360941988E+02 1.0692235037754655E+02 -2.1915578463094224E-08 - 9 2.3270552747931051E+04 2.5856169719923391E+03 3.9999600835088761E-01 -3.9916491124191063E-06 1.0692235037754655E+02 1.0184679490185958E+02 -2.0877427786558659E-08 - 10 2.5856169719923389E+04 2.5856169719923391E+03 3.9999600795543599E-01 -3.9920445640402590E-06 1.0184679490185958E+02 9.7014285572520834E+01 -1.9888789060118484E-08 - 11 2.8441786691915731E+04 2.5856169719923391E+03 3.9999600757883197E-01 -3.9924211680367763E-06 9.7014285572520834E+01 9.2412988502788608E+01 -1.8947269531111033E-08 - 12 3.1027403663908070E+04 2.5856169719923391E+03 3.9999600722016609E-01 -3.9927798339027035E-06 9.2412988502788608E+01 8.8031664073266199E+01 -1.8050595906871081E-08 - tau_phys[s] 5.1712339439846779E+04 - - -Carbon Burning Growth - - T[K] = 8.9448446840612292E+08 rho[g/cm^3] = 1.6585817351580659E+05 - P[dyn/cm^2] = 8.7371150320499226E+21 L[erg/s] = 3.9705227734938969E+39 - r[cm] = 1.0818528002666345E+09 Hp[cm] = 4.1262096121030027E+08 - gradL = 2.7977735453489061E-01 gradr = 6.5970726825239474E+00 grada = 2.7977735453489061E-01 - conv_vel_start[cm/s] = 5.0383392852019933E+04 gradT_start = 2.8060983127196415E-01 L_conv_start/L = 9.5746449299924841E-01 - Interpretation: 12 Msun pre-core-collapse model at core-carbon depletion; a hot convective carbon-burning zone taken directly from the saved model. - -Convection model: tdc - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744393250170E-01 8.9397611087579920E-08 5.0383392852019933E+04 5.2121418074864210E+04 8.6482708264866570E-01 9.5759066825599037E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744154258327E-01 8.7007692642466247E-08 5.2121418074864210E+04 5.3553083901440143E+04 8.8858206526151517E-01 9.5759066861825992E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977743966686153E-01 8.5131970906460151E-08 5.3553083901440143E+04 5.4733024690056111E+04 9.0816028833386531E-01 9.5759066890258626E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743818030582E-01 8.3645415219367943E-08 5.4733024690056111E+04 5.5705746147751015E+04 9.2430021490454561E-01 9.5759066912792190E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743699319907E-01 8.2458308462769200E-08 5.5705746147751015E+04 5.6507711040586320E+04 9.3760685513565400E-01 9.5759066930786640E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743603953487E-01 8.1504644270383458E-08 5.6507711040586320E+04 5.7168892765873708E+04 9.4857754403286687E-01 9.5759066945242499E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743526975762E-01 8.0734867018686773E-08 5.7168892765873708E+04 5.7713977130908381E+04 9.5762188201563703E-01 9.5759066956910988E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743464604299E-01 8.0111152384924902E-08 5.7713977130908381E+04 5.8163315974492507E+04 9.6507755792720606E-01 9.5759066966365392E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743413912803E-01 7.9604237436080674E-08 5.8163315974492507E+04 5.8533696442506945E+04 9.7122311327573652E-01 9.5759066974049312E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743372612102E-01 7.9191230398618388E-08 5.8533696442506945E+04 5.8838967982603062E+04 9.7628834567324707E-01 9.5759066980309782E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743338895023E-01 7.8854059604312865E-08 5.8838967982603062E+04 5.9090556574501214E+04 9.8046284122604344E-01 9.5759066985420704E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743311324182E-01 7.8578351207862593E-08 5.9090556574501214E+04 5.9297888015708093E+04 9.8390299792290736E-01 9.5759066989599950E-01 - tau_phys[s] 1.3692865440101397E+04 - conv_vel_eq[cm/s] 6.0268022499057690E+04 - -Convection model: tdc_with_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744393250414E-01 8.9397613549264659E-08 5.0383392852019933E+04 5.2121418074864210E+04 8.6482708264866626E-01 9.5759066825599004E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744154258566E-01 8.7007695038341343E-08 5.2121418074864210E+04 5.3553083901440143E+04 8.8858206526151562E-01 9.5759066861825948E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977743966686386E-01 8.5131973250684700E-08 5.3553083901440143E+04 5.4733024690056103E+04 9.0816028833386564E-01 9.5759066890258582E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743818030815E-01 8.3645417522658156E-08 5.4733024690056103E+04 5.5705746147751001E+04 9.2430021490454595E-01 9.5759066912792157E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743699320134E-01 8.2458310733371101E-08 5.5705746147751001E+04 5.6507711040586320E+04 9.3760685513565456E-01 9.5759066930786618E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743603953714E-01 8.1504646514724638E-08 5.6507711040586320E+04 5.7168892765873701E+04 9.4857754403286731E-01 9.5759066945242477E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743526975984E-01 8.0734869241831377E-08 5.7168892765873701E+04 5.7713977130908395E+04 9.5762188201563780E-01 9.5759066956910943E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743464604521E-01 8.0111154590894669E-08 5.7713977130908395E+04 5.8163315974492529E+04 9.6507755792720706E-01 9.5759066966365369E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743413913025E-01 7.9604239628091563E-08 5.8163315974492529E+04 5.8533696442506960E+04 9.7122311327573740E-01 9.5759066974049289E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743372612318E-01 7.9191232579256562E-08 5.8533696442506960E+04 5.8838967982603062E+04 9.7628834567324763E-01 9.5759066980309748E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743338895239E-01 7.8854061775666592E-08 5.8838967982603062E+04 5.9090556574501214E+04 9.8046284122604399E-01 9.5759066985420671E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743311324399E-01 7.8578353371624311E-08 5.9090556574501214E+04 5.9297888015708078E+04 9.8390299792290770E-01 9.5759066989599928E-01 - tau_phys[s] 1.3692865440101406E+04 - conv_vel_eq[cm/s] 6.0268022499057653E+04 - -Convection model: tdc_with_arnett_closure - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356745E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744520385489E-01 9.0668964263554147E-08 5.0383392852019933E+04 5.1390577002891834E+04 8.5270056776287106E-01 9.5759066806327564E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744362425339E-01 8.9089362790023356E-08 5.1390577002891834E+04 5.2301759098960865E+04 8.6781939957925058E-01 9.5759066830271533E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744224406487E-01 8.7709174238387871E-08 5.2301759098960865E+04 5.3124777794366411E+04 8.8147537602046233E-01 9.5759066851192776E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977744103538243E-01 8.6500491832886817E-08 5.3124777794366411E+04 5.3867097100848223E+04 8.9379234405261265E-01 9.5759066869514264E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743997479193E-01 8.5439901298144772E-08 5.3867097100848223E+04 5.4535765173182728E+04 9.0488725051557095E-01 9.5759066885590949E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743904252494E-01 8.4507634317939072E-08 5.4535765173182728E+04 5.5137390034761258E+04 9.1486973934848292E-01 9.5759066899722467E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743822179751E-01 8.3686906889868532E-08 5.5137390034761258E+04 5.5678128969929494E+04 9.2384197558166425E-01 9.5759066912163249E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743749828748E-01 8.2963396894463927E-08 5.5678128969929494E+04 5.6163688685138841E+04 9.3189864801051225E-01 9.5759066923130387E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743685971829E-01 8.2324827671967184E-08 5.6163688685138841E+04 5.6599333732951032E+04 9.3912710897119844E-01 9.5759066932809978E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743629552376E-01 8.1760633170864908E-08 5.6599333732951032E+04 5.6989901076132992E+04 9.4560761599609822E-01 9.5759066941362170E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743579657710E-01 8.1261686481527235E-08 5.6989901076132992E+04 5.7339819027223064E+04 9.5141364606943513E-01 9.5759066948925309E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743535496868E-01 8.0820078075982598E-08 5.7339819027223064E+04 5.7653129122727834E+04 9.5661225857592092E-01 9.5759066955619321E-01 - tau_phys[s] 1.3692865440101436E+04 - conv_vel_eq[cm/s] 6.0268022499057523E+04 - -Convection model: tdc_with_arnett_closure_tdc_ss - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744426707885E-01 8.9732188207931824E-08 5.0383392852019933E+04 5.1927077174868406E+04 8.6160247211828300E-01 9.5759066820527439E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744207525823E-01 8.7540367644418904E-08 5.1927077174868406E+04 5.3227218358122140E+04 8.8317512589623071E-01 9.5759066853751584E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744030900475E-01 8.5774114117380993E-08 5.3227218358122140E+04 5.4323268890729865E+04 9.0136139594723264E-01 9.5759066880524868E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743887354872E-01 8.4338658097761514E-08 5.4323268890729865E+04 5.5247858706982588E+04 9.1670269599183229E-01 9.5759066902283851E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743769897684E-01 8.3164086240160149E-08 5.5247858706982588E+04 5.6028154431140800E+04 9.2964978952174548E-01 9.5759066920088287E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743673258043E-01 8.2197689805054950E-08 5.6028154431140800E+04 5.6686876221858103E+04 9.4057966183882047E-01 9.5759066934737169E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743593389864E-01 8.1399008017221890E-08 5.6686876221858103E+04 5.7243084182376369E+04 9.4980856860321550E-01 9.5759066946843774E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743527140164E-01 8.0736511052647707E-08 5.7243084182376369E+04 5.7712801903750500E+04 9.5760238200370451E-01 9.5759066956886052E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743472020744E-01 8.0185316803658979E-08 5.7712801903750500E+04 5.8109519983545382E+04 9.6418494541535593E-01 9.5759066965241202E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743426047058E-01 7.9725579962603688E-08 5.8109519983545382E+04 5.8444608013075558E+04 9.6974490931719814E-01 9.5759066972209994E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743387622106E-01 7.9341330442321321E-08 5.8444608013075558E+04 5.8727654853248649E+04 9.7444137733516767E-01 9.5759066978034535E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743355451007E-01 7.9019619479967841E-08 5.8727654853248649E+04 5.8966751557618190E+04 9.7840860065617974E-01 9.5759066982911101E-01 - tau_phys[s] 1.3692865440101397E+04 - conv_vel_eq[cm/s] 6.0268022499057690E+04 - -Convection model: tdc_with_arnett_closure_tdc_ss_mlt_corr - include_mlt_corr_to_tdc = .true. - use_TDC_arnett_velocity_closure = .true. - use_TDC_acceleration_limit = .false. - TDC_arnett_growth_target = tdc - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356567E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744426708129E-01 8.9732190678829608E-08 5.0383392852019933E+04 5.1927077174868406E+04 8.6160247211828356E-01 9.5759066820527394E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744207526067E-01 8.7540370054961924E-08 5.1927077174868406E+04 5.3227218358122140E+04 8.8317512589623126E-01 9.5759066853751540E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744030900709E-01 8.5774116479288135E-08 5.3227218358122140E+04 5.4323268890729880E+04 9.0136139594723341E-01 9.5759066880524835E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743887355105E-01 8.4338660420141414E-08 5.4323268890729880E+04 5.5247858706982610E+04 9.1670269599183318E-01 9.5759066902283818E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743769897911E-01 8.3164088530196320E-08 5.5247858706982610E+04 5.6028154431140822E+04 9.2964978952174637E-01 9.5759066920088254E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743673258265E-01 8.2197692068480073E-08 5.6028154431140822E+04 5.6686876221858118E+04 9.4057966183882125E-01 9.5759066934737114E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743593390086E-01 8.1399010258654226E-08 5.6686876221858118E+04 5.7243084182376377E+04 9.4980856860321616E-01 9.5759066946843718E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743527140386E-01 8.0736513275837296E-08 5.7243084182376377E+04 5.7712801903750507E+04 9.5760238200370518E-01 9.5759066956886019E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743472020961E-01 8.0185319011670677E-08 5.7712801903750507E+04 5.8109519983545397E+04 9.6418494541535671E-01 9.5759066965241146E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743426047275E-01 7.9725582157955909E-08 5.8109519983545397E+04 5.8444608013075565E+04 9.6974490931719892E-01 9.5759066972209961E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743387622322E-01 7.9341332627092990E-08 5.8444608013075565E+04 5.8727654853248656E+04 9.7444137733516833E-01 9.5759066978034502E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743355451229E-01 7.9019621655880471E-08 5.8727654853248656E+04 5.8966751557618198E+04 9.7840860065618040E-01 9.5759066982911067E-01 - tau_phys[s] 1.3692865440101406E+04 - conv_vel_eq[cm/s] 6.0268022499057653E+04 - -Convection model: tdc_with_acceleration_limit - include_mlt_corr_to_tdc = .false. - use_TDC_arnett_velocity_closure = .false. - use_TDC_acceleration_limit = .true. - TDC_arnett_growth_target = mlt - step time[s] dt[s] gradT Y_face conv_vel_start[cm/s] conv_vel[cm/s] conv_vel/conv_vel_eq L_conv/L - 0 0.0000000000000000E+00 6.8464327200506989E+02 2.8060983127196415E-01 8.3247673707353975E-04 5.0383392852019933E+04 5.0383392852019933E+04 8.3598881733356512E-01 9.5746449299924841E-01 - 1 6.8464327200506989E+02 6.8464327200506989E+02 2.7977744429205098E-01 8.9757160379176415E-08 5.0383392852019933E+04 5.1912630061385767E+04 8.6136275770782822E-01 9.5759066820148897E-01 - 2 1.3692865440101398E+03 6.8464327200506989E+02 2.7977744211459010E-01 8.7579699506788919E-08 5.1912630061385767E+04 5.3203314123834403E+04 8.8277849376369122E-01 9.5759066853155372E-01 - 3 2.0539298160152098E+03 6.8464327200506989E+02 2.7977744035601065E-01 8.5821120051982845E-08 5.3203314123834403E+04 5.4293514955356935E+04 9.0086770237410452E-01 9.5759066879812349E-01 - 4 2.7385730880202796E+03 6.8464327200506989E+02 2.7977743892395596E-01 8.4389065321904641E-08 5.4293514955356935E+04 5.5214858089850313E+04 9.1615513169879792E-01 9.5759066901519774E-01 - 5 3.4232163600253493E+03 6.8464327200506989E+02 2.7977743775004338E-01 8.3215152783814713E-08 5.5214858089850313E+04 5.5993771699908561E+04 9.2907929243545428E-01 9.5759066919314217E-01 - 6 4.1078596320304196E+03 6.8464327200506989E+02 2.7977743678256012E-01 8.2247669492817401E-08 5.5993771699908561E+04 5.6652429137465610E+04 9.4000809696968879E-01 9.5759066933979553E-01 - 7 4.7925029040354893E+03 6.8464327200506989E+02 2.7977743598170535E-01 8.1446814735415659E-08 5.6652429137465610E+04 5.7209484292184556E+04 9.4925106084373423E-01 9.5759066946119098E-01 - 8 5.4771461760405591E+03 6.8464327200506989E+02 2.7977743531639254E-01 8.0781501953059110E-08 5.7209484292184556E+04 5.7680659013403005E+04 9.5706904958271799E-01 9.5759066956204064E-01 - 9 6.1617894480456289E+03 6.8464327200506989E+02 2.7977743476203953E-01 8.0227148896885881E-08 5.7680659013403005E+04 5.8079220478626514E+04 9.6368219945385802E-01 9.5759066964607087E-01 - 10 6.8464327200506987E+03 6.8464327200506989E+02 2.7977743429900392E-01 7.9764113337606552E-08 5.8079220478626514E+04 5.8416373912082607E+04 9.6927643366755500E-01 9.5759066971625895E-01 - 11 7.5310759920557684E+03 6.8464327200506989E+02 2.7977743391145249E-01 7.9376561880575233E-08 5.8416373912082607E+04 5.8701588471312651E+04 9.7400886966600686E-01 9.5759066977500484E-01 - 12 8.2157192640608391E+03 6.8464327200506989E+02 2.7977743358652696E-01 7.9051636338452517E-08 5.8701588471312651E+04 5.8942869317359953E+04 9.7801233346061001E-01 9.5759066982425800E-01 - tau_phys[s] 1.3692865440101397E+04 - conv_vel_eq[cm/s] 6.0268022499057690E+04 + TDC: Y, conv_vel_start, conv_vel, dt 3.9999852208023926D-06 0.0000000000000000D+00 1.5051085052069075D+02 1.0000000000000000D+40 + MLT: Y, conv_vel_start, conv_vel, Gamma 3.9999830300230244D-06 0.0000000000000000D+00 1.5051080930415759D+02 1.3740991947818479D-03 From 75daf1b405fb2d340893b041c62d1580fbd374cd Mon Sep 17 00:00:00 2001 From: Debraheem Date: Mon, 4 May 2026 18:11:51 -0400 Subject: [PATCH 11/12] clean up --- star/defaults/profile_columns.list | 3 - star/private/alloc.f90 | 6 - star/private/profile_getval.f90 | 9 +- star/private/star_profile_def.f90 | 8 +- star/private/tdc_hydro.f90 | 421 ++++++++++------------- star_data/public/star_data_step_work.inc | 2 - 6 files changed, 176 insertions(+), 273 deletions(-) diff --git a/star/defaults/profile_columns.list b/star/defaults/profile_columns.list index 6de3e6c83..188d2e45e 100644 --- a/star/defaults/profile_columns.list +++ b/star/defaults/profile_columns.list @@ -750,9 +750,6 @@ !mlt_tdc_opacity_face !mlt_tdc_scale_height_face !mlt_tdc_gradr_face - !tdc_Chi_div_w_face - !tdc_Eq_div_w_face - !tdc_Chi_div_w_cell !# RTI diff --git a/star/private/alloc.f90 b/star/private/alloc.f90 index d4215a654..b94e58e80 100644 --- a/star/private/alloc.f90 +++ b/star/private/alloc.f90 @@ -1115,12 +1115,6 @@ subroutine star_info_arrays(s, c_in, action_in, ierr) if (failed('Chi_ad')) exit call do1_ad(s% Eq_ad, c% Eq_ad) if (failed('Eq_ad')) exit - call do1_ad(s% tdc_Chi_div_w_face_ad, c% tdc_Chi_div_w_face_ad) - if (failed('tdc_Chi_div_w_face_ad')) exit - call do1_ad(s% tdc_Eq_div_w_face_ad, c% tdc_Eq_div_w_face_ad) - if (failed('tdc_Eq_div_w_face_ad')) exit - call do1_ad(s% tdc_Chi_div_w_cell_ad, c% tdc_Chi_div_w_cell_ad) - if (failed('tdc_Chi_div_w_cell_ad')) exit call do1_ad(s% COUPL_ad, c% COUPL_ad) if (failed('COUPL_ad')) exit call do1_ad(s% Lr_ad, c% Lr_ad) diff --git a/star/private/profile_getval.f90 b/star/private/profile_getval.f90 index 3d34144b7..383e6a2ad 100644 --- a/star/private/profile_getval.f90 +++ b/star/private/profile_getval.f90 @@ -279,7 +279,7 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) d_dlnR00, d_dlnRp1, d_dv00, d_dvp1 integer :: j, nz, ionization_k, klo, khi, i, ii, ierr real(dp) :: f, lgT, full_on, full_off, am_nu_factor - logical :: rsp_or_w, face_cache_active, tdc_cache_active + logical :: rsp_or_w, face_cache_active include 'formats' if (s% rotation_flag) then @@ -305,7 +305,6 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) int_flag = .false. rsp_or_w = s% RSP_flag .or. s% RSP2_flag face_cache_active = s% use_face_values_eos_and_kap_mlt_tdc - tdc_cache_active = s% MLT_option == 'TDC' .and. .not. s% RSP_flag .and. (s% v_flag .or. s% u_flag) if (c > extra_offset) then i = c - extra_offset @@ -1941,12 +1940,6 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_scale_height_face_ad(k)% val case(p_mlt_tdc_gradr_face) if (face_cache_active .and. s% have_mlt_tdc_face_state(k)) val = s% mlt_tdc_gradr_face_ad(k)% val - case(p_tdc_Chi_div_w_face) - if (tdc_cache_active) val = s% tdc_Chi_div_w_face_ad(k)% val - case(p_tdc_Eq_div_w_face) - if (tdc_cache_active) val = s% tdc_Eq_div_w_face_ad(k)% val - case(p_tdc_Chi_div_w_cell) - if (tdc_cache_active) val = s% tdc_Chi_div_w_cell_ad(k)% val case(p_rsp_Et) diff --git a/star/private/star_profile_def.f90 b/star/private/star_profile_def.f90 index bdb922ee3..945c60217 100644 --- a/star/private/star_profile_def.f90 +++ b/star/private/star_profile_def.f90 @@ -609,11 +609,8 @@ module star_profile_def integer, parameter :: p_mlt_tdc_opacity_face = p_mlt_tdc_grada_face + 1 integer, parameter :: p_mlt_tdc_scale_height_face = p_mlt_tdc_opacity_face + 1 integer, parameter :: p_mlt_tdc_gradr_face = p_mlt_tdc_scale_height_face + 1 - integer, parameter :: p_tdc_Chi_div_w_face = p_mlt_tdc_gradr_face + 1 - integer, parameter :: p_tdc_Eq_div_w_face = p_tdc_Chi_div_w_face + 1 - integer, parameter :: p_tdc_Chi_div_w_cell = p_tdc_Eq_div_w_face + 1 - integer, parameter :: p_rsp_log_erad = p_tdc_Chi_div_w_cell + 1 + integer, parameter :: p_rsp_log_erad = p_mlt_tdc_gradr_face + 1 integer, parameter :: p_rsp_erad = p_rsp_log_erad + 1 integer, parameter :: p_rsp_logEt = p_rsp_erad + 1 integer, parameter :: p_rsp_Et = p_rsp_logEt + 1 @@ -1301,9 +1298,6 @@ subroutine profile_column_names_init(ierr) profile_column_name(p_mlt_tdc_opacity_face) = 'mlt_tdc_opacity_face' profile_column_name(p_mlt_tdc_scale_height_face) = 'mlt_tdc_scale_height_face' profile_column_name(p_mlt_tdc_gradr_face) = 'mlt_tdc_gradr_face' - profile_column_name(p_tdc_Chi_div_w_face) = 'tdc_Chi_div_w_face' - profile_column_name(p_tdc_Eq_div_w_face) = 'tdc_Eq_div_w_face' - profile_column_name(p_tdc_Chi_div_w_cell) = 'tdc_Chi_div_w_cell' profile_column_name(p_rsp_Et) = 'rsp_Et' profile_column_name(p_rsp_logEt) = 'rsp_logEt' diff --git a/star/private/tdc_hydro.f90 b/star/private/tdc_hydro.f90 index d1259549e..cf714d4bb 100644 --- a/star/private/tdc_hydro.f90 +++ b/star/private/tdc_hydro.f90 @@ -59,7 +59,7 @@ subroutine set_viscosity_vars_TDC(s, ierr) !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) do k = 1, s%nz if (s%use_face_values_eos_and_kap_mlt_tdc) then - x = get_TDC_alpha_M_Hp_face(s, k, op_err) + x = get_TDC_Hp_face(s, k, op_err) if (op_err /= 0) then !$OMP ATOMIC WRITE ierr = op_err @@ -68,11 +68,7 @@ subroutine set_viscosity_vars_TDC(s, ierr) end if else if (s%Hp_face(k) <= 0d0) then ! this scale height for face is already calculated in TDC - s%Hp_face(k) = get_TDC_alpha_M_Hp_face_val(s, k, op_err) ! because this is called before s% scale_height(k) is updated in mlt_vars. - if (op_err /= 0) then - !$OMP ATOMIC WRITE - ierr = op_err - end if + s%Hp_face(k) = get_scale_height_face_val(s, k) ! because this is called before s% scale_height(k) is updated in mlt_vars. end if end do !$OMP END PARALLEL DO @@ -81,33 +77,6 @@ subroutine set_viscosity_vars_TDC(s, ierr) return end if !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) - do k = 1, s%nz - call build_tdc_Chi_div_w_face_ad(s, k, s%tdc_Chi_div_w_face_ad(k), op_err) - if (op_err /= 0) then - !$OMP ATOMIC WRITE - ierr = op_err - end if - call build_tdc_Eq_div_w_face_ad(s, k, s%tdc_Eq_div_w_face_ad(k), op_err) - if (op_err /= 0) then - !$OMP ATOMIC WRITE - ierr = op_err - end if - if (s%v_flag) then - call build_tdc_Chi_div_w_cell_ad(s, k, s%tdc_Chi_div_w_cell_ad(k), op_err) - if (op_err /= 0) then - !$OMP ATOMIC WRITE - ierr = op_err - end if - else - s%tdc_Chi_div_w_cell_ad(k) = 0d0 - end if - end do - !$OMP END PARALLEL DO - if (ierr /= 0) then - if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 2', s%model_number - return - end if - !$OMP PARALLEL DO PRIVATE(k,op_err,x) SCHEDULE(dynamic,2) do k = 1, s%nz x = compute_Chi_div_w_face(s, k, op_err) ! Sets Chi_face if (op_err /= 0) then @@ -131,7 +100,7 @@ subroutine set_viscosity_vars_TDC(s, ierr) end do !$OMP END PARALLEL DO if (ierr /= 0) then - if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 3', s%model_number + if (s%report_ierr) write (*, 2) 'failed in set_viscosity_vars_TDC loop 2', s%model_number return end if end subroutine set_viscosity_vars_TDC @@ -152,7 +121,7 @@ subroutine get_TDC_alfa_beta_face_weights(s, k, alfa, beta) end subroutine get_TDC_alfa_beta_face_weights - function get_TDC_alpha_M_Hp_face(s, k, ierr) result(Hp_face) + function get_TDC_Hp_face(s, k, ierr) result(Hp_face) type(star_info), pointer :: s integer, intent(in) :: k integer, intent(out) :: ierr @@ -164,72 +133,20 @@ function get_TDC_alpha_M_Hp_face(s, k, ierr) result(Hp_face) else Hp_face = get_scale_height_face(s, k) end if - end function get_TDC_alpha_M_Hp_face + end function get_TDC_Hp_face - real(dp) function get_TDC_alpha_M_Hp_face_val(s, k, ierr) result(Hp_face) + function wrap_Hp_cell(s, k, ierr) result(Hp_cell) ! cm , different than rsp2 type(star_info), pointer :: s integer, intent(in) :: k integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: Hp_face_ad - - Hp_face_ad = get_TDC_alpha_M_Hp_face(s, k, ierr) - if (ierr /= 0) then - Hp_face = -1d0 - else - Hp_face = Hp_face_ad%val - end if - end function get_TDC_alpha_M_Hp_face_val - - - function get_tdc_face_velocity_ad(s, k) result(w_00) - type(star_info), pointer :: s - integer, intent(in) :: k - type(auto_diff_real_star_order1) :: w_00 - - if (s%okay_to_set_mlt_vc .and. & - s%TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then - w_00 = s%mlt_vc_old(k)/sqrt_2_div_3 - else - w_00 = s%mlt_vc_ad(k)/sqrt_2_div_3 - end if - end function get_tdc_face_velocity_ad - - - function get_tdc_cell_velocity_ad(s, k) result(w_00) - type(star_info), pointer :: s - integer, intent(in) :: k - type(auto_diff_real_star_order1) :: w_00 - - if (k < s%nz) then - if (s%okay_to_set_mlt_vc .and. & - s%TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then - w_00 = 0.5d0*(s%mlt_vc_old(k) + s%mlt_vc_old(k+1))/sqrt_2_div_3 - else - w_00 = 0.5d0*(s%mlt_vc_ad(k) + shift_p1(s%mlt_vc_ad(k+1)))/sqrt_2_div_3 - end if - else - if (s%okay_to_set_mlt_vc .and. & - s%TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then - w_00 = 0.5d0*s%mlt_vc_old(k)/sqrt_2_div_3 - else - w_00 = 0.5d0*s%mlt_vc_ad(k)/sqrt_2_div_3 - end if - end if - end function get_tdc_cell_velocity_ad - - - function wrap_Hp_cell(s, k) result(Hp_cell) ! cm , different than rsp2 - type(star_info), pointer :: s - integer, intent(in) :: k - integer :: ierr type(auto_diff_real_star_order1) :: Hp1, Hp0, Hp_cell ierr = 0 - Hp0 = get_TDC_alpha_M_Hp_face(s, k, ierr) + Hp0 = get_TDC_Hp_face(s, k, ierr) if (ierr /= 0) return Hp1 = 0d0 if (k+1 < s%nz) then - Hp1 = shift_p1(get_TDC_alpha_M_Hp_face(s, k+1, ierr)) + Hp1 = shift_p1(get_TDC_Hp_face(s, k+1, ierr)) if (ierr /= 0) return end if Hp_cell = 0.5d0*(Hp0 + Hp1) @@ -246,7 +163,8 @@ function Hp_cell_for_Chi(s, k, ierr) result(Hp_cell) ! cm include 'formats' ierr = 0 - Hp_cell = wrap_Hp_cell(s, k) + Hp_cell = wrap_Hp_cell(s, k, ierr) + if (ierr /= 0) return return ! below is skipped, for now. d_00 = wrap_d_00(s, k) @@ -266,39 +184,6 @@ function Hp_cell_for_Chi(s, k, ierr) result(Hp_cell) ! cm end if end function Hp_cell_for_Chi - - function get_tdc_Chi_div_w_cell_ad(s, k, ierr) result(Chi_div_w_cell) - type(star_info), pointer :: s - integer, intent(in) :: k - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: Chi_div_w_cell - - ierr = 0 - Chi_div_w_cell = s%tdc_Chi_div_w_cell_ad(k) - end function get_tdc_Chi_div_w_cell_ad - - - function get_tdc_Chi_div_w_face_ad(s, k, ierr) result(Chi_div_w_face) - type(star_info), pointer :: s - integer, intent(in) :: k - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: Chi_div_w_face - - ierr = 0 - Chi_div_w_face = s%tdc_Chi_div_w_face_ad(k) - end function get_tdc_Chi_div_w_face_ad - - - function get_tdc_Eq_div_w_face_ad(s, k, ierr) result(Eq_div_w_face) - type(star_info), pointer :: s - integer, intent(in) :: k - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: Eq_div_w_face - - ierr = 0 - Eq_div_w_face = s%tdc_Eq_div_w_face_ad(k) - end function get_tdc_Eq_div_w_face_ad - ! this function is only called internally in TDC_Uq_face, and for v_flag only. function compute_Chi_cell(s, k, ierr) result(Chi_cell) ! does not update s% Chi or Chi_ad ! eddy viscosity energy (Kuhfuss 1986) [erg] @@ -306,57 +191,81 @@ function compute_Chi_cell(s, k, ierr) result(Chi_cell) ! does not update s% Chi integer, intent(in) :: k type(auto_diff_real_star_order1) :: Chi_cell integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: w_00 - - ierr = 0 - Chi_cell = get_tdc_Chi_div_w_cell_ad(s, k, ierr) - if (ierr /= 0) return - w_00 = get_tdc_cell_velocity_ad(s, k) - Chi_cell = Chi_cell*w_00 - end function compute_Chi_cell - - - subroutine build_tdc_Chi_div_w_cell_ad(s, k, Chi_div_w_cell, ierr) - ! Cell-centered eddy viscosity energy divided by the local velocity factor. - type(star_info), pointer :: s - integer, intent(in) :: k - type(auto_diff_real_star_order1), intent(out) :: Chi_div_w_cell - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: rho2, r6_cell, d_v_div_r, Hp_cell, d_00, r_00, r_p1 + type(auto_diff_real_star_order1) :: & + rho2, r6_cell, d_v_div_r, Hp_cell, w_00, d_00, r_00, r_p1 real(dp) :: f, ALFAM_ALFA - + logical :: dbg + include 'formats' ierr = 0 + dbg = .false. + ! check where we are getting alfam from. if (s%MLT_option == 'TDC' .and. .not. s%RSP2_flag) then ALFAM_ALFA = s%TDC_alpha_M*s%mixing_length_alpha - else + else ! this is for safety, but probably is never called. ALFAM_ALFA = 0d0 end if if (ALFAM_ALFA == 0d0 .or. & - k <= s%TDC_num_outermost_cells_forced_nonturbulent .or. & - k > s%nz - s%TDC_num_innermost_cells_forced_nonturbulent) then - Chi_div_w_cell = 0d0 - return - end if - - Hp_cell = Hp_cell_for_Chi(s, k, ierr) - if (ierr /= 0) return - if (s%TDC_use_density_form_for_eddy_viscosity) then - d_v_div_r = compute_rho_form_of_d_v_div_r(s, k, ierr) + k <= s% TDC_num_outermost_cells_forced_nonturbulent .or. & + k > s% nz - s% TDC_num_innermost_cells_forced_nonturbulent) then + Chi_cell = 0d0 else - d_v_div_r = compute_d_v_div_r(s, k, ierr) - end if - if (ierr /= 0) return + Hp_cell = Hp_cell_for_Chi(s, k, ierr) + if (ierr /= 0) return + if (s%TDC_use_density_form_for_eddy_viscosity) then + ! new density derivative term + d_v_div_r = compute_rho_form_of_d_v_div_r(s, k, ierr) + else + d_v_div_r = compute_d_v_div_r(s, k, ierr) + end if + if (ierr /= 0) return - d_00 = wrap_d_00(s, k) - f = (16d0/3d0)*pi*ALFAM_ALFA/s%dm(k) - rho2 = pow2(d_00) - r_00 = wrap_r_00(s, k) - r_p1 = wrap_r_p1(s, k) - r6_cell = 0.5d0*(pow6(r_00) + pow6(r_p1)) - Chi_div_w_cell = f*rho2*r6_cell*d_v_div_r*Hp_cell - end subroutine build_tdc_Chi_div_w_cell_ad + ! don't need to check if mlt_vc > 0 here. + if (k < s% nz) then + if (s% okay_to_set_mlt_vc .and. & + s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. + w_00 = 0.5d0*(s% mlt_vc_old(k) + s% mlt_vc_old(k+1))/sqrt_2_div_3! same as info%A0 from TDC + else + w_00 = 0.5d0*(s% mlt_vc_ad(k) + shift_p1(s% mlt_vc_ad(k+1)))/sqrt_2_div_3! same as info%A0 from TDC + end if + else + if (s% okay_to_set_mlt_vc .and. & + s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. + w_00 = 0.5d0*s% mlt_vc_old(k)/sqrt_2_div_3! same as info%A0 from TDC + else + w_00 = 0.5d0*s% mlt_vc_ad(k)/sqrt_2_div_3! same as info%A0 from TDC + end if + end if + d_00 = wrap_d_00(s, k) + f = (16d0/3d0)*pi*ALFAM_ALFA/s%dm(k) + rho2 = pow2(d_00) + r_00 = wrap_r_00(s, k) + r_p1 = wrap_r_p1(s, k) + r6_cell = 0.5d0*(pow6(r_00) + pow6(r_p1)) + Chi_cell = f*rho2*r6_cell*d_v_div_r*Hp_cell*w_00 + ! units = g^-1 cm s^-1 g^2 cm^-6 cm^6 s^-1 cm + ! = g cm^2 s^-2 + ! = erg + + end if + ! this is set in Chi_div_w_face + !s%Chi(k) = Chi_cell%val + !s%Chi_ad(k) = Chi_cell + + if (dbg .and. k == -100) then + write (*, *) ' s% ALFAM_ALFA', ALFAM_ALFA + write (*, *) 'Hp_cell', Hp_cell%val + write (*, *) 'd_v_div_r', d_v_div_r%val + write (*, *) ' f', f + write (*, *) 'w_00', w_00%val + write (*, *) 'd_00 ', d_00%val + write (*, *) 'rho2 ', rho2%val + write (*, *) 'r_00', r_00%val + write (*, *) 'r_p1 ', r_p1%val + write (*, *) 'r6_cell', r6_cell%val + end if + end function compute_Chi_cell ! face centered variables for tdc update below function compute_Chi_div_w_face(s, k, ierr) result(Chi_face) @@ -365,44 +274,29 @@ function compute_Chi_div_w_face(s, k, ierr) result(Chi_face) integer, intent(in) :: k type(auto_diff_real_star_order1) :: Chi_face integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: w_00 + type(auto_diff_real_star_order1) :: & + rho2, r6_face, d_v_div_r, Hp_face, w_00, d_00, r_00, r_p1 + real(dp) :: f, ALFAM_ALFA, dmbar + logical :: dbg + include 'formats' ierr = 0 - Chi_face = get_tdc_Chi_div_w_face_ad(s, k, ierr) - if (ierr /= 0) return - - ! Chi_cell does not set Chi, we store Chi_face in s% Chi and s% Chi_ad - w_00 = get_tdc_face_velocity_ad(s, k) - s%Chi(k) = Chi_face%val*w_00%val - s%Chi_ad(k) = Chi_face*w_00 - end function compute_Chi_div_w_face - - - subroutine build_tdc_Chi_div_w_face_ad(s, k, Chi_div_w_face, ierr) - ! Face-centered eddy viscosity energy divided by the local velocity factor. - type(star_info), pointer :: s - integer, intent(in) :: k - type(auto_diff_real_star_order1), intent(out) :: Chi_div_w_face - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: rho2, r6_face, d_v_div_r, Hp_face, d_00, r_00 - real(dp) :: f, ALFAM_ALFA, dmbar - - ierr = 0 - - if (s%MLT_option == 'TDC' .and. .not. s%RSP2_flag) then - ALFAM_ALFA = s%TDC_alpha_M*s%mixing_length_alpha - else - ALFAM_ALFA = 0d0 - end if - - if (ALFAM_ALFA == 0d0 .or. & - k > s%nz - s%TDC_num_innermost_cells_forced_nonturbulent) then - Chi_div_w_face = 0d0 - return - end if - - Hp_face = get_TDC_alpha_M_Hp_face(s, k, ierr) + dbg = .false. + + ! check where we are getting alfam from. + if (s%MLT_option == 'TDC' .and. .not. s%RSP2_flag) then + ALFAM_ALFA = s%TDC_alpha_M*s%mixing_length_alpha + else ! this is for safety, but probably is never called. + ALFAM_ALFA = 0d0 + end if + + if (ALFAM_ALFA == 0d0 .or. & + k > s%nz - s% TDC_num_innermost_cells_forced_nonturbulent) then + Chi_face = 0d0 + else + Hp_face = get_TDC_Hp_face(s, k, ierr) if (ierr /= 0) return if (s%TDC_use_density_form_for_eddy_viscosity) then + ! new density derivative form d_v_div_r = compute_rho_form_of_d_v_div_r_face(s, k, ierr) else d_v_div_r = compute_d_v_div_r_face(s, k, ierr) @@ -410,69 +304,92 @@ subroutine build_tdc_Chi_div_w_face_ad(s, k, Chi_div_w_face, ierr) if (ierr /= 0) return if (k >= 2) then - dmbar = 0.5d0*(s%dm(k) + s%dm(k-1)) + dmbar = 0.5d0*(s% dm(k) + s% dm(k-1)) else - dmbar = 0.5d0*s%dm(k) + dmbar = 0.5d0*s% dm(k) end if d_00 = get_rho_face(s, k) f = (16d0/3d0)*pi*ALFAM_ALFA/dmbar rho2 = pow2(d_00) r_00 = wrap_r_00(s, k) - r6_face = pow6(r_00) - Chi_div_w_face = f*rho2*r6_face*d_v_div_r*Hp_face - end subroutine build_tdc_Chi_div_w_face_ad + !r_p1 = wrap_r_p1(s, k) + r6_face = pow6(r_00) !0.5d0*(pow6(r_00) + pow6(r_p1)) + Chi_face = f*rho2*r6_face*d_v_div_r*Hp_face!*w_00 + ! units = g^-1 cm s^-1 g^2 cm^-6 cm^6 s^-1 cm * [s/cm] ! [1/w_00] = [s/cm] + ! = g cm^2 s^-2 * [s/cm] + ! = erg ! * [s / cm] - > [erg] * [s/cm] + + end if + + ! Chi_cell does not set Chi, we store Chi_face in s% Chi and s% Chi_ad + if (s% okay_to_set_mlt_vc .and. & + s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. + w_00 = s% mlt_vc_old(k)/sqrt_2_div_3! same as info%A0 from TDC + else + w_00 = s% mlt_vc_ad(k)/sqrt_2_div_3! same as info%A0 from TDC + end if + s%Chi(k) = Chi_face%val*w_00%val + s%Chi_ad(k) = Chi_face*w_00 + + if (dbg .and. k == -100) then + write (*, *) ' s% ALFAM_ALFA', ALFAM_ALFA + write (*, *) 'Hp_face', Hp_face%val + write (*, *) 'd_v_div_r', d_v_div_r%val + write (*, *) ' f', f + write (*, *) 'w_00', w_00%val + write (*, *) 'd_00 ', d_00%val + write (*, *) 'rho2 ', rho2%val + write (*, *) 'r_00', r_00%val + write (*, *) 'r_p1 ', r_p1%val + write (*, *) 'r6_cell', r6_face%val + end if + end function compute_Chi_div_w_face function compute_tdc_Eq_div_w_face(s, k, ierr) result(Eq_face) ! erg g^-1 s^-1 * (cm^-1 s^1) type(star_info), pointer :: s integer, intent(in) :: k type(auto_diff_real_star_order1) :: Eq_face integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: w_00 + type(auto_diff_real_star_order1) :: d_v_div_r, Chi_face, w_00 + real(dp) :: dmbar + include 'formats' ierr = 0 - Eq_face = get_tdc_Eq_div_w_face_ad(s, k, ierr) - if (ierr /= 0) return - - ! only for output, really only used for returning Eq to star pointers. - w_00 = get_tdc_face_velocity_ad(s, k) - - s%Eq(k) = Eq_face%val * w_00%val - s%Eq_ad(k) = Eq_face * w_00 - end function compute_tdc_Eq_div_w_face - - - subroutine build_tdc_Eq_div_w_face_ad(s, k, Eq_div_w_face, ierr) - type(star_info), pointer :: s - integer, intent(in) :: k - type(auto_diff_real_star_order1), intent(out) :: Eq_div_w_face - integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: d_v_div_r, Chi_div_w_face - real(dp) :: dmbar - - ierr = 0 - if (s%mixing_length_alpha == 0d0 .or. & - k > s%nz - s%TDC_num_innermost_cells_forced_nonturbulent) then - Eq_div_w_face = 0d0 - return - end if - - Chi_div_w_face = get_tdc_Chi_div_w_face_ad(s, k, ierr) + if (s%mixing_length_alpha == 0d0 .or. & + k > s%nz - s% TDC_num_innermost_cells_forced_nonturbulent) then + Eq_face = 0d0 + if (k >= 1 .and. k <= s%nz) s%Eq_ad(k) = 0d0 + else + Chi_face = compute_Chi_div_w_face(s,k,ierr) if (ierr /= 0) return if (s%TDC_use_density_form_for_eddy_viscosity) then + ! new density derivative term d_v_div_r = compute_rho_form_of_d_v_div_r_face_opt_time_center(s, k, ierr) else d_v_div_r = compute_d_v_div_r_opt_time_center_face(s, k, ierr) end if - if (ierr /= 0) return if (k >= 2) then - dmbar = 0.5d0*(s%dm(k) + s%dm(k-1)) + dmbar = 0.5d0*(s% dm(k) + s% dm(k-1)) else - dmbar = 0.5d0*s%dm(k) + dmbar = 0.5d0*s% dm(k) end if - Eq_div_w_face = 4d0*pi*Chi_div_w_face*d_v_div_r/dmbar - end subroutine build_tdc_Eq_div_w_face_ad + if (ierr /= 0) return + Eq_face = 4d0*pi*Chi_face*d_v_div_r/dmbar ! erg s^-1 g^-1 * (cm^-1 s^1) + end if + + ! only for output, really only used for returning Eq to star pointers. + if (s% okay_to_set_mlt_vc .and. & + s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then !add option for explicit mlt_vc, operator split in momentum eq. + w_00 = s% mlt_vc_old(k)/sqrt_2_div_3! same as info%A0 from TDC + else + w_00 = s% mlt_vc_ad(k)/sqrt_2_div_3! same as info%A0 from TDC + end if + + s%Eq(k) = Eq_face%val * w_00%val + s%Eq_ad(k) = Eq_face * w_00 + end function compute_tdc_Eq_div_w_face ! for v_flag only. face centered Uq for hydro_momentum function compute_tdc_Uq_face(s, k, ierr) result(Uq_face) !(v_flag only) ! cm s^-2, acceleration @@ -528,12 +445,24 @@ function compute_tdc_Uq_dm_cell(s, k, ierr) result(Uq_cell) ! cm s^-2, accelera r_p1 = wrap_opt_time_center_r_p1(s, k) r_cell = 0.5d0*(r_00+r_p1) ! not staggered unlike terms inside chi_div_w_face - w_00 = get_tdc_face_velocity_ad(s, k) - Chi_00 = get_tdc_Chi_div_w_face_ad(s, k, ierr) * w_00 + if (s% okay_to_set_mlt_vc .and. & + s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then + w_00 = s% mlt_vc_old(k)/sqrt_2_div_3 + else + w_00 = s% mlt_vc_ad(k)/sqrt_2_div_3 + end if + + Chi_00 = compute_Chi_div_w_face(s, k, ierr) * w_00 if (k < s% nz) then - w_p1 = shift_p1(get_tdc_face_velocity_ad(s, k+1)) - Chi_p1 = shift_p1(get_tdc_Chi_div_w_face_ad(s, k+1, ierr))*w_p1 + if (s% okay_to_set_mlt_vc .and. & + s% TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation) then + w_p1 = s% mlt_vc_old(k+1)/sqrt_2_div_3 + else + w_p1 = shift_p1(s% mlt_vc_ad(k+1))/sqrt_2_div_3 + end if + + Chi_p1 = shift_p1(compute_Chi_div_w_face(s, k+1, ierr))*w_p1 if (ierr /= 0) return else Chi_p1 = 0d0 @@ -559,7 +488,7 @@ function compute_d_v_div_r(s, k, ierr) result(d_v_div_r) ! s^-1 integer, intent(in) :: k type(auto_diff_real_star_order1) :: d_v_div_r integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: v_00, v_p1, r_00, r_p1 + type(auto_diff_real_star_order1) :: v_00, v_p1, r_00, r_p1, term1, term2 logical :: dbg include 'formats' ierr = 0 @@ -580,8 +509,6 @@ function compute_d_v_div_r(s, k, ierr) result(d_v_div_r) ! s^-1 end if end function compute_d_v_div_r - ! Currently unused. Kept as the cell-centered opt-time-centered counterpart - ! to the face version below in case that path is revived later. function compute_d_v_div_r_opt_time_center(s, k, ierr) result(d_v_div_r) ! s^-1 type(star_info), pointer :: s integer, intent(in) :: k @@ -690,7 +617,7 @@ function compute_d_v_div_r_face(s, k, ierr) result(d_v_div_r) ! s^-1 integer, intent(in) :: k type(auto_diff_real_star_order1) :: d_v_div_r integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1 + type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1, term1, term2 logical :: dbg include 'formats' ierr = 0 @@ -730,7 +657,7 @@ function compute_d_v_div_r_opt_time_center_face(s, k, ierr) result(d_v_div_r) ! integer, intent(in) :: k type(auto_diff_real_star_order1) :: d_v_div_r integer, intent(out) :: ierr - type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1 + type(auto_diff_real_star_order1) :: v_00, v_m1, r_00, r_m1, term1, term2 logical :: dbg include 'formats' ierr = 0 diff --git a/star_data/public/star_data_step_work.inc b/star_data/public/star_data_step_work.inc index d9036d817..07904cb3a 100644 --- a/star_data/public/star_data_step_work.inc +++ b/star_data/public/star_data_step_work.inc @@ -392,8 +392,6 @@ type(auto_diff_real_star_order1), pointer, dimension(:) :: & PII_ad, Chi_ad, Eq_ad, COUPL_ad, Lr_ad, Lc_ad, Lt_ad - type(auto_diff_real_star_order1), pointer, dimension(:) :: & - tdc_Chi_div_w_face_ad, tdc_Eq_div_w_face_ad, tdc_Chi_div_w_cell_ad real(dp), pointer, dimension(:) :: & Ptrb, Pvsc, Pvsc_start, Hp_face, Y_face, Y_face_start, PII, Chi, Eq, Uq, & SOURCE, DAMP, DAMPR, COUPL, Lr, Lc, Lt, Lt_start From 9b123d4b38414410d6d8b78e5c0f5fc8231f3214 Mon Sep 17 00:00:00 2001 From: Debraheem Date: Mon, 4 May 2026 19:33:20 -0400 Subject: [PATCH 12/12] fortitude lint --- .../dev_TDC_Cepheid_9M/src/run_star_extras.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 index 4a5ed56cc..1d91f08e5 100644 --- a/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 +++ b/star/dev_cases_TDC_Pulsation/dev_TDC_Cepheid_9M/src/run_star_extras.f90 @@ -211,7 +211,7 @@ integer function extras_start_step(id) ierr = 0 call star_ptr(id, s, ierr) if (ierr /= 0) return - + ! we want to ignore T gradient equation for a few steps after remesh if (s%model_number < initial_model_number + 10 .and. in_inlist_pulses) then s%convergence_ignore_equL_residuals = .true.