diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 99196718bb..1e357bac35 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -70,6 +70,12 @@ conservative energy transfer continues to modify only the EOS pressure; the turbulent contribution is evaluated from its remapped face state. Split/merge AMR does not currently support RSP2. +Cell-centered Riemann hydrodynamics can now reduce chemical diffusion across +resolved shocks using the default-off ``Riemann_shock_D_mix_reduction_on`` and +``Riemann_shock_D_mix_reduction_full_on`` controls. Corresponding compression, +pressure-jump, shock-strength, and diffusion-factor profile columns are +available for diagnostics. + .. _Bug Fixes main: Bug Fixes diff --git a/star/defaults/controls_dev.defaults b/star/defaults/controls_dev.defaults index 9510b8fd9e..59c0dc06e8 100644 --- a/star/defaults/controls_dev.defaults +++ b/star/defaults/controls_dev.defaults @@ -225,6 +225,35 @@ use_TDC_enthalpy_flux_limiter = .false. + ! Riemann_shock_D_mix_reduction_on + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! When the Riemann shock mixing reduction is enabled, leave chemical + ! diffusion unchanged at shock strengths less than or equal to this + ! value. The strength is the minimum of the signed compression Mach + ! number and the HLLC pressure jump. + + ! :: + + Riemann_shock_D_mix_reduction_on = 0d0 + + + ! Riemann_shock_D_mix_reduction_full_on + ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ! For positive values with ``u_flag``, smoothly reduce the final chemical + ! diffusion coefficient at compressive Riemann shock faces. The reduction + ! changes from zero at ``Riemann_shock_D_mix_reduction_on`` to complete at + ! this value using a quintic smootherstep. Nonpositive values disable the + ! reduction. When positive, this value must be greater than the onset. + ! This does not change the MLT/TDC velocity, convective luminosity, or + ! eddy viscosity. + + ! :: + + Riemann_shock_D_mix_reduction_full_on = -1d0 + + ! use_face_reconstruction ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/star/defaults/profile_columns.list b/star/defaults/profile_columns.list index 937da6c8c2..e86c96734b 100644 --- a/star/defaults/profile_columns.list +++ b/star/defaults/profile_columns.list @@ -737,6 +737,10 @@ !PII_face !Ptrb !Pvsc + !Riemann_shock_compression ! max(0, (u_inner-u_outer)/cs_face) + !Riemann_shock_pressure_jump ! max(0, P_face/min(P_inner,P_outer) - 1) + !Riemann_shock_strength ! minimum of compression and pressure jump + !Riemann_shock_D_mix_factor ! factor applied to final chemical D_mix !Uq !Y_face diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/Makefile b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/Makefile new file mode 100644 index 0000000000..b03ed21bf2 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/Makefile @@ -0,0 +1 @@ +include $(MESA_DIR)/star/work/Makefile diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/ck b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/ck new file mode 100755 index 0000000000..fceedb2e3d --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/ck @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +check_one diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/clean b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/clean new file mode 100755 index 0000000000..ea8f078f39 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/clean @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +make clean diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/history_columns.list b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/history_columns.list new file mode 100644 index 0000000000..b38219d40f --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/history_columns.list @@ -0,0 +1,1068 @@ +! 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 + !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, including photodisintegrations + power_nuc_burn ! total thermal power from all burning, including 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) ! does not include photodisintegration + Lnuc ! (LH + LHe + LZ) ! does not include photodisintegration + !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 their 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. + + ! individual 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/astero_Teff_sun)^0.5) + !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) diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_noh_riemann b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_noh_riemann new file mode 100644 index 0000000000..3a4f4ebf25 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_noh_riemann @@ -0,0 +1,114 @@ +&star_job + + show_log_description_at_start = .false. + + load_saved_model = .true. + load_model_filename = 'mods/noh_start.mod' + + save_model_when_terminate = .true. + save_model_filename = 'mods/done_with_noh.mod' + required_termination_code_string = 'max_age' + + write_profile_when_terminate = .true. + filename_for_profile_when_terminate = 'final_profile.data' + profile_starting_model = .true. + + change_initial_u_flag = .true. + change_initial_v_flag = .true. + new_u_flag = .true. + new_v_flag = .false. + + change_initial_RTI_flag = .true. + new_RTI_flag = .false. + + set_initial_cumulative_energy_error = .true. + new_cumulative_energy_error = 0d0 + + set_initial_dt = .true. + seconds_for_initial_dt = 1d-6 + + pgstar_flag = .true. + +/ ! end of star_job namelist + +&eos +/ ! end of eos namelist + +&kap + Zbase = 0d0 +/ ! end of kap namelist + +&controls + + initial_mass = 3.8d-33 + initial_z = 0d0 + + max_model_number = 7000 + max_age_in_seconds = 0.3d0 + min_timestep_limit = 1d-14 + gamma_center_limit = 1d199 + log_center_temp_upper_limit = 1d99 + + constant_L = .true. + include_L_in_correction_limits = .false. + hydro_mtx_min_allowed_logT = -99d0 + use_zero_Pgas_outer_BC = .true. + + MLT_option = 'none' + calculate_Brunt_B = .false. + calculate_Brunt_N2 = .false. + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + use_split_merge_amr = .true. + split_merge_amr_log_zoning = .false. + ! The published MESA IV calculation used 10,000 cells. + split_merge_amr_nz_baseline = 1000 + split_merge_amr_MaxLong = 1.005d0 + split_merge_amr_MaxShort = 10d0 + split_merge_amr_max_iters = 1000 + equal_split_density_amr = .true. + min_dq = 1d-12 + max_allowed_nz = 20000 + + ! MESA IV used a fixed 5d-6 s timestep; retain the faster AMR test value. + max_timestep = 5d-5 + varcontrol_target = 1d-2 + delta_lgT_cntr_limit = 1d99 + delta_lgRho_cntr_limit = 1d99 + + max_num_profile_models = 1000 + terminal_show_age_units = 'seconds' + photo_interval = 100 + profile_interval = 100 + history_interval = 10 + terminal_interval = 50 + write_header_frequency = 10 + + num_trace_history_values = 2 + trace_history_value_name(1) = 'rel_E_err' + trace_history_value_name(2) = 'log_rel_run_E_err' + +/ ! end of controls namelist + +&pgstar + + Profile_Panels1_win_flag = .true. + Profile_Panels1_win_width = 9 + Profile_Panels1_file_flag = .true. + Profile_Panels1_file_dir = 'png' + Profile_Panels1_file_prefix = 'profile_panels1_' + Profile_Panels1_file_interval = 10 + Profile_Panels1_file_width = 27 + Profile_Panels1_title = 'Noh implosion' + Profile_Panels1_xaxis_name = 'radius_cm' + Profile_Panels1_xmin = 0d0 + Profile_Panels1_xmax = 0.2d0 + Profile_Panels1_num_panels = 3 + Profile_Panels1_yaxis_name(1) = 'density' + Profile_Panels1_yaxis_name(2) = 'velocity' + Profile_Panels1_yaxis_name(3) = 'pressure' + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_noh_riemann_header b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_noh_riemann_header new file mode 100644 index 0000000000..cb06c574d8 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_noh_riemann_header @@ -0,0 +1,27 @@ +&star_job + read_extra_star_job_inlist(1) = .true. + extra_star_job_inlist_name(1) = 'inlist_noh_riemann' +/ ! end of star_job namelist + +&eos + read_extra_eos_inlist(1) = .true. + extra_eos_inlist_name(1) = 'inlist_noh_riemann' +/ ! end of eos namelist + +&kap + read_extra_kap_inlist(1) = .true. + extra_kap_inlist_name(1) = 'inlist_noh_riemann' +/ ! end of kap namelist + +&controls + read_extra_controls_inlist(1) = .true. + extra_controls_inlist_name(1) = 'inlist_noh_riemann' +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_noh_riemann' +/ ! end of pgstar namelist + +&colors +/ ! end of colors namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_start b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_start new file mode 100644 index 0000000000..470d055549 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_start @@ -0,0 +1,32 @@ +&star_job + show_log_description_at_start = .false. +/ ! end of star_job namelist + +&eos +/ ! end of eos namelist + +&kap +/ ! end of kap namelist + +&controls + + constant_L = .true. + include_L_in_correction_limits = .false. + hydro_mtx_min_allowed_logT = -99d0 + MLT_option = 'none' + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + x_logical_ctrl(1) = .true. ! build the starting model + x_ctrl(1) = -1d0 ! initial velocity + x_ctrl(3) = 1d-3 ! inner radius + x_ctrl(4) = 1d0 ! outer radius + x_ctrl(5) = 1d0 ! density + x_ctrl(6) = 1d-6 ! pressure + +/ ! end of controls namelist + +&pgstar +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_start_header b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_start_header new file mode 100644 index 0000000000..9b42b36564 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/inlist_start_header @@ -0,0 +1,27 @@ +&star_job + read_extra_star_job_inlist(1) = .true. + extra_star_job_inlist_name(1) = 'inlist_start' +/ ! end of star_job namelist + +&eos + read_extra_eos_inlist(1) = .true. + extra_eos_inlist_name(1) = 'inlist_start' +/ ! end of eos namelist + +&kap + read_extra_kap_inlist(1) = .true. + extra_kap_inlist_name(1) = 'inlist_start' +/ ! end of kap namelist + +&controls + read_extra_controls_inlist(1) = .true. + extra_controls_inlist_name(1) = 'inlist_start' +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_start' +/ ! end of pgstar namelist + +&colors +/ ! end of colors namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/mk b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/mk new file mode 100755 index 0000000000..8212b4d41d --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/mk @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +make diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/mods/noh_start.mod b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/mods/noh_start.mod new file mode 100644 index 0000000000..6eb09a6d6b --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/mods/noh_start.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:427b9ac265f58de3210d40f4ce2fab8c1a41bc3d020032a072e1f1856f1b3f12 +size 413713 diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/.gitignore b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/.gitignore new file mode 100644 index 0000000000..584924c49f --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +plots/ diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/README.md b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/README.md new file mode 100644 index 0000000000..1a7d7639dc --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/README.md @@ -0,0 +1,31 @@ +# Noh energy-balance plotter + +Run from the Noh work directory after `noh_energy_balance.txt` has been +created: + +```sh +conda run -n base python plotter/plot_energy_balance.py +``` + +The parser streams the diagnostic file, ignores a final model that is still +being written, and keeps complete zone data only for the requested profile +models. Output is written to `plotter/plots`: + +- `energy_balance_history.png` compares the integrated energy terms and their + closure. +- `wall_heating_history.png` compares the innermost postshock state with the + analytic Noh solution and locates the density deficit and shock-local + internal-energy update relative to the analytic shock radius. +- `wall_heating_profiles.png` follows density, pressure, specific energy, and + the entropy proxy `P/rho^gamma` through the wall region and shock. +- `energy_balance_model_*.png` shows the cell terms near the origin for the + selected models. +- `energy_balance_summary.csv` records the integrated and maximum local + diagnostics for every accepted model. + +Select different snapshots or a fixed radial range with, for example, + +```sh +conda run -n base python plotter/plot_energy_balance.py \ + --models 100 400 800 --radius-max 0.05 +``` diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/plot_energy_balance.py b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/plot_energy_balance.py new file mode 100644 index 0000000000..7c8f75b3dc --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/plotter/plot_energy_balance.py @@ -0,0 +1,520 @@ +#!/usr/bin/env python3 +"""Plot the cell energy-balance diagnostic from the Noh test.""" + +from __future__ import annotations + +import argparse +import csv +from pathlib import Path + +import matplotlib + +matplotlib.use("Agg") +import matplotlib.pyplot as plt +import numpy as np + + +DEFAULT_MODELS = (1, 10, 50, 100, 250, 500, 750, 1000) +GAMMA = 1.66667 +NOH_DENSITY = 64.0 +NOH_PRESSURE = 64.0 / 3.0 +NOH_ENERGY = 0.5 +NOH_ENTROPY_PROXY = NOH_PRESSURE / NOH_DENSITY**GAMMA +DATA_COLUMNS = ( + "model", + "k", + "age_s", + "dt_s", + "r_cm", + "dm_g", + "rho", + "u", + "P", + "energy", + "dU_erg", + "dK_erg", + "dW_erg", + "balance_erg", + "equation_error_erg", + "balance_minus_error_erg", + "relative_balance", +) + + +def parse_args() -> argparse.Namespace: + case_dir = Path(__file__).resolve().parents[1] + parser = argparse.ArgumentParser( + description="Plot noh_energy_balance.txt without loading the full file into memory." + ) + parser.add_argument( + "input", + nargs="?", + type=Path, + default=case_dir / "noh_energy_balance.txt", + help="energy-balance file (default: ../noh_energy_balance.txt)", + ) + parser.add_argument( + "--output-dir", + type=Path, + default=case_dir / "plotter" / "plots", + help="directory for PNG and CSV output", + ) + parser.add_argument( + "--models", + nargs="+", + type=int, + default=list(DEFAULT_MODELS), + help="models for detailed radial plots", + ) + parser.add_argument( + "--radius-max", + type=float, + default=None, + help="maximum radius for detailed profiles; defaults to 2.5 shock radii", + ) + return parser.parse_args() + + +def parse_model_header(line: str) -> dict[str, float | int] | None: + fields = line.split() + if len(fields) != 15 or fields[:2] != ["#", "model"]: + return None + return { + "model": int(fields[2]), + "nz": int(fields[4]), + "age_s": float(fields[6]), + "total_dU_erg": float(fields[8]), + "total_dK_erg": float(fields[10]), + "total_dW_erg": float(fields[12]), + "total_balance_erg": float(fields[14]), + } + + +def new_aggregate(header: dict[str, float | int]) -> dict[str, float | int]: + return { + **header, + "rows_read": 0, + "sum_equation_error_erg": 0.0, + "sum_balance_minus_error_erg": 0.0, + "max_abs_balance_erg": 0.0, + "max_balance_k": -1, + "max_balance_r_cm": np.nan, + "max_abs_balance_minus_error_erg": 0.0, + "max_balance_minus_error_k": -1, + "max_balance_minus_error_r_cm": np.nan, + "max_relative_balance": 0.0, + "max_relative_balance_minus_error": 0.0, + "max_abs_dU_near_shock_erg": 0.0, + "max_dU_near_shock_r_cm": np.nan, + "center_rho": np.nan, + "center_P": np.nan, + "center_energy": np.nan, + "center_u": np.nan, + "center_r_cm": np.inf, + "min_postshock_rho": np.inf, + "min_postshock_r_cm": np.nan, + } + + +def update_aggregate(record: dict[str, float | int], values: list[float]) -> None: + k = int(values[1]) + radius = values[4] + rho = values[6] + balance = values[13] + equation_error = values[14] + balance_minus_error = values[15] + dU = values[10] + local_energy_scale = abs(dU) + abs(values[11]) + abs(values[12]) + + record["rows_read"] += 1 + record["sum_equation_error_erg"] += equation_error + record["sum_balance_minus_error_erg"] += balance_minus_error + + if abs(balance) > record["max_abs_balance_erg"]: + record["max_abs_balance_erg"] = abs(balance) + record["max_balance_k"] = k + record["max_balance_r_cm"] = radius + if abs(balance_minus_error) > record["max_abs_balance_minus_error_erg"]: + record["max_abs_balance_minus_error_erg"] = abs(balance_minus_error) + record["max_balance_minus_error_k"] = k + record["max_balance_minus_error_r_cm"] = radius + if local_energy_scale > 0.0: + record["max_relative_balance"] = max( + record["max_relative_balance"], abs(balance) / local_energy_scale + ) + record["max_relative_balance_minus_error"] = max( + record["max_relative_balance_minus_error"], + abs(balance_minus_error) / local_energy_scale, + ) + if radius < record["center_r_cm"]: + record["center_r_cm"] = radius + record["center_rho"] = rho + record["center_P"] = values[8] + record["center_energy"] = values[9] + record["center_u"] = values[7] + + shock_radius = float(record["age_s"]) / 3.0 + if radius <= 1.5 * shock_radius: + if abs(dU) > record["max_abs_dU_near_shock_erg"]: + record["max_abs_dU_near_shock_erg"] = abs(dU) + record["max_dU_near_shock_r_cm"] = radius + if shock_radius > 0.0 and radius <= 0.8 * shock_radius: + if rho < record["min_postshock_rho"]: + record["min_postshock_rho"] = rho + record["min_postshock_r_cm"] = radius + + +def read_balance_file( + path: Path, selected_models: set[int] +) -> tuple[list[dict[str, float | int]], dict[int, np.ndarray]]: + summaries: dict[int, dict[str, float | int]] = {} + profiles: dict[int, list[list[float]]] = {model: [] for model in selected_models} + current_model: int | None = None + + with path.open("r", encoding="ascii", errors="strict") as handle: + for line_number, line in enumerate(handle, start=1): + if line.startswith("# model "): + header = parse_model_header(line) + if header is not None: + current_model = int(header["model"]) + summaries[current_model] = new_aggregate(header) + if current_model in profiles: + profiles[current_model] = [] + continue + if not line or line.startswith("#"): + continue + + fields = line.split() + if len(fields) != len(DATA_COLUMNS): + # A concurrently running model can leave one incomplete final line. + continue + try: + values = [float(field) for field in fields] + except ValueError as error: + raise ValueError(f"invalid data on line {line_number}") from error + + model = int(values[0]) + if current_model != model or model not in summaries: + raise ValueError( + f"data for model {model} has no matching header on line {line_number}" + ) + update_aggregate(summaries[model], values) + if model in profiles: + profiles[model].append(values) + + if not summaries: + raise ValueError(f"no model data found in {path}") + + summary_rows = [ + summaries[model] + for model in sorted(summaries) + if summaries[model]["rows_read"] == summaries[model]["nz"] + ] + if not summary_rows: + raise ValueError(f"no complete model data found in {path}") + complete_models = {int(row["model"]) for row in summary_rows} + profile_arrays = { + model: np.asarray(rows, dtype=float) + for model, rows in profiles.items() + if rows and model in complete_models + } + for row in summary_rows: + if not np.isfinite(row["min_postshock_rho"]): + row["min_postshock_rho"] = np.nan + return summary_rows, profile_arrays + + +def write_summary_csv(path: Path, rows: list[dict[str, float | int]]) -> None: + with path.open("w", newline="", encoding="ascii") as handle: + writer = csv.DictWriter(handle, fieldnames=list(rows[0])) + writer.writeheader() + writer.writerows(rows) + + +def symlog_threshold(*arrays: np.ndarray) -> float: + values = np.concatenate([np.abs(array[np.isfinite(array)]) for array in arrays]) + values = values[values > 0.0] + if values.size == 0: + return 1.0 + return max(float(np.nanmax(values)) * 1.0e-10, np.finfo(float).tiny) + + +def save_balance_history(output: Path, rows: list[dict[str, float | int]]) -> None: + age = np.asarray([row["age_s"] for row in rows], dtype=float) + dU = np.asarray([row["total_dU_erg"] for row in rows], dtype=float) + dK = np.asarray([row["total_dK_erg"] for row in rows], dtype=float) + dW = np.asarray([row["total_dW_erg"] for row in rows], dtype=float) + balance = np.asarray([row["total_balance_erg"] for row in rows], dtype=float) + equation_error = np.asarray( + [row["sum_equation_error_erg"] for row in rows], dtype=float + ) + closure_difference = np.asarray( + [row["sum_balance_minus_error_erg"] for row in rows], dtype=float + ) + global_energy_scale = np.abs(dU) + np.abs(dK) + np.abs(dW) + relative_balance = np.zeros_like(balance) + relative_equation_error = np.zeros_like(equation_error) + relative_closure_difference = np.zeros_like(closure_difference) + np.divide( + np.abs(balance), + global_energy_scale, + out=relative_balance, + where=global_energy_scale > 0.0, + ) + np.divide( + np.abs(equation_error), + global_energy_scale, + out=relative_equation_error, + where=global_energy_scale > 0.0, + ) + np.divide( + np.abs(closure_difference), + global_energy_scale, + out=relative_closure_difference, + where=global_energy_scale > 0.0, + ) + max_relative_balance = np.asarray( + [row["max_relative_balance"] for row in rows], dtype=float + ) + max_relative_difference = np.asarray( + [row["max_relative_balance_minus_error"] for row in rows], dtype=float + ) + + figure, axes = plt.subplots(3, 1, figsize=(10, 11), sharex=True) + floor = np.finfo(float).tiny + axes[0].semilogy(age, np.maximum(np.abs(dU), floor), label=r"$|\sum\Delta U|$") + axes[0].semilogy(age, np.maximum(np.abs(dK), floor), label=r"$|\sum\Delta K|$") + axes[0].semilogy(age, np.maximum(np.abs(dW), floor), label=r"$|\sum\Delta W|$") + axes[0].set_ylabel("Term magnitude (erg per step)") + axes[0].legend(ncol=3) + + axes[1].semilogy( + age, np.maximum(relative_balance, floor), label=r"$|\sum B_k|/E_{\rm step}$" + ) + axes[1].semilogy( + age, + np.maximum(relative_equation_error, floor), + label=r"$|\sum$ equation error$|/E_{\rm step}$", + ) + axes[1].semilogy( + age, + np.maximum(relative_closure_difference, floor), + label="closure difference", + ) + axes[1].set_ylabel("Relative global closure") + axes[1].legend(ncol=3) + + axes[2].semilogy( + age, + np.maximum(max_relative_balance, floor), + label=r"max $|B_k|/E_{{\rm step},k}$", + ) + axes[2].semilogy( + age, + np.maximum(max_relative_difference, floor), + label=r"max $|B_k-\mathrm{error}_k|/E_{{\rm step},k}$", + ) + axes[2].set_ylabel("Relative local closure") + axes[2].set_xlabel("Time (s)") + axes[2].legend() + + figure.suptitle("Noh discrete energy balance") + figure.tight_layout() + figure.savefig(output, dpi=180) + plt.close(figure) + + +def save_wall_heating_history(output: Path, rows: list[dict[str, float | int]]) -> None: + age = np.asarray([row["age_s"] for row in rows], dtype=float) + center_rho = np.asarray([row["center_rho"] for row in rows], dtype=float) + min_rho = np.asarray([row["min_postshock_rho"] for row in rows], dtype=float) + center_pressure = np.asarray([row["center_P"] for row in rows], dtype=float) + center_energy = np.asarray([row["center_energy"] for row in rows], dtype=float) + min_rho_radius = np.asarray( + [row["min_postshock_r_cm"] for row in rows], dtype=float + ) + max_dU_radius = np.asarray( + [row["max_dU_near_shock_r_cm"] for row in rows], dtype=float + ) + shock_radius = age / 3.0 + + figure, axes = plt.subplots(3, 1, figsize=(10, 11), sharex=True) + axes[0].plot(age, center_rho / NOH_DENSITY, label="innermost cell") + axes[0].plot(age, min_rho / NOH_DENSITY, label=r"minimum for $r<0.8r_s$") + axes[0].axhline(1.0, color="black", linestyle="--", label="analytic") + axes[0].set_yscale("log") + axes[0].set_ylabel(r"$\rho/\rho_{\rm Noh}$") + axes[0].legend() + + axes[1].plot(age, center_pressure / NOH_PRESSURE, label="central pressure") + axes[1].plot(age, center_energy / NOH_ENERGY, label="central specific energy") + axes[1].axhline(1.0, color="black", linestyle="--", label="analytic") + axes[1].set_yscale("log") + axes[1].set_ylabel("Central value / analytic value") + axes[1].legend(ncol=2) + + normalized_min_rho_radius = np.full_like(age, np.nan) + normalized_max_dU_radius = np.full_like(age, np.nan) + np.divide( + min_rho_radius, + shock_radius, + out=normalized_min_rho_radius, + where=shock_radius > 0.0, + ) + np.divide( + max_dU_radius, + shock_radius, + out=normalized_max_dU_radius, + where=shock_radius > 0.0, + ) + axes[2].plot(age, normalized_min_rho_radius, label=r"radius of minimum $\rho$") + axes[2].plot( + age, + normalized_max_dU_radius, + label=r"radius of max $|\Delta U|$ near shock", + ) + axes[2].axhline(1.0, color="black", linestyle="--", label="shock") + axes[2].set_ylabel(r"$r/r_s$") + axes[2].set_xlabel("Time (s)") + axes[2].legend() + + figure.suptitle("Noh wall-heating diagnostics") + figure.tight_layout() + figure.savefig(output, dpi=180) + plt.close(figure) + + +def save_wall_heating_profiles(output: Path, profiles: dict[int, np.ndarray]) -> None: + usable = { + model: data + for model, data in profiles.items() + if np.any(data[:, 4] <= 0.8 * data[0, 2] / 3.0) + } + if not usable: + return + + figure, axes = plt.subplots(4, 1, figsize=(10, 13), sharex=True) + colors = plt.get_cmap("viridis")(np.linspace(0.0, 1.0, len(usable))) + for color, model in zip(colors, sorted(usable)): + data = usable[model] + shock_radius = data[0, 2] / 3.0 + view = data[data[:, 4] <= 1.2 * shock_radius] + view = view[np.argsort(view[:, 4])] + radius = view[:, 4] / shock_radius + entropy_proxy = view[:, 8] / view[:, 6] ** GAMMA + label = f"{model}: t={data[0, 2]:.3e} s" + + axes[0].plot(radius, view[:, 6] / NOH_DENSITY, color=color, label=label) + axes[1].plot(radius, view[:, 8] / NOH_PRESSURE, color=color) + axes[2].plot(radius, view[:, 9] / NOH_ENERGY, color=color) + axes[3].plot(radius, entropy_proxy / NOH_ENTROPY_PROXY, color=color) + + labels = ( + r"$\rho/\rho_{\rm Noh}$", + r"$P/P_{\rm Noh}$", + r"$e/e_{\rm Noh}$", + r"$(P/\rho^\gamma)/(P/\rho^\gamma)_{\rm Noh}$", + ) + for axis, label in zip(axes, labels): + axis.axhline(1.0, color="black", linestyle="--") + axis.axvline(1.0, color="gray", linestyle=":") + axis.set_yscale("log") + axis.set_ylabel(label) + axis.set_xlim(0.0, 1.2) + axes[0].legend(ncol=2) + axes[-1].set_xlabel(r"$r/r_s$") + + figure.suptitle("Noh wall-heating structure") + figure.tight_layout() + figure.savefig(output, dpi=180) + plt.close(figure) + + +def save_profile_plot( + output: Path, model: int, data: np.ndarray, radius_max: float | None +) -> None: + age = data[0, 2] + shock_radius = age / 3.0 + xmax = radius_max + if xmax is None: + xmax = min(0.2, max(0.02, 2.5 * shock_radius)) + mask = data[:, 4] <= xmax + view = data[mask] + if view.size == 0: + return + + radius = view[:, 4] + dm = view[:, 5] + specific = np.zeros((view.shape[0], 6)) + np.divide(view[:, 10:16], dm[:, None], out=specific, where=dm[:, None] > 0.0) + + figure, axes = plt.subplots(4, 1, figsize=(10, 13), sharex=True) + axes[0].plot(radius, view[:, 6], label="density") + axes[0].axhline(64.0, color="black", linestyle="--", label="analytic 64") + axes[0].set_ylabel(r"$\rho$ (g cm$^{-3}$)") + axes[0].legend() + + axes[1].plot(radius, specific[:, 0], label=r"$\Delta U/dm$") + axes[1].plot(radius, specific[:, 1], label=r"$\Delta K/dm$") + axes[1].plot(radius, specific[:, 2], label=r"$\Delta W/dm$") + axes[1].set_yscale( + "symlog", + linthresh=symlog_threshold(specific[:, 0], specific[:, 1], specific[:, 2]), + ) + axes[1].set_ylabel("Specific energy per step (erg/g)") + axes[1].legend(ncol=3) + + axes[2].plot(radius, specific[:, 3], label=r"$B_k/dm$") + axes[2].plot(radius, specific[:, 4], label="equation error/dm") + axes[2].plot(radius, specific[:, 5], label="difference/dm") + axes[2].set_yscale( + "symlog", + linthresh=symlog_threshold(specific[:, 3], specific[:, 4], specific[:, 5]), + ) + axes[2].set_ylabel("Specific closure error (erg/g)") + axes[2].legend(ncol=3) + + axes[3].plot(radius, view[:, 16], label="relative balance") + axes[3].plot(radius, view[:, 7], label="velocity") + axes[3].set_yscale("symlog", linthresh=1.0e-10) + axes[3].set_ylabel("Relative balance or velocity") + axes[3].set_xlabel("Radius (cm)") + axes[3].legend() + + for axis in axes: + axis.axvline(shock_radius, color="gray", linestyle=":") + axis.set_xlim(0.0, xmax) + + figure.suptitle(f"Noh energy balance: model {model}, t={age:.6e} s") + figure.tight_layout() + figure.savefig(output, dpi=180) + plt.close(figure) + + +def main() -> None: + args = parse_args() + if not args.input.is_file(): + raise FileNotFoundError(args.input) + args.output_dir.mkdir(parents=True, exist_ok=True) + + rows, profiles = read_balance_file(args.input, set(args.models)) + write_summary_csv(args.output_dir / "energy_balance_summary.csv", rows) + save_balance_history(args.output_dir / "energy_balance_history.png", rows) + save_wall_heating_history(args.output_dir / "wall_heating_history.png", rows) + save_wall_heating_profiles(args.output_dir / "wall_heating_profiles.png", profiles) + for model in sorted(profiles): + save_profile_plot( + args.output_dir / f"energy_balance_model_{model:06d}.png", + model, + profiles[model], + args.radius_max, + ) + + available = ", ".join(str(model) for model in sorted(profiles)) + print(f"Read {len(rows)} accepted models from {args.input}") + print(f"Wrote plots and summary to {args.output_dir}") + print(f"Detailed profiles: {available or 'none of the requested models'}") + + +if __name__ == "__main__": + main() diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/profile_columns.list b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/profile_columns.list new file mode 100644 index 0000000000..bc73504ebe --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/profile_columns.list @@ -0,0 +1,984 @@ +! 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 + !psi_roche ! dimensionless Roche potential at outer boundary of zone (only works if in a binary model and b% use_tidal_deformation is used; else is -99) + 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 + !flux_limit_lambda ! flux limiter defined as in Levermore & Pomraning 1981 + !flux_limit_R ! flux ratio defined as in Levermore & Pomraning 1981 + + !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 their 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 ! cell specific work per unit time, Work = dwork_dm*dm*dt + + !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 ! grada-gradT at cell boundary + !gradT_sub_grada ! gradT-grada at cell boundary + !gradT_div_grada ! gradT/grada at cell boundary + + !gradr_sub_gradT ! gradr-gradT at cell boundary + !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 ! gradL-gradr at cell boundary + !gradP_div_rho ! finite difference (deltaP/deltam)* 4*pi*r^2, at cell boundary + !gradT_excess_effect ! 1 - alpha, where alpha is the gradT_excess_alpha from mlt++ + !gradT_rel_err ! gradT - actual_gradT / gradT, actual_gradT = deltaT/deltaP from finite difference + !gradT_sub_a ! same as gradT_sub_grada ! gradT-grada at cell boundary + !grada_face ! grada at cell boundary + !grada_sub_gradr ! grada-gradr at cell boundary + !diff_grads ! gradr - gradL at cell boundary + !log_diff_grads ! log10(diff_grads) + + !mlt_D ! The chemical diffusion coefficient (cm^2/s) + !mlt_Gamma ! The convective efficiency parameter from the mlt equation, Gamma=(grad-gradE)/(gradE-gradL) + !mlt_Y_face ! The superadiabaticity Y = dlnT/dlnP - grada, or dlnT/dlnP - gradL at cell boundary + !mlt_Zeta ! convective efficiency as Zeta = (gradr-gradT)/(gradr-grada) + !mlt_gradT ! same as gradT, mlt/TDC value for dlnT/dlnP. + !mlt_log_abs_Y ! log10(abs(Y_face)) + !mlt_vc ! convective velocity from mlt/TDC in cm/s + !log_mlt_vc ! log10(mlt_vc) + !dvc_dt_TDC_div_g ! dimensionless ratio of convective velocity to g + + !superad_reduction_factor ! gamma_factor from superad_reduction + !conv_vel_div_mlt_vc ! conv_vel from any convection model (including RSP) / mlt_vc, for comparison + + !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 + !Riemann_shock_compression ! max(0, (u_inner-u_outer)/cs_face) + !Riemann_shock_pressure_jump ! max(0, P_face/min(P_inner,P_outer) - 1) + !Riemann_shock_strength ! minimum of compression and pressure jump + !Riemann_shock_D_mix_factor ! factor applied to final chemical D_mix + !Uq + !Y_face + + !reconstructed_T_face + !reconstructed_rho_face + !reconstructed_P_face + !reconstructed_Cp_face + !reconstructed_ChiRho_face + !reconstructed_ChiT_face + !reconstructed_grada_face + !reconstructed_opacity_face + !reconstructed_scale_height_face + !reconstructed_gradr_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 ! gravity = -grav = -Gm/r^2 + !grav_eff ! effective gravity = -(grav - dvdt) + + !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_test_TDC/dev_TDC_noh_riemann/re b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/re new file mode 100755 index 0000000000..b09284556c --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/re @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +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_test_TDC/dev_TDC_noh_riemann/rn b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/rn new file mode 100755 index 0000000000..10757da4e8 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/rn @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# this provides the definition of do_one (run one part of test) +# do_one [inlist] [output model] [LOGS directory] +export MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +mkdir -p mods + +do_one inlist_start_header mods/noh_start.mod +do_one inlist_noh_riemann_header mods/done_with_noh.mod LOGS_noh + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +echo 'finished' diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/rn1 b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/rn1 new file mode 100755 index 0000000000..0dbec915dc --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/rn1 @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +rm -f restart_photo + +make run diff --git a/star/dev_cases_test_TDC/dev_TDC_noh_riemann/src/run.f90 b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/src/run.f90 new file mode 100644 index 0000000000..62063eb217 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/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_test_TDC/dev_TDC_noh_riemann/src/run_star_extras.f90 b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/src/run_star_extras.f90 new file mode 100644 index 0000000000..83e6a943cc --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_noh_riemann/src/run_star_extras.f90 @@ -0,0 +1,463 @@ +! *********************************************************************** +! +! Copyright (C) 2010-2026 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 + + implicit none + + real(dp), parameter :: gamma_law = 1.66667d0 + integer, parameter :: max_energy_balance_model = 1000 + integer :: energy_balance_io = -1 + + include 'test_suite_extras_def.inc' + + contains + + include 'test_suite_extras.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_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 + + s% eos_rq% use_other_eos_component = .true. + s% eos_rq% other_eos_frac => gamma_eos_frac + s% eos_rq% other_eos_component => gamma_eos_component + s% use_other_cgrav = .true. + s% other_cgrav => zero_cgrav + s% use_other_kap = .true. + s% other_kap_get => constant_kap + + if (.not. s% x_logical_ctrl(1)) return + + call create_noh_test_model(id, s, ierr) + if (ierr /= 0) call mesa_error(__FILE__, __LINE__, 'failed in create_noh_test_model') + end subroutine extras_controls + + + subroutine create_noh_test_model(id, s, ierr) + use chem_def, only: ih1, ihe4 + use chem_lib, only: basic_composition_info + use eos_lib, only: eos_gamma_DP_get_ET + integer, intent(in) :: id + type(star_info), pointer :: s + integer, intent(out) :: ierr + + logical :: log_mesh + integer :: k, nz, h1, he4 + real(dp) :: xh, xhe, z, abar, zbar, z53bar, z2bar, ye, & + mass_correction, sumx, R_min, R_max, dr, rho_0, v_0, & + P, r00, rp1, lnR00, lnR_min, lnR_max, dlnR + + include 'formats' + + ierr = 0 + s% u_flag = .true. + s% RTI_flag = .false. + + log_mesh = s% split_merge_amr_log_zoning + nz = s% split_merge_amr_nz_baseline + s% nz = nz + v_0 = s% x_ctrl(1) + R_min = s% x_ctrl(3) + R_max = s% x_ctrl(4) + rho_0 = s% x_ctrl(5) + P = s% x_ctrl(6) + + lnR_min = log(R_min) + lnR_max = log(R_max) + dr = (R_max - R_min)/(nz - 1) + dlnR = (lnR_max - lnR_min)/(nz - 1) + + call star_set_net(id, 'basic_plus_fe56.net', ierr) + if (ierr /= 0) return + call star_set_var_info(id, ierr) + if (ierr /= 0) return + call star_set_chem_names(id, ierr) + if (ierr /= 0) return + call star_allocate_arrays(id, ierr) + if (ierr /= 0) return + + h1 = s% net_iso(ih1) + he4 = s% net_iso(ihe4) + s% M_center = 0d0 + s% R_center = 0d0 + + do k = nz, 1, -1 + if (k == nz) then + r00 = R_min + rp1 = s% R_center + lnR00 = lnR_min + else + rp1 = r00 + if (log_mesh) then + lnR00 = lnR00 + dlnR + r00 = exp(lnR00) + else + r00 = rp1 + dr + lnR00 = log(r00) + end if + end if + + s% r(k) = r00 + s% lnR(k) = lnR00 + s% u(k) = v_0 + s% alpha_RTI(k) = 0d0 + s% rho(k) = rho_0 + s% lnd(k) = log(rho_0) + s% dm(k) = rho_0*(4d0*pi/3d0)*(pow3(r00) - pow3(rp1)) + if (k == nz) then + s% m(k) = s% dm(k) + else + s% m(k) = s% m(k + 1) + s% dm(k) + end if + s% L(k) = 0d0 + s% Peos(k) = P + s% lnPeos(k) = log(P) + s% xa(1:s% species,k) = 0d0 + if (k == nz) then + s% xa(he4,k) = 1d0 + else + s% xa(h1,k) = 1d0 + end if + + call basic_composition_info( & + s% species, s% chem_id, s% xa(:,k), xh, xhe, z, & + abar, zbar, z2bar, z53bar, ye, mass_correction, sumx) + call eos_gamma_DP_get_ET( & + abar, rho_0, P, gamma_law, s% energy(k), s% T(k), ierr) + if (ierr /= 0) return + s% abar(k) = abar + s% zbar(k) = zbar + s% z53bar(k) = z53bar + s% lnE(k) = log(s% energy(k)) + s% lnT(k) = log(s% T(k)) + end do + + s% L_center = 0d0 + s% star_mass = s% m(1)/Msun + s% mstar = s% m(1) + s% xmstar = s% m(1) + s% q(1) = 1d0 + do k = 1, nz - 1 + s% dq(k) = s% dm(k)/s% xmstar + s% q(k + 1) = s% q(k) - s% dq(k) + end do + s% dq(nz) = s% q(nz) + + s% model_number = 0 + s% star_age = 0d0 + s% initial_z = 0d0 + + call star_write_model(id, 'mods/noh_start.mod', ierr) + if (ierr /= 0) return + write(*,2) 'mods/noh_start.mod', nz + stop + end subroutine create_noh_test_model + + + subroutine 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 + call test_suite_startup(s, restart, ierr) + if (ierr /= 0) return + + if (restart) then + open(newunit=energy_balance_io, file='noh_energy_balance.txt', & + status='unknown', position='append', action='write', iostat=ierr) + else + open(newunit=energy_balance_io, file='noh_energy_balance.txt', & + status='replace', action='write', iostat=ierr) + end if + if (ierr /= 0) return + + write(energy_balance_io,'(a)') & + '# Cell energy balance for the accepted hydrodynamic solve.' + write(energy_balance_io,'(a)') & + '# dU = dm*(energy-energy_start); dK = dt*dm*dkedt; dW = dt*dm*dwork_dm.' + write(energy_balance_io,'(a)') & + '# balance = dU+dK+dW; equation_error is the unscaled energy residual in ergs.' + write(energy_balance_io,'(a)') & + '# model k age_s dt_s r_cm dm_g rho u P energy dU_erg dK_erg dW_erg balance_erg ' // & + 'equation_error_erg balance_minus_error_erg relative_balance' + end subroutine extras_startup + + + subroutine extras_after_evolve(id, ierr) + integer, intent(in) :: id + integer, intent(out) :: ierr + type(star_info), pointer :: s + integer :: k, min_k + logical :: okay + real(dp) :: min_dr + + include 'formats' + + ierr = 0 + if (energy_balance_io /= -1) then + close(energy_balance_io) + energy_balance_io = -1 + end if + call star_ptr(id, s, ierr) + if (ierr /= 0) return + + okay = .true. + min_k = minloc(abs(s% r(1:s% nz) - 0.1d0), dim=1) + min_dr = abs(s% r(min_k) - 0.1d0) + write(*,2) 'nearest cell to r = 0.1', min_k, min_dr + + do k = min(s% nz, min_k + 10), s% nz + if (s% r(k) < 0.09d0) then + if (abs(s% u(k)) > 1d-3) then + okay = .false. + write(*,2) 'u behind shock', k, s% u(k), s% r(k) + end if + exit + end if + end do + do k = max(1, min_k - 10), 1, -1 + if (s% r(k) > 0.11d0) then + if (abs(s% u(k) + 1d0) > 1d-3) then + okay = .false. + write(*,2) 'u ahead of shock', k, s% u(k), s% r(k) + end if + exit + end if + end do + + if (okay) then + write(*,*) 'Noh velocities are within tolerance' + else + write(*,*) 'Noh velocities are outside tolerance' + end if + + call test_suite_after_evolve(s, ierr) + end subroutine extras_after_evolve + + + integer function extras_check_model(id) + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + + ierr = 0 + call star_ptr(id, s, ierr) + extras_check_model = keep_going + if (ierr /= 0) return + end function extras_check_model + + + integer function extras_finish_step(id) + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + + ierr = 0 + call star_ptr(id, s, ierr) + extras_finish_step = keep_going + if (ierr /= 0) return + + call write_energy_balance(s, ierr) + if (ierr /= 0) then + extras_finish_step = terminate + s% termination_code = t_extras_finish_step + end if + end function extras_finish_step + + + subroutine write_energy_balance(s, ierr) + type(star_info), pointer :: s + integer, intent(out) :: ierr + integer :: k + real(dp) :: dU, dK, dW, balance, equation_error, scale, & + total_dU, total_dK, total_dW, total_balance + + ierr = 0 + if (s% model_number > max_energy_balance_model) return + if (energy_balance_io == -1) return + + total_dU = 0d0 + total_dK = 0d0 + total_dW = 0d0 + do k = 1, s% nz + dU = s% dm(k)*(s% energy(k) - s% energy_start(k)) + dK = s% dt*s% dm(k)*s% dkedt(k) + dW = s% dt*s% dm(k)*s% dwork_dm(k) + total_dU = total_dU + dU + total_dK = total_dK + dK + total_dW = total_dW + dW + end do + total_balance = total_dU + total_dK + total_dW + + write(energy_balance_io,'(a,i0,a,i0,5(a,es24.16e3))',iostat=ierr) & + '# model ', s% model_number, ' nz ', s% nz, & + ' age_s ', s% star_age*secyer, ' dU_erg ', total_dU, & + ' dK_erg ', total_dK, ' dW_erg ', total_dW, & + ' balance_erg ', total_balance + if (ierr /= 0) return + + do k = s% nz, 1, -1 + dU = s% dm(k)*(s% energy(k) - s% energy_start(k)) + dK = s% dt*s% dm(k)*s% dkedt(k) + dW = s% dt*s% dm(k)*s% dwork_dm(k) + balance = dU + dK + dW + equation_error = s% ergs_error(k) + scale = max(abs(dU) + abs(dK) + abs(dW), tiny(1d0)) + write(energy_balance_io,'(2(i8,1x),15(es24.16e3,1x))',iostat=ierr) & + s% model_number, k, s% star_age*secyer, s% dt, s% r(k), s% dm(k), & + s% rho(k), s% u(k), s% Peos(k), s% energy(k), dU, dK, dW, balance, & + equation_error, balance - equation_error, balance/scale + if (ierr /= 0) return + end do + flush(unit=energy_balance_io, iostat=ierr) + end subroutine write_energy_balance + + + integer function how_many_extra_history_columns(id) + integer, intent(in) :: id + how_many_extra_history_columns = 0 + 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) + integer, intent(out) :: ierr + ierr = 0 + end subroutine data_for_extra_history_columns + + + integer function how_many_extra_profile_columns(id) + integer, intent(in) :: id + how_many_extra_profile_columns = 0 + end function how_many_extra_profile_columns + + + subroutine data_for_extra_profile_columns(id, n, nz, names, vals, ierr) + integer, intent(in) :: id, n, nz + character(len=maxlen_profile_column_name) :: names(n) + real(dp) :: vals(nz,n) + integer, intent(out) :: ierr + ierr = 0 + end subroutine data_for_extra_profile_columns + + + subroutine gamma_eos_frac( & + handle, species, chem_id, net_iso, xa, Rho, logRho, T, logT, & + frac, dfrac_dlogRho, dfrac_dlogT, ierr) + integer, intent(in) :: handle, species + integer, pointer :: chem_id(:), net_iso(:) + real(dp), intent(in) :: xa(:), Rho, logRho, T, logT + real(dp), intent(out) :: frac, dfrac_dlogRho, dfrac_dlogT + integer, intent(out) :: ierr + + ierr = 0 + frac = 1d0 + dfrac_dlogRho = 0d0 + dfrac_dlogT = 0d0 + end subroutine gamma_eos_frac + + + subroutine gamma_eos_component( & + handle, species, chem_id, net_iso, xa, Rho, logRho, T, logT, & + res, d_dlnd, d_dlnT, d_dxa, ierr) + use chem_lib, only: basic_composition_info + use eos_lib, only: eos_gamma_DT_get + integer, intent(in) :: handle, species + integer, pointer :: chem_id(:), net_iso(:) + real(dp), intent(in) :: xa(:), Rho, logRho, T, logT + real(dp), intent(inout) :: res(:), d_dlnd(:), d_dlnT(:), d_dxa(:,:) + integer, intent(out) :: ierr + real(dp) :: xh, xhe, z, abar, zbar, z2bar, z53bar, ye, & + mass_correction, sumx, Pgas, Prad, energy, entropy + + call basic_composition_info( & + species, chem_id, xa, xh, xhe, z, abar, zbar, z2bar, & + z53bar, ye, mass_correction, sumx) + call eos_gamma_DT_get( & + handle, abar, Rho, logRho, T, logT, gamma_law, res, & + d_dlnd, d_dlnT, Pgas, Prad, energy, entropy, ierr) + d_dxa = 0d0 + end subroutine gamma_eos_component + + + subroutine zero_cgrav(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% cgrav(1:s% nz) = 0d0 + end subroutine zero_cgrav + + + subroutine constant_kap( & + id, k, handle, species, chem_id, net_iso, xa, & + log10_rho, log10_T, lnfree_e, d_lnfree_e_dlnRho, & + d_lnfree_e_dlnT, eta, d_eta_dlnRho, d_eta_dlnT, & + kap_fracs, kap, dln_kap_dlnRho, dln_kap_dlnT, & + dln_kap_dxa, ierr) + use kap_def, only: num_kap_fracs + integer, intent(in) :: id, k, handle, species + integer, pointer :: chem_id(:), net_iso(:) + real(dp), intent(in) :: xa(:), log10_rho, log10_T, lnfree_e, & + d_lnfree_e_dlnRho, d_lnfree_e_dlnT, eta, d_eta_dlnRho, & + d_eta_dlnT + real(dp), intent(out) :: kap_fracs(num_kap_fracs), kap, & + dln_kap_dlnRho, dln_kap_dlnT, dln_kap_dxa(:) + integer, intent(out) :: ierr + + ierr = 0 + kap_fracs = 0d0 + kap = 0.2d0 + dln_kap_dlnRho = 0d0 + dln_kap_dlnT = 0d0 + dln_kap_dxa = 0d0 + end subroutine constant_kap + + + end module run_star_extras diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/Makefile b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/Makefile new file mode 100644 index 0000000000..b03ed21bf2 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/Makefile @@ -0,0 +1 @@ +include $(MESA_DIR)/star/work/Makefile diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/ck b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/ck new file mode 100755 index 0000000000..fceedb2e3d --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/ck @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +check_one diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/clean b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/clean new file mode 100755 index 0000000000..ea8f078f39 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/clean @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +make clean diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/history_columns.list b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/history_columns.list new file mode 100644 index 0000000000..4ec91cfb92 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/history_columns.list @@ -0,0 +1,1068 @@ +! 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 + !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, including photodisintegrations + power_nuc_burn ! total thermal power from all burning, including 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) ! does not include photodisintegration + Lnuc ! (LH + LHe + LZ) ! does not include photodisintegration + !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 their 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. + + ! individual 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/astero_Teff_sun)^0.5) + !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) diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_sedov_omega_1 b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_sedov_omega_1 new file mode 100644 index 0000000000..871c6f4d88 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_sedov_omega_1 @@ -0,0 +1,117 @@ +&star_job + + show_log_description_at_start = .false. + + load_saved_model = .true. + load_model_filename = 'mods/sedov_start.mod' + + save_model_when_terminate = .true. + save_model_filename = 'mods/done_with_sedov.mod' + required_termination_code_string = 'max_age' + + write_profile_when_terminate = .true. + filename_for_profile_when_terminate = 'final_profile.data' + profile_starting_model = .true. + + change_initial_u_flag = .true. + change_initial_v_flag = .true. + new_u_flag = .true. + new_v_flag = .false. + + change_initial_RTI_flag = .true. + new_RTI_flag = .false. + + set_initial_cumulative_energy_error = .true. + new_cumulative_energy_error = 0d0 + + set_initial_dt = .true. + seconds_for_initial_dt = 1d-14 + + pgstar_flag = .true. + +/ ! end of star_job namelist + +&eos +/ ! end of eos namelist + +&kap + Zbase = 0d0 +/ ! end of kap namelist + +&controls + + initial_mass = 3.8d-33 + initial_z = 0d0 + + max_model_number = 100000!8000 + max_age_in_seconds = 1d0 + min_timestep_limit = 1d-14 + gamma_center_limit = 1d199 + log_center_temp_upper_limit = 1d99 + + constant_L = .true. + include_L_in_correction_limits = .false. + hydro_mtx_min_allowed_logT = -99d0 + use_zero_Pgas_outer_BC = .true. + + MLT_option = 'none' + calculate_Brunt_B = .false. + calculate_Brunt_N2 = .false. + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + use_split_merge_amr = .true. + split_merge_amr_log_zoning = .false. + split_merge_amr_nz_baseline = 2000 + split_merge_amr_MaxLong = 1.01d0 + split_merge_amr_MaxShort = 1.5d0 + split_merge_amr_max_iters = 1000 + + merge_amr_max_abs_du_div_cs = 0.1d0 + merge_amr_du_div_cs_limit_only_for_compression = .false. + merge_amr_inhibit_at_jumps = .false. ! leave false for accuracy, can let shocks merge over jumps + + + ! Faster development value: + dt_div_min_dr_div_cs_limit = 0.75d0 + ! Timestep resolution used for the MESA IV calculation. + !dt_div_min_dr_div_cs_limit = 0.15d0 + varcontrol_target = 1d-2 + delta_lgT_cntr_limit = 1d99 + delta_lgRho_cntr_limit = 1d99 + + max_num_profile_models = 4000 + terminal_show_age_units = 'seconds' + photo_interval = 100 + profile_interval = 500 + history_interval = 1 + terminal_interval = 50 + write_header_frequency = 10 + + num_trace_history_values = 2 + trace_history_value_name(1) = 'rel_E_err' + trace_history_value_name(2) = 'log_rel_run_E_err' + +/ ! end of controls namelist + +&pgstar + + Profile_Panels1_win_flag = .true. + Profile_Panels1_win_width = 9 + Profile_Panels1_file_flag = .true. + Profile_Panels1_file_dir = 'png' + Profile_Panels1_file_prefix = 'profile_panels1_' + Profile_Panels1_file_interval = 10 + Profile_Panels1_file_width = 27 + Profile_Panels1_title = 'Sedov blast wave' + Profile_Panels1_xaxis_name = 'radius_cm' + Profile_Panels1_xmin = 0d0 + Profile_Panels1_xmax = 1.2d0 + Profile_Panels1_num_panels = 3 + Profile_Panels1_yaxis_name(1) = 'density' + Profile_Panels1_yaxis_name(2) = 'velocity' + Profile_Panels1_yaxis_name(3) = 'pressure' + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_sedov_omega_1_header b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_sedov_omega_1_header new file mode 100644 index 0000000000..f15fa2a531 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_sedov_omega_1_header @@ -0,0 +1,27 @@ +&star_job + read_extra_star_job_inlist(1) = .true. + extra_star_job_inlist_name(1) = 'inlist_sedov_omega_1' +/ ! end of star_job namelist + +&eos + read_extra_eos_inlist(1) = .true. + extra_eos_inlist_name(1) = 'inlist_sedov_omega_1' +/ ! end of eos namelist + +&kap + read_extra_kap_inlist(1) = .true. + extra_kap_inlist_name(1) = 'inlist_sedov_omega_1' +/ ! end of kap namelist + +&controls + read_extra_controls_inlist(1) = .true. + extra_controls_inlist_name(1) = 'inlist_sedov_omega_1' +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_sedov_omega_1' +/ ! end of pgstar namelist + +&colors +/ ! end of colors namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_start b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_start new file mode 100644 index 0000000000..0799da7d4c --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_start @@ -0,0 +1,36 @@ +&star_job + show_log_description_at_start = .false. +/ ! end of star_job namelist + +&eos +/ ! end of eos namelist + +&kap +/ ! end of kap namelist + +&controls + + constant_L = .true. + include_L_in_correction_limits = .false. + hydro_mtx_min_allowed_logT = -99d0 + MLT_option = 'none' + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + x_logical_ctrl(1) = .true. ! build the starting model + x_ctrl(1) = 1.464276d0 ! injected energy for omega = 1 + x_ctrl(2) = 0.006d0 ! injection radius + x_ctrl(3) = 0.005d0 ! inner radius + x_ctrl(4) = 1.2d0 ! outer radius + x_ctrl(5) = 1d0 ! density normalization + x_ctrl(6) = 1d-6 ! pressure floor + x_ctrl(7) = 1d0 ! density exponent omega + x_ctrl(8) = 1.739133d6 ! central pressure + x_ctrl(9) = 1d-5 ! central density smoothing radius + +/ ! end of controls namelist + +&pgstar +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_start_header b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_start_header new file mode 100644 index 0000000000..9b42b36564 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/inlist_start_header @@ -0,0 +1,27 @@ +&star_job + read_extra_star_job_inlist(1) = .true. + extra_star_job_inlist_name(1) = 'inlist_start' +/ ! end of star_job namelist + +&eos + read_extra_eos_inlist(1) = .true. + extra_eos_inlist_name(1) = 'inlist_start' +/ ! end of eos namelist + +&kap + read_extra_kap_inlist(1) = .true. + extra_kap_inlist_name(1) = 'inlist_start' +/ ! end of kap namelist + +&controls + read_extra_controls_inlist(1) = .true. + extra_controls_inlist_name(1) = 'inlist_start' +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_start' +/ ! end of pgstar namelist + +&colors +/ ! end of colors namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/mk b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/mk new file mode 100755 index 0000000000..8212b4d41d --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/mk @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +make diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/mods/sedov_start.mod b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/mods/sedov_start.mod new file mode 100644 index 0000000000..0fbb3a7d46 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/mods/sedov_start.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f2586db8c946f6188b0be5fc75f88ec04f04a8a6f1dcff3b8ea58be08355f8cc +size 413713 diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/README.md b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/README.md new file mode 100644 index 0000000000..0c6452ab97 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/README.md @@ -0,0 +1,25 @@ +# Sedov comparison plot + +`plot_sedov_comparison.py` compares saved MESA profiles with the public-domain +Kamm-Timmes Sedov solver distributed by Cococubed. The analytic modules are a +Python port of the solver described by Kamm & Timmes (2007), *On Efficient +Generation of Numerically Robust Sedov Solutions*. + +Source: + +From this directory, run: + +```console +conda run -n base python plot_sedov_comparison.py +``` + +The defaults compare `LOGS_high_res` and `LOGS_sedov` near `t = 0.36 s`. + +To plot one named run at a selected time and show its AMR thresholds, use: + +```console +conda run -n base python plot_sedov_comparison.py \ + --logs LOGS_sedov --labels test --time 0.36 \ + --max-long 1.25 --max-short 2.5 \ + --output sedov_comparison_test_t036.pdf +``` diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/energy_functions.py b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/energy_functions.py new file mode 100644 index 0000000000..ad904b02d9 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/energy_functions.py @@ -0,0 +1,26 @@ +from globalvars import comvars as gv +from sedov_functions import sedov_funcs + + +def efun01(v): + ##evaluates teh first energy integrand, kamm equations 67 and 10. + ##the (c_val*v - 1) term might be singular at v=vmin in the standard case + ##the (1- c_val/gamma *v) term might be singular at v=vmin in the vacuum case + ##due care should be taken for these removable singularities by the integrator + + l_fun, dlamdv, f_fun, g_fun, h_fun = sedov_funcs(v) + efun1 = dlamdv * l_fun ** (gv.xgeom + 1.0e0) * gv.gpogm * g_fun * v**2 + + return efun1 + + +def efun02(v): + ##evaluates teh first energy integrand, kamm equations 68 and 11. + ##the (c_val*v - 1) term might be singular at v=vmin in the standard case + ##the (1- c_val/gamma *v) term might be singular at v=vmin in the vacuum case + ##due care should be taken for these removable singularities by the integrator + l_fun, dlamdv, f_fun, g_fun, h_fun = sedov_funcs(v) + z = 8.0e0 / ((gv.xgeom + 2.0e0 - gv.omega) ** 2 * gv.gamp1) + efun2 = dlamdv * l_fun ** (gv.xgeom - 1.0e0) * h_fun * z + + return efun2 diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/globalvars.py b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/globalvars.py new file mode 100644 index 0000000000..4353283534 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/globalvars.py @@ -0,0 +1,36 @@ +class comvars(object): + gamma = 0.0 + gamm1 = 0.0 + gamp1 = 0.0 + gpogm = 0.0 + xgeom = 0 + xg2 = 0.0 + rwant = 0.0 + r2 = 0.0 + a0 = 0.0 + a1 = 0.0 + a2 = 0.0 + a3 = 0.0 + a4 = 0.0 + a5 = 0.0 + a_val = 0.0 + b_val = 0.0 + c_val = 0.0 + d_val = 0.0 + e_val = 0.0 + omega = 0.0 + vv = 0.0 + # xlam_want = 0.0 + vwant = 0.0 + rvv = 0.0 + lsingular = False + lstandard = False + lvacuum = False + lomega2 = False + lomega3 = False + + # eps is used for tolerences throughout the code + eps = 1.0e-10 + + # its controls the maximun iterations of the integrals in sed_1d + its = 10 diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/mesa.mplstyle b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/mesa.mplstyle new file mode 100644 index 0000000000..2f5102020f --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/mesa.mplstyle @@ -0,0 +1,38 @@ +# matplotlib style sheet for MESA Instrument Papers + +lines.markersize : 8 +lines.linewidth : 1.5 +axes.linewidth : 2.0 +text.usetex : True +font.size : 24 +font.family : sans +font.serif : Computer Modern Roman +axes.titlesize : large +axes.labelsize : large +legend.fontsize : 18 +legend.frameon : False +figure.dpi : 500 + +xtick.minor.visible : True +ytick.minor.visible : True + +savefig.bbox : tight +savefig.pad_inches : 0.15 +savefig.dpi : 300 +savefig.format : pdf + +xtick.direction : in +xtick.top : True +ytick.direction : in +ytick.right : True + +axes.formatter.use_mathtext : True + +xtick.major.size : 14 +xtick.minor.size : 12 +xtick.major.width : 1.75 +xtick.minor.width : 1.5 +ytick.major.size : 14 +ytick.minor.size : 10 +ytick.major.width : 1.75 +ytick.minor.width : 1.5 diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/plot_sedov_comparison.py b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/plot_sedov_comparison.py new file mode 100644 index 0000000000..a6ea942e40 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/plot_sedov_comparison.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python3 + +"""Compare MESA Sedov profiles with the Kamm-Timmes solution.""" + +from __future__ import annotations + +import argparse +import contextlib +import io +from pathlib import Path +import warnings + +import matplotlib.pyplot as plt +import mesa_reader as mr +import numpy as np + +from globalvars import comvars as gv +from sedov_1d import sed_1d + + +HERE = Path(__file__).resolve().parent +CASE_DIR = HERE.parent + +GAMMA = 1.4 +GEOMETRY = 3.0 +OMEGA = 1.0 +BLAST_ENERGY = 1.464276 +RHO_0 = 1.0 +P_AMBIENT = 1.0e-6 +NZ_BASELINE = 2000 + + +def profile_header(path: Path) -> dict[str, float | str]: + with path.open(encoding="utf-8") as handle: + handle.readline() + names = handle.readline().split() + values = handle.readline().split() + header = {} + for name, value in zip(names, values): + try: + header[name] = float(value) + except ValueError: + header[name] = value.strip('"') + return header + + +def nearest_profile( + log_dir: Path, target_time: float +) -> tuple[Path, dict[str, float | str]]: + rows = np.loadtxt(log_dir / "profiles.index", skiprows=1, dtype=int, ndmin=2) + candidates = [] + for model_number, _, profile_number in rows: + path = log_dir / f"profile{profile_number}.data" + header = profile_header(path) + time_seconds = float(header["time_seconds"]) + candidates.append((abs(time_seconds - target_time), path, header)) + _, path, header = min(candidates, key=lambda item: item[0]) + return path, header + + +def exact_solution(time_seconds: float, r_max: float) -> dict[str, np.ndarray | float]: + gv.its = 20 + gv.xgeom = GEOMETRY + gv.omega = OMEGA + gv.gamma = GAMMA + + radius = np.linspace(1.0e-4, r_max, 1800) + with contextlib.redirect_stdout(io.StringIO()), warnings.catch_warnings(): + warnings.simplefilter("ignore") + density, velocity, pressure, _, _, _, _, radius = sed_1d( + time_seconds, + radius.size, + radius, + BLAST_ENERGY, + RHO_0, + 0.0, + 0.0, + 0.0, + 1.0, + gv, + ) + + shock_radius = gv.r2 + shock_speed = 2.0 * shock_radius / ((GEOMETRY + 2.0 - OMEGA) * time_seconds) + rho_upstream = RHO_0 * shock_radius ** (-OMEGA) + rho_postshock = (GAMMA + 1.0) * rho_upstream / (GAMMA - 1.0) + velocity_postshock = 2.0 * shock_speed / (GAMMA + 1.0) + pressure_postshock = 2.0 * rho_upstream * shock_speed**2 / (GAMMA + 1.0) + return { + "radius": radius, + "density": density, + "velocity": velocity, + "pressure": pressure, + "shock_radius": shock_radius, + "rho_postshock": rho_postshock, + "velocity_postshock": velocity_postshock, + "pressure_postshock": pressure_postshock, + } + + +def mesa_profile(path: Path) -> dict[str, np.ndarray]: + profile = mr.MesaData(str(path)) + order = np.argsort(profile.radius_cm) + return { + "radius": profile.radius_cm[order], + "density": profile.density[order], + "velocity": profile.velocity[order], + "pressure": profile.pressure[order], + } + + +def precursor_diagnostics( + mesa: dict[str, np.ndarray], exact: dict[str, np.ndarray | float] +) -> dict[str, float]: + radius = mesa["radius"] + shock_radius = float(exact["shock_radius"]) + k_shock = int(np.argmin(abs(radius - shock_radius))) + k_lo = max(0, k_shock - 5) + k_hi = min(radius.size - 1, k_shock + 5) + local_dr = np.median(np.diff(radius[k_lo : k_hi + 1])) + ahead = (radius > shock_radius + 5.0 * local_dr) & (radius < shock_radius + 0.1) + if not np.any(ahead): + raise RuntimeError("profile does not extend ahead of the shock") + + ambient_density = RHO_0 * radius[ahead] ** (-OMEGA) + rho_error = mesa["density"][ahead] / ambient_density - 1.0 + velocity_error = mesa["velocity"][ahead] / float(exact["velocity_postshock"]) + pressure_error = (mesa["pressure"][ahead] - P_AMBIENT) / float( + exact["pressure_postshock"] + ) + + rho_k = int(np.argmax(abs(rho_error))) + velocity_k = int(np.argmax(abs(velocity_error))) + pressure_k = int(np.argmax(abs(pressure_error))) + ahead_radius = radius[ahead] + + behind = (radius < shock_radius - 5.0 * local_dr) & (radius > shock_radius - 0.2) + exact_density = np.interp(radius[behind], exact["radius"], exact["density"]) + density_postshock_error = (mesa["density"][behind] - exact_density) / float( + exact["rho_postshock"] + ) + density_postshock_k = int(np.argmax(abs(density_postshock_error))) + behind_radius = radius[behind] + density_postshock_full_k = np.flatnonzero(behind)[density_postshock_k] + exact_velocity = np.interp( + radius[density_postshock_full_k], exact["radius"], exact["velocity"] + ) + exact_pressure = np.interp( + radius[density_postshock_full_k], exact["radius"], exact["pressure"] + ) + target_dr = radius[-1] / NZ_BASELINE + return { + "local_dr": local_dr, + "rho_error": rho_error[rho_k], + "rho_error_radius": ahead_radius[rho_k], + "velocity_error": velocity_error[velocity_k], + "velocity_error_radius": ahead_radius[velocity_k], + "pressure_error": pressure_error[pressure_k], + "pressure_error_radius": ahead_radius[pressure_k], + "density_postshock_error": density_postshock_error[density_postshock_k], + "density_postshock_error_radius": behind_radius[density_postshock_k], + "velocity_at_density_error": ( + mesa["velocity"][density_postshock_full_k] - exact_velocity + ) + / float(exact["velocity_postshock"]), + "pressure_at_density_error": ( + mesa["pressure"][density_postshock_full_k] - exact_pressure + ) + / float(exact["pressure_postshock"]), + "inner_dr_at_density_error": ( + radius[density_postshock_full_k] - radius[density_postshock_full_k - 1] + ) + / target_dr, + "outer_dr_at_density_error": ( + radius[density_postshock_full_k + 1] - radius[density_postshock_full_k] + ) + / target_dr, + } + + +def parse_args() -> argparse.Namespace: + parser = argparse.ArgumentParser() + parser.add_argument( + "--logs", + nargs="+", + default=["LOGS_high_res", "LOGS_sedov"], + help="LOG directories relative to the Sedov case", + ) + parser.add_argument( + "--labels", + nargs="+", + help="plot labels corresponding to the LOG directories", + ) + parser.add_argument( + "--time", type=float, default=0.36, help="target time in seconds" + ) + parser.add_argument("--output", type=Path, default=HERE / "sedov_comparison.pdf") + parser.add_argument("--max-long", type=float, default=1.25) + parser.add_argument("--max-short", type=float, default=2.5) + return parser.parse_args() + + +def main() -> None: + args = parse_args() + plt.style.use(HERE / "mesa.mplstyle") + if args.labels is not None and len(args.labels) != len(args.logs): + raise ValueError("--labels must have one entry for each --logs entry") + labels = args.logs if args.labels is None else args.labels + + selected = [] + for name, label in zip(args.logs, labels): + log_dir = CASE_DIR / name + path, header = nearest_profile(log_dir, args.time) + mesa = mesa_profile(path) + exact = exact_solution(header["time_seconds"], max(mesa["radius"])) + selected.append((label, path, header, mesa, exact)) + + fields = ( + ("density", r"$\rho\;[\mathrm{g\,cm^{-3}}]$"), + ("velocity", r"$u\;[\mathrm{cm\,s^{-1}}]$"), + ("pressure", r"$P\;[\mathrm{erg\,cm^{-3}}]$"), + ) + fig, axes = plt.subplots(3, 2, figsize=(15, 12), sharex=True) + colors = plt.rcParams["axes.prop_cycle"].by_key()["color"] + scales = { + "density": "rho_postshock", + "velocity": "velocity_postshock", + "pressure": "pressure_postshock", + } + residual_labels = { + "density": r"$\Delta\rho/\rho_2$", + "velocity": r"$\Delta u/u_2$", + "pressure": r"$\Delta P/P_2$", + } + + for row, (field, ylabel) in enumerate(fields): + profile_axis = axes[row, 0] + residual_axis = axes[row, 1] + for run_number, (name, _, header, mesa, exact) in enumerate(selected): + color = colors[run_number % len(colors)] + profile_axis.plot( + mesa["radius"], + mesa[field], + color=color, + label=f"{name}: model {int(header['model_number'])}", + ) + profile_axis.axvline(float(exact["shock_radius"]), color=color, alpha=0.25) + + exact_at_mesa = np.interp(mesa["radius"], exact["radius"], exact[field]) + residual = (mesa[field] - exact_at_mesa) / float(exact[scales[field]]) + k_shock = int(np.argmin(abs(mesa["radius"] - float(exact["shock_radius"])))) + k_lo = max(0, k_shock - 5) + k_hi = min(mesa["radius"].size - 1, k_shock + 5) + local_dr = np.median(np.diff(mesa["radius"][k_lo : k_hi + 1])) + away_from_shock = ( + abs(mesa["radius"] - float(exact["shock_radius"])) > 5.0 * local_dr + ) + residual_axis.plot( + mesa["radius"][away_from_shock], + residual[away_from_shock], + color=color, + label=name, + ) + reference = selected[0][4] + profile_axis.plot( + reference["radius"], + reference[field], + color="black", + linestyle="--", + label="Kamm-Timmes", + ) + profile_axis.set_ylabel(ylabel) + profile_axis.legend(fontsize=12) + residual_axis.axhline(0.0, color="black", linewidth=1.0) + residual_axis.set_ylabel(residual_labels[field]) + residual_axis.legend(fontsize=12) + + axes[-1, 0].set_xlabel(r"$r\;[\mathrm{cm}]$") + axes[-1, 1].set_xlabel(r"$r\;[\mathrm{cm}]$") + axes[-1, 0].set_xlim(0.4, 0.75) + axes[-1, 1].set_xlim(0.4, 0.75) + fig.savefig(args.output) + fig.savefig(args.output.with_suffix(".png"), dpi=200) + + mesh_fig, mesh_axes = plt.subplots(2, 1, figsize=(10, 9), sharex=True) + for run_number, (name, _, _, mesa, exact) in enumerate(selected): + color = colors[run_number % len(colors)] + exact_density = np.interp(mesa["radius"], exact["radius"], exact["density"]) + density_residual = (mesa["density"] - exact_density) / float( + exact["rho_postshock"] + ) + mesh_axes[0].plot(mesa["radius"], density_residual, color=color, label=name) + + dr = np.diff(mesa["radius"]) + rmid = 0.5 * (mesa["radius"][1:] + mesa["radius"][:-1]) + target_dr = mesa["radius"][-1] / NZ_BASELINE + mesh_axes[1].plot(rmid, dr / target_dr, color=color, label=name) + for axis in mesh_axes: + axis.axvline(float(exact["shock_radius"]), color=color, alpha=0.25) + + mesh_axes[0].axhline(0.0, color="black", linewidth=1.0) + mesh_axes[0].set_ylabel(r"$\Delta\rho/\rho_2$") + mesh_axes[0].legend(fontsize=12) + mesh_axes[1].axhline(args.max_long, color="black", linestyle=":", linewidth=1.0) + mesh_axes[1].axhline( + 1.0 / args.max_short, color="black", linestyle=":", linewidth=1.0 + ) + mesh_axes[1].set_ylabel(r"$\Delta r/\Delta r_{\rm target}$") + mesh_axes[1].set_xlabel(r"$r\;[\mathrm{cm}]$") + mesh_axes[1].legend(fontsize=12) + mesh_axes[1].set_xlim(0.45, 0.65) + mesh_output = args.output.with_name(args.output.stem + "_mesh") + mesh_fig.savefig(mesh_output.with_suffix(".pdf")) + mesh_fig.savefig(mesh_output.with_suffix(".png"), dpi=200) + + for name, path, header, mesa, exact in selected: + diagnostic = precursor_diagnostics(mesa, exact) + print( + f"{name}: {path.name}, model={int(header['model_number'])}, " + f"t={header['time_seconds']:.8f} s, " + f"r_shock={float(exact['shock_radius']):.8f} cm" + ) + print( + " upstream maxima beyond five local cells: " + f"dr={diagnostic['local_dr']:.3e} cm, " + f"dRho/Rho={diagnostic['rho_error']:.3e} " + f"at {diagnostic['rho_error_radius']:.6f} cm, " + f"u/u2={diagnostic['velocity_error']:.3e} " + f"at {diagnostic['velocity_error_radius']:.6f} cm, " + f"dP/P2={diagnostic['pressure_error']:.3e} " + f"at {diagnostic['pressure_error_radius']:.6f} cm" + ) + print( + " postshock density maximum away from the front: " + f"dRho/Rho2={diagnostic['density_postshock_error']:.3e} " + f"at {diagnostic['density_postshock_error_radius']:.6f} cm, " + f"du/u2={diagnostic['velocity_at_density_error']:.3e}, " + f"dP/P2={diagnostic['pressure_at_density_error']:.3e}, " + "adjacent dr/target=" + f"({diagnostic['inner_dr_at_density_error']:.3f}, " + f"{diagnostic['outer_dr_at_density_error']:.3f})" + ) + + +if __name__ == "__main__": + main() diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedfind_functions.py b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedfind_functions.py new file mode 100644 index 0000000000..6ae5768c83 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedfind_functions.py @@ -0,0 +1,22 @@ +from globalvars import comvars as gv +from sedov_functions import sedov_funcs + + +def sed_v_find(v): + ##given corresponding physical distances, find the similarity variable v + ##kamm equation 38 as a root find + + l_fun, dlamdv, f_fun, g_fun, h_fun = sedov_funcs(v) + v_find = gv.r2 * l_fun - gv.rwant + + return v_find + + +def sed_r_find(r): + ##given the similarity variably v, find the sorrespoding physical distance + ##kamm equation 38 as a root find + + l_fun, dlamdv, f_fun, g_fun, h_fun = sedov_funcs(gv.vwant) + r_find = gv.r2 * l_fun - r + + return r_find diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedov_1d.py b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedov_1d.py new file mode 100644 index 0000000000..22fb0ddb00 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedov_1d.py @@ -0,0 +1,309 @@ +import numpy as np +from energy_functions import efun01, efun02 +from sedfind_functions import sed_v_find, sed_r_find +from sedov_functions import sedov_funcs +from scipy import integrate +from scipy import optimize + + +def sed_1d(time, nstep, xpos, eblast, rho0, vel0, ener0, pres0, cs0, gv): + # ============================================================================== + # ..this routine produces 1d solutions for a sedov blast wave propagating + # ..through a density gradient rho = rho**(-omega) + # ..in planar, cylindrical or spherical geometry + # ..for the standard, singular and vaccum cases. + # + # ..standard case: a nonzero solution extends from the shock to the origin, + # .. where the pressure is finite. + # ..singular case: a nonzero solution extends from the shock to the origin, + # .. where the pressure vanishes. + # ..vacuum case : a nonzero solution extends from the shock to a boundary point, + # .. where the density vanishes making the pressure meaningless. + # + # ..input: + # ..time = temporal point where solution is desired seconds + # ..xpos(i) = spatial points where solution is desired cm + # ..eblast = energy of blast erg + # ..rho0 = ambient density g/cm**3 rho = rho0 * r**(-omega_in) + # ..omegain = density power law exponent rho = rho0 * r**(-omega_in) + # ..vel0 = ambient material speed cm/s + # ..pres0 = ambient pressure erg/cm**3 + # ..cs0 = ambient sound speed cm/s + # ..gam0 = gamma law equation of state + # ..xgeom_in = geometry factor, 3=spherical, 2=cylindircal, 1=planar + # + # ..for efficiency reasons (doing the energy integrals only once), + # ..this routine returns the solution for an array of spatial points + # ..at the desired time point. + # + # ..output: + # ..den(i) = density + # ..enertot(i) = specific internal energy + # ..pres(i) = presssure + # ..vel(i) = velocity + # ..mach(i) = mach number + # + # ..although the ordinary differential equations are analytic, + # ..the sedov expressions appear to become singular for various + # ..combinations of parameters and at the lower limits of the integration + # ..range. all these singularies are removable and done so by this routine. + # ..these routines are written in real*16 precision because the + # ..real*8 implementations simply run out of precision "near" the origin + # ..in the standard case or the transition region in the vacuum case. + # + # ..eps controls the integration accuracy, don’t get too greedy or the number + # ..of function evaluations required kills. + # ..eps2 controls the root find accuracy + # ..osmall controls the size of transition regions + # ============================================================================== + + iprint = 1 + gv.eps = 1.0e-10 + eps2 = 1.0e-30 + osmall = 1.0e-4 + + # ============================================================================== + ##original code common block + # ============================================================================== + # + # global gamma, gamm1, gamp1, gpogm, xgeom, xg2, rwant + # global r2, a0, a1, a2, a3, a4, a5, a_val, b_val, cval_ + # global d_val, e_val, omega, vv, xlam_want, vwant, rvv + # global lsingular, lstandard, lvacuum, lomega2, lomega3 + # + # create initial arrays of density, velocity, pressure, energy, and sound speed. + # initally create arrays of zeros. + den = np.zeros(nstep) + vel = np.zeros(nstep) + pres = np.zeros(nstep) + enertot = np.zeros(nstep) + enertherm = np.zeros(nstep) + enerkin = np.zeros(nstep) + mach = np.zeros(nstep) + + ##return on uynphysical cases + ##infinite mass + if gv.omega >= gv.xgeom: + return + + ##transfer through comon block and create some frequent combonations. + # common block from original code is now emulated by global varibles. + + gv.gamm1 = gv.gamma - 1.0e0 + gv.gamp1 = gv.gamma + 1.0e0 + gv.gpogm = gv.gamp1 / gv.gamm1 + gv.xg2 = gv.xgeom + 2.0e0 - gv.omega + denom2 = 2.0e0 * gv.gamm1 + gv.xgeom - gv.gamma * gv.omega + denom3 = gv.xgeom * (2.0e0 - gv.gamma) - gv.omega + + ## post shock location v2 and location of singular point vstar + ## kamm equations 18 and 19 + + v2 = 4.0e0 / (gv.xg2 * gv.gamp1) + vstar = 2.0e0 / (gv.gamm1 * gv.xgeom + 2.0e0) + + ##set two logicals to determine type of solution + gv.lstandard = False + gv.lsingular = False + gv.lavcuum = False + + if abs(v2 - vstar) <= osmall: + gv.lsingular = True + elif v2 < vstar - osmall: + gv.lstandard = True + elif v2 > vstar + osmall: + gv.lvacuum = True + + ##two apparent singularities, books notation for omega2 and omega3 + gv.lomega2 = False + gv.lomega3 = False + + if abs(denom2) <= osmall: + gv.lomega = True + denom2 = 1.0e-8 + if iprint == 1: + print("omega2 case") + elif abs(denom3) <= osmall: + gv.lomega3 = True + denom3 = 1.0e-8 + if iprint == 1: + print("omega3 case") + + ##variuos exponents, kamm equations 42-47 + gv.a0 = 2.0e0 / gv.xg2 + gv.a2 = -gv.gamm1 / denom2 + gv.a1 = (gv.xg2 * gv.gamma / (2.0e0 + gv.xgeom * gv.gamm1)) * ( + ((2.0e0 * (gv.xgeom * (2.0e0 - gv.gamma) - gv.omega)) / (gv.gamma * gv.xg2**2)) + - gv.a2 + ) + gv.a3 = (gv.xgeom - gv.omega) / denom2 + gv.a4 = gv.xg2 * (gv.xgeom - gv.omega) * gv.a1 / denom3 + gv.a5 = ((gv.omega * gv.gamp1) - (2.0e0 * gv.xgeom)) / denom3 + + ##frequent combinations, kamm equations 33-37 + gv.a_val = 0.25e0 * gv.xg2 * gv.gamp1 + gv.b_val = gv.gpogm + gv.c_val = 0.5e0 * gv.xg2 * gv.gamma + gv.d_val = (gv.xg2 * gv.gamp1) / ( + (gv.xg2 * gv.gamp1) - 2.0e0 * (2.0e0 + (gv.xgeom * gv.gamm1)) + ) + gv.e_val = 0.5e0 * (2.0e0 + (gv.xgeom * gv.gamm1)) + + ##evaluate energy intergrals + ##the singular case can be done by hand; save some cpu cycles + ##kamm equations 80, 81, and 85 + if gv.lsingular: + eval2 = gv.gamp1 / (gv.xgeom * ((gv.gamm1 * gv.xgeom) + 2.0e0) ** 2) + eval1 = 2.0e0 / gv.gamm1 * eval2 + alpha = ( + gv.gpogm + * 2 ** (gv.xgeom) + / (gv.xgeom * ((gv.gamm1 * gv.xgeom) + 2.0e0) ** 2) + ) + if int(gv.xgeom) != 1: + alpha = np.pi * alpha + + ## for standard or vacuum cases + ## v0 = post-shock orgin v0 and vv = vacuum boundry vv + ## set the radius(rvv) coresponding to vv to 0 for now + ## kamm equations 18, and 20 + else: + v0 = 2.0e0 / (gv.xg2 * gv.gamma) + gv.vv = 2.0e0 / gv.xg2 + gv.rvv = 0.0e0 + if gv.lstandard: + vmin = v0 + if gv.lvacuum: + vmin = gv.vv + + ##the first energy intergral + ##in standard case the term (c_val*v - 1) mighht be singular at v = vmin + ##kamm equations 18 and 28 + # qromo subroutine from original code is replaced by romberg routine from scipy.integrate + eval1 = integrate.romberg(efun01, vmin, v2, tol=gv.eps, divmax=gv.its) + ##int the vacuum case the term (1-c_val/gamma*v) might be singular at v=vmin + ##in the standard case the term ( c_val * v-1) might be singular at v=vmin + eval2 = integrate.romberg(efun02, vmin, v2, tol=gv.eps, divmax=gv.its) + ##in the vacuum case the term (1-c_val/gamma*v) might be singular at v=vmin + ## kamm equations 57n and 58 for alpha in a slightly different form + if gv.xgeom == 1.0: + alpha = (0.5e0 * eval1) + (eval2 / gv.gamm1) + else: + alpha = (gv.xgeom - 1.0e0) * np.pi * (eval1 + 2.0e0 * eval2 / gv.gamm1) + + ##write what we have for the energy intergrals + if iprint == 1: + print("xgeom=", gv.xgeom) + print("eblast=", eblast) + print("omega=", gv.omega) + print("alpha=", alpha) + print("j1=", eval1) + print("j2=", eval2) + + ##immediate post-shock values + ##kamm page 14 or equations 14, 16, 5, 13 + ##r2 = shock position, us = shock spees, rho1 = pre-shock density + ##u2 = post-shock material speed, rho2 = post-shock density + ##p2 = post-shock pressure, e2 = post-shock specific internal energy + ##adn cs2 = post-shock sound speed + + gv.r2 = (eblast / (alpha * rho0)) ** (1.0e0 / gv.xg2) * time ** (2.0e0 / gv.xg2) + us = (2.0e0 / gv.xg2) * gv.r2 / time + rho1 = rho0 * gv.r2 ** (-gv.omega) + u2 = 2.0e0 * us / gv.gamp1 + rho2 = gv.gpogm * rho1 + p2 = 2.0e0 * rho1 * us**2 / gv.gamp1 + e2 = p2 / (gv.gamm1 * rho2) + cs2 = np.sqrt(gv.gamma * p2 / rho2) + + ##find the radius corresponding to vv + # sub routine zeroin from original code is replaced by the brenth function from scipy.integrate + if gv.lvacuum: + gv.vwant = gv.vv + gv.rvv = optimize.brenth(sed_r_find, 0.0e0, gv.r2, xtol=gv.eps) + + # print various values + if gv.lstandard and iprint == 1: + print("r2=", gv.r2) + print("rho2=", rho2) + print("u2=", u2) + print("e2=", e2) + print("p2=", p2) + print("cs2=", cs2) + + if gv.lvacuum and iprint == 1: + print("rv=", gv.rvv) + print("r2=", gv.r2) + print("rho2=", rho2) + print("u2=", u2) + print("e2=", e2) + print("p2=", p2) + print("cs2=", cs2) + + ##now start loop over spatial positions + for i in range(0, nstep): + gv.rwant = xpos[i] + + ##if we are upstream from the shock + # area not yet disturbed by shock front + if gv.rwant >= gv.r2: + den[i] = rho0 * gv.rwant ** (-gv.omega) + vel[i] = vel0 + pres[i] = pres0 + enertot[i] = ener0 + enertherm[i] = pres[i] / (gv.gamm1) + enerkin[i] = 0.5e0 * den[i] * (vel[i]) ** 2 + mach[i] = vel[i] / cs0 + + # check to see if solutins are valid in region, if not delete the point from the array + # this will prevent python from stoping the code, and allow for solutions to be produced in valid regions. + # if statemant checks if sed_v_find are the same sign at two points( 0.9*v0 and v2) + elif sed_v_find(0.9e0 * v0) / sed_v_find(v2) > 0: + xpos[i] = 0.0 + den[i] = 0.0 + vel[i] = 0.0 + pres[i] = 0.0 + enertot[i] = 0.0 + enertherm[i] = 0.0 + enerkin[i] = 0.0 + mach[i] = 0.0 + + ##if we are between the orgin and the shock front + else: + if gv.lstandard: + vat = optimize.brenth(sed_v_find, 0.90e0 * v0, v2, xtol=eps2) + elif gv.lvacuum: + vat = optimize.brenth(sed_v_find, v2, 1.2e0 * gv.vv, xtol=eps2) + + ##the pysical solution + l_fun, dlamdv, f_fun, g_fun, h_fun = sedov_funcs(vat) + den[i] = rho2 * g_fun + vel[i] = u2 * f_fun + pres[i] = p2 * h_fun + enertot[i] = 0.0e0 + enertherm[i] = 0.0e0 + enerkin[i] = 0.0e0 + mach[i] = vel[i] / cs0 + if den[i] != 0.0: + enertot[i] = pres[i] / (gv.gamm1) + 0.5e0 * den[i] * (vel[i]) ** 2 + enertherm[i] = pres[i] / (gv.gamm1) + enerkin[i] = 0.5e0 * den[i] * (vel[i]) ** 2 + + # remove void results from the arrays + # void variable is to correct for indexing as values are deleted from the array + void = 0 + for i in range(0, nstep): + if xpos[i] == 0: + den = np.delete(den, i - void) + vel = np.delete(vel, i - void) + pres = np.delete(pres, i - void) + enertot = np.delete(enertot, i - void) + enertherm = np.delete(enertherm, i - void) + enerkin = np.delete(enerkin, i - void) + mach = np.delete(mach, i - void) + void = void + 1 + + xpos = np.trim_zeros(xpos, "f") + + ## end loop over spatial positions + return den, vel, pres, enertot, enertherm, enerkin, mach, xpos diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedov_functions.py b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedov_functions.py new file mode 100644 index 0000000000..70f18cd575 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/plotter/sedov_functions.py @@ -0,0 +1,105 @@ +import numpy as np +from globalvars import comvars as gv + + +def sedov_funcs(v): + + ##given the similarity variable v, return funtions, lambda, f, g, h, and th derivative of lambda with v dlamdv + + ##although the ordinary differential equations are analytic, the sedov expressions + ##appear to become singular for various combinations of parameters and at the lower + ## limits of the integration range. all these singularaties are rtemovable and done by this routine + + ##frequent combintaion and their derivative with v + ##kamm equations 29 - 32, x4 a bit different to save a divide + ##x1 is book's F + + x1 = gv.a_val * v + dx1dv = gv.a_val + + cbag = max(gv.eps, gv.c_val * v - 1.0e0) + x2 = gv.b_val * cbag + dx2dv = gv.b_val * gv.c_val + + ebag = 1.0e0 - gv.e_val * v + x3 = gv.d_val * ebag + dx3dv = -gv.d_val * gv.e_val + + x4 = gv.b_val * (1.0e0 - 0.5e0 * gv.xg2 * v) + dx4dv = -gv.b_val * 0.5e0 * gv.xg2 + + ##transition region between standard and vacuum cases + ##kamm page 15 or equations 88-92 + ##lambds = l_fun is book's zeta + ##f_fun is book's V, g_fun is book's D, h_fun is book's P + + if gv.lsingular: + l_fun = gv.rwant / gv.r2 + dlamdv = 0.0e0 + f_fun = l_fun + g_fun = l_fun ** (gv.xgeom - 2.0e0) + h_fun = l_fun**gv.xgeom + + ##for the vacuum case in the hole + elif gv.lvacuum and gv.rwant < gv.rvv: + l_fun = 0.0e0 + dlamdv = 0.0e0 + f_fun = 0.0e0 + g_fun = 0.0e0 + h_fun = 0.0e0 + + ##omega = omega2 = (2*(gamma - 1)+xgeom)/gamma case, denom2 = 0 + ##book expressions 20-22 + elif gv.lomega2: + beta0 = 1.0e0 / (2.0e0 * gv.e_val) + pp1 = gv.gamm1 * beta0 + c6 = 0.5e0 * gv.gamp1 + c2 = c6 / gv.gamma + y = 1.0e0 / (x1 - c2) + z = (1.0e0 - x1) * y + pp2 = gv.gamp1 * beta0 * z + dpp2dv = -gv.gamp1 * beta0 * dx1dv * y * (1.0e0 + z) + pp3 = (4.0e0 - gv.xgeom - 2.0e0 * gv.gamma) * beta0 + pp4 = -gv.xgeom * gv.gamma * beta0 + + l_fun = x1 ** (-gv.a0) * x2 ** (pp1) * np.exp(pp2) + dlamdv = (-gv.a0 * dx1dv / x1 + pp1 * dx2dv / x2 + dpp2dv) * l_fun + f_fun = x1 * l_fun + g_fun = x1 ** (gv.a0 * gv.omega) * x2**pp3 * x4**gv.a5 * np.exp(-2.0e0 * pp2) + h_fun = x1 ** (gv.a0 * gv.xgeom) * x2**pp4 * x4 ** (1.0e0 + gv.a5) + + ##omega = omega3 = xgeom*(2-gamma) case, denom3 = 0 + ##book expressions 23-25 + elif gv.lomega3: + beta0 = 1.0e0 / (2.0e0 * gv.e_val) + pp1 = gv.a3 + gv.omega * gv.a2 + pp2 = 1.0e0 - 4.0e0 * beta0 + c6 = 0.5e0 * gv.gamp1 + pp3 = -gv.xgeom * gv.gamma * gv.gamp1 * beta0 * (1.0e0 - x1) / (c6 - x1) + pp4 = 2.0e0 * (gv.xgeom * gv.gamm1 - gv.gamma) * beta0 + + l_fun = x1 ** (-gv.a0) * x2 ** (-gv.a2) * x4 ** (-gv.a1) + dlamdv = -(gv.a0 * dx1dv / x1 + gv.a2 * dx2dv / x2 + gv.a1 * dx4dv / x4) * l_fun + f_fun = x1 * l_fun + g_fun = x1 ** (gv.a0 * gv.omega) * x2**pp1 * x4**pp2 * np.exp(pp3) + h_fun = x1 ** (gv.a0 * gv.xgeom) * x4**pp4 * np.exp(pp3) + + ##for the standard or vacuum case not in the hole + ##kamm equations 38 - 41 + else: + l_fun = x1 ** (-gv.a0) * x2 ** (-gv.a2) * x3 ** (-gv.a1) + dlamdv = -(gv.a0 * dx1dv / x1 + gv.a2 * dx2dv / x2 + gv.a1 * dx3dv / x3) * l_fun + f_fun = x1 * l_fun + g_fun = ( + x1 ** (gv.a0 * gv.omega) + * x2 ** (gv.a3 + gv.a2 * gv.omega) + * x3 ** (gv.a4 + gv.a1 * gv.omega) + * x4**gv.a5 + ) + h_fun = ( + x1 ** (gv.a0 * gv.xgeom) + * x3 ** (gv.a4 + gv.a1 * (gv.omega - 2.0e0)) + * x4 ** (1.0e0 + gv.a5) + ) + + return l_fun, dlamdv, f_fun, g_fun, h_fun diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/profile_columns.list b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/profile_columns.list new file mode 100644 index 0000000000..bc73504ebe --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/profile_columns.list @@ -0,0 +1,984 @@ +! 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 + !psi_roche ! dimensionless Roche potential at outer boundary of zone (only works if in a binary model and b% use_tidal_deformation is used; else is -99) + 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 + !flux_limit_lambda ! flux limiter defined as in Levermore & Pomraning 1981 + !flux_limit_R ! flux ratio defined as in Levermore & Pomraning 1981 + + !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 their 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 ! cell specific work per unit time, Work = dwork_dm*dm*dt + + !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 ! grada-gradT at cell boundary + !gradT_sub_grada ! gradT-grada at cell boundary + !gradT_div_grada ! gradT/grada at cell boundary + + !gradr_sub_gradT ! gradr-gradT at cell boundary + !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 ! gradL-gradr at cell boundary + !gradP_div_rho ! finite difference (deltaP/deltam)* 4*pi*r^2, at cell boundary + !gradT_excess_effect ! 1 - alpha, where alpha is the gradT_excess_alpha from mlt++ + !gradT_rel_err ! gradT - actual_gradT / gradT, actual_gradT = deltaT/deltaP from finite difference + !gradT_sub_a ! same as gradT_sub_grada ! gradT-grada at cell boundary + !grada_face ! grada at cell boundary + !grada_sub_gradr ! grada-gradr at cell boundary + !diff_grads ! gradr - gradL at cell boundary + !log_diff_grads ! log10(diff_grads) + + !mlt_D ! The chemical diffusion coefficient (cm^2/s) + !mlt_Gamma ! The convective efficiency parameter from the mlt equation, Gamma=(grad-gradE)/(gradE-gradL) + !mlt_Y_face ! The superadiabaticity Y = dlnT/dlnP - grada, or dlnT/dlnP - gradL at cell boundary + !mlt_Zeta ! convective efficiency as Zeta = (gradr-gradT)/(gradr-grada) + !mlt_gradT ! same as gradT, mlt/TDC value for dlnT/dlnP. + !mlt_log_abs_Y ! log10(abs(Y_face)) + !mlt_vc ! convective velocity from mlt/TDC in cm/s + !log_mlt_vc ! log10(mlt_vc) + !dvc_dt_TDC_div_g ! dimensionless ratio of convective velocity to g + + !superad_reduction_factor ! gamma_factor from superad_reduction + !conv_vel_div_mlt_vc ! conv_vel from any convection model (including RSP) / mlt_vc, for comparison + + !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 + !Riemann_shock_compression ! max(0, (u_inner-u_outer)/cs_face) + !Riemann_shock_pressure_jump ! max(0, P_face/min(P_inner,P_outer) - 1) + !Riemann_shock_strength ! minimum of compression and pressure jump + !Riemann_shock_D_mix_factor ! factor applied to final chemical D_mix + !Uq + !Y_face + + !reconstructed_T_face + !reconstructed_rho_face + !reconstructed_P_face + !reconstructed_Cp_face + !reconstructed_ChiRho_face + !reconstructed_ChiT_face + !reconstructed_grada_face + !reconstructed_opacity_face + !reconstructed_scale_height_face + !reconstructed_gradr_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 ! gravity = -grav = -Gm/r^2 + !grav_eff ! effective gravity = -(grav - dvdt) + + !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_test_TDC/dev_TDC_sedov_omega_1/re b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/re new file mode 100755 index 0000000000..b09284556c --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/re @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +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_test_TDC/dev_TDC_sedov_omega_1/rn b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/rn new file mode 100755 index 0000000000..d1ae6287eb --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/rn @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# this provides the definition of do_one (run one part of test) +# do_one [inlist] [output model] [LOGS directory] +export MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +mkdir -p mods + +do_one inlist_start_header mods/sedov_start.mod +do_one inlist_sedov_omega_1_header mods/done_with_sedov.mod LOGS_sedov + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +echo 'finished' diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/rn1 b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/rn1 new file mode 100755 index 0000000000..0dbec915dc --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/rn1 @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +export MESA_DIR=../../.. + +rm -f restart_photo + +make run diff --git a/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/src/run.f90 b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/src/run.f90 new file mode 100644 index 0000000000..62063eb217 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/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_test_TDC/dev_TDC_sedov_omega_1/src/run_star_extras.f90 b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/src/run_star_extras.f90 new file mode 100644 index 0000000000..eb5aad056d --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_sedov_omega_1/src/run_star_extras.f90 @@ -0,0 +1,412 @@ +! *********************************************************************** +! +! Copyright (C) 2010-2026 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 + + implicit none + + real(dp), parameter :: gamma_law = 1.4d0 + + include 'test_suite_extras_def.inc' + + contains + + include 'test_suite_extras.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_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 + + s% eos_rq% use_other_eos_component = .true. + s% eos_rq% other_eos_frac => gamma_eos_frac + s% eos_rq% other_eos_component => gamma_eos_component + s% use_other_cgrav = .true. + s% other_cgrav => zero_cgrav + s% use_other_kap = .true. + s% other_kap_get => constant_kap + + if (.not. s% x_logical_ctrl(1)) return + + call create_sedov_test_model(id, s, ierr) + if (ierr /= 0) call mesa_error(__FILE__, __LINE__, 'failed in create_sedov_test_model') + end subroutine extras_controls + + + subroutine create_sedov_test_model(id, s, ierr) + use chem_def, only: ih1, ihe4 + use chem_lib, only: basic_composition_info + use eos_lib, only: eos_gamma_DP_get_ET + integer, intent(in) :: id + type(star_info), pointer :: s + integer, intent(out) :: ierr + + logical :: log_mesh + integer :: k, nz, h1, he4, k_inject + real(dp) :: xh, xhe, z, abar, zbar, z53bar, z2bar, ye, & + mass_correction, sumx, R_inject, R_min, R_max, dr, rho, & + rho_0, omega, P_floor, P, P_base, r00, rmid, rp1, & + lnR00, r_for_rho, sum_cell_mass, lnR_min, lnR_max, & + dlnR, E_inject, E_done + + include 'formats' + + ierr = 0 + s% u_flag = .true. + s% RTI_flag = .false. + + log_mesh = s% split_merge_amr_log_zoning + nz = s% split_merge_amr_nz_baseline + s% nz = nz + E_inject = s% x_ctrl(1) + R_inject = s% x_ctrl(2) + R_min = s% x_ctrl(3) + R_max = s% x_ctrl(4) + rho_0 = s% x_ctrl(5) + P_floor = s% x_ctrl(6) + omega = s% x_ctrl(7) + P_base = s% x_ctrl(8) + r_for_rho = s% x_ctrl(9) + + lnR_min = log(R_min) + lnR_max = log(R_max) + dr = (R_max - R_min)/(nz - 1) + dlnR = (lnR_max - lnR_min)/(nz - 1) + + call star_set_net(id, 'basic_plus_fe56.net', ierr) + if (ierr /= 0) return + call star_set_var_info(id, ierr) + if (ierr /= 0) return + call star_set_chem_names(id, ierr) + if (ierr /= 0) return + call star_allocate_arrays(id, ierr) + if (ierr /= 0) return + + h1 = s% net_iso(ih1) + he4 = s% net_iso(ihe4) + s% M_center = 0d0 + s% R_center = 0d0 + E_done = 0d0 + k_inject = 0 + + do k = nz, 1, -1 + if (k == nz) then + r00 = R_min + rp1 = s% R_center + rmid = 0.5d0*r00 + lnR00 = lnR_min + else + rp1 = r00 + if (log_mesh) then + lnR00 = lnR00 + dlnR + r00 = exp(lnR00) + dr = r00 - rp1 + else + r00 = rp1 + dr + lnR00 = log(r00) + end if + rmid = r00 - 0.5d0*dr + end if + + if (rmid > R_inject) then + P = P_floor + else + k_inject = k + P = P_floor + P_base*0.5d0*(1d0 + cos(pi*rmid/R_inject)) + end if + + s% r(k) = r00 + s% lnR(k) = lnR00 + s% u(k) = 0d0 + s% alpha_RTI(k) = 0d0 + rho = rho_0/(pow(r_for_rho, omega) + pow(rmid, omega)) + s% rho(k) = rho + s% lnd(k) = log(rho) + s% dm(k) = rho*(4d0*pi/3d0)*(pow3(r00) - pow3(rp1)) + if (k == nz) then + s% m(k) = s% dm(k) + else + s% m(k) = s% m(k + 1) + s% dm(k) + end if + s% L(k) = 0d0 + s% Peos(k) = P + s% lnPeos(k) = log(P) + s% xa(1:s% species,k) = 0d0 + if (k == nz) then + s% xa(he4,k) = 1d0 + else + s% xa(h1,k) = 1d0 + end if + + call basic_composition_info( & + s% species, s% chem_id, s% xa(:,k), xh, xhe, z, & + abar, zbar, z2bar, z53bar, ye, mass_correction, sumx) + call eos_gamma_DP_get_ET( & + abar, rho, P, gamma_law, s% energy(k), s% T(k), ierr) + if (ierr /= 0) return + s% abar(k) = abar + s% zbar(k) = zbar + s% z53bar(k) = z53bar + s% lnE(k) = log(s% energy(k)) + s% lnT(k) = log(s% T(k)) + if (k >= k_inject) E_done = E_done + s% dm(k)*s% energy(k) + end do + + sum_cell_mass = sum(s% dm(1:nz)) + write(*,1) 'sum_cell_mass/Msun', sum_cell_mass/Msun + write(*,1) 'E_done', E_done + write(*,1) 'E want', E_inject + write(*,1) '(E_done - E)/E', (E_done - E_inject)/E_inject + + s% L_center = 0d0 + s% star_mass = s% m(1)/Msun + s% mstar = s% m(1) + s% xmstar = s% m(1) + s% q(1) = 1d0 + do k = 1, nz - 1 + s% dq(k) = s% dm(k)/s% xmstar + s% q(k + 1) = s% q(k) - s% dq(k) + end do + s% dq(nz) = s% q(nz) + + s% model_number = 0 + s% star_age = 0d0 + s% initial_z = 0d0 + + call star_write_model(id, 'mods/sedov_start.mod', ierr) + if (ierr /= 0) return + write(*,2) 'mods/sedov_start.mod', nz + stop + end subroutine create_sedov_test_model + + + subroutine 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 + call test_suite_startup(s, restart, ierr) + end subroutine extras_startup + + + subroutine extras_after_evolve(id, ierr) + integer, intent(in) :: id + integer, intent(out) :: ierr + type(star_info), pointer :: s + integer :: k + logical :: okay + real(dp) :: total_energy, r_shock, rho_shock, u_shock, & + energy_shock, P_shock + + include 'formats' + + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + if (s% time < 1d0) return + + k = maxloc(s% u(1:s% nz), dim=1) + total_energy = 1.46687d0 + r_shock = 1d0 + rho_shock = 6d0 + u_shock = 4.166667d-1 + energy_shock = 8.680555d-2 + P_shock = 2.083333d-1 + okay = & + abs(s% time - 1d0) < 1d-14 .and. & + abs(s% total_energy - total_energy) < 1d-3 .and. & + abs(s% r(k) - r_shock) < 5d-3 .and. & + abs(s% rho(k) - rho_shock) < 5d-1 .and. & + abs(s% u(k) - u_shock) < 1d-2 .and. & + abs(s% energy(k) - energy_shock) < 2d-3 .and. & + abs(s% Peos(k) - P_shock) < 1d-2 + + write(*,2) '(time - target)', s% model_number, s% time - 1d0 + write(*,2) '(total_energy - target)', s% model_number, & + s% total_energy - total_energy + write(*,2) '(r - target)/target', k, (s% r(k) - r_shock)/r_shock + write(*,2) '(rho - target)/target', k, (s% rho(k) - rho_shock)/rho_shock + write(*,2) '(u - target)/target', k, (s% u(k) - u_shock)/u_shock + write(*,2) '(energy - target)/target', k, & + (s% energy(k) - energy_shock)/energy_shock + write(*,2) '(P - target)/target', k, (s% Peos(k) - P_shock)/P_shock + if (okay) then + write(*,*) 'Sedov solution is within tolerance' + else + write(*,*) 'Sedov solution is outside tolerance' + end if + + call test_suite_after_evolve(s, ierr) + end subroutine extras_after_evolve + + + integer function extras_check_model(id) + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + + ierr = 0 + call star_ptr(id, s, ierr) + extras_check_model = keep_going + if (ierr /= 0) return + end function extras_check_model + + + integer function extras_finish_step(id) + integer, intent(in) :: id + integer :: ierr + type(star_info), pointer :: s + + ierr = 0 + call star_ptr(id, s, ierr) + extras_finish_step = keep_going + if (ierr /= 0) return + end function extras_finish_step + + + integer function how_many_extra_history_columns(id) + integer, intent(in) :: id + how_many_extra_history_columns = 0 + 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) + integer, intent(out) :: ierr + ierr = 0 + end subroutine data_for_extra_history_columns + + + integer function how_many_extra_profile_columns(id) + integer, intent(in) :: id + how_many_extra_profile_columns = 0 + end function how_many_extra_profile_columns + + + subroutine data_for_extra_profile_columns(id, n, nz, names, vals, ierr) + integer, intent(in) :: id, n, nz + character(len=maxlen_profile_column_name) :: names(n) + real(dp) :: vals(nz,n) + integer, intent(out) :: ierr + ierr = 0 + end subroutine data_for_extra_profile_columns + + + subroutine gamma_eos_frac( & + handle, species, chem_id, net_iso, xa, Rho, logRho, T, logT, & + frac, dfrac_dlogRho, dfrac_dlogT, ierr) + integer, intent(in) :: handle, species + integer, pointer :: chem_id(:), net_iso(:) + real(dp), intent(in) :: xa(:), Rho, logRho, T, logT + real(dp), intent(out) :: frac, dfrac_dlogRho, dfrac_dlogT + integer, intent(out) :: ierr + + ierr = 0 + frac = 1d0 + dfrac_dlogRho = 0d0 + dfrac_dlogT = 0d0 + end subroutine gamma_eos_frac + + + subroutine gamma_eos_component( & + handle, species, chem_id, net_iso, xa, Rho, logRho, T, logT, & + res, d_dlnd, d_dlnT, d_dxa, ierr) + use chem_lib, only: basic_composition_info + use eos_lib, only: eos_gamma_DT_get + integer, intent(in) :: handle, species + integer, pointer :: chem_id(:), net_iso(:) + real(dp), intent(in) :: xa(:), Rho, logRho, T, logT + real(dp), intent(inout) :: res(:), d_dlnd(:), d_dlnT(:), d_dxa(:,:) + integer, intent(out) :: ierr + real(dp) :: xh, xhe, z, abar, zbar, z2bar, z53bar, ye, & + mass_correction, sumx, Pgas, Prad, energy, entropy + + call basic_composition_info( & + species, chem_id, xa, xh, xhe, z, abar, zbar, z2bar, & + z53bar, ye, mass_correction, sumx) + call eos_gamma_DT_get( & + handle, abar, Rho, logRho, T, logT, gamma_law, res, & + d_dlnd, d_dlnT, Pgas, Prad, energy, entropy, ierr) + d_dxa = 0d0 + end subroutine gamma_eos_component + + + subroutine zero_cgrav(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% cgrav(1:s% nz) = 0d0 + end subroutine zero_cgrav + + + subroutine constant_kap( & + id, k, handle, species, chem_id, net_iso, xa, & + log10_rho, log10_T, lnfree_e, d_lnfree_e_dlnRho, & + d_lnfree_e_dlnT, eta, d_eta_dlnRho, d_eta_dlnT, & + kap_fracs, kap, dln_kap_dlnRho, dln_kap_dlnT, & + dln_kap_dxa, ierr) + use kap_def, only: num_kap_fracs + integer, intent(in) :: id, k, handle, species + integer, pointer :: chem_id(:), net_iso(:) + real(dp), intent(in) :: xa(:), log10_rho, log10_T, lnfree_e, & + d_lnfree_e_dlnRho, d_lnfree_e_dlnT, eta, d_eta_dlnRho, & + d_eta_dlnT + real(dp), intent(out) :: kap_fracs(num_kap_fracs), kap, & + dln_kap_dlnRho, dln_kap_dlnT, dln_kap_dxa(:) + integer, intent(out) :: ierr + + ierr = 0 + kap_fracs = 0d0 + kap = 0.2d0 + dln_kap_dlnRho = 0d0 + dln_kap_dlnT = 0d0 + dln_kap_dxa = 0d0 + end subroutine constant_kap + + + end module run_star_extras diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/Makefile b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/Makefile new file mode 100644 index 0000000000..b03ed21bf2 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/Makefile @@ -0,0 +1 @@ +include $(MESA_DIR)/star/work/Makefile diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/README.rst b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/README.rst new file mode 100644 index 0000000000..a45bb1e410 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/README.rst @@ -0,0 +1,19 @@ +Weak-shock pulse development case +================================= + +This case updates the weak-shock pulse experiment distributed with the +MESA IV supporting inlists. A localized energy source launches a pulse +through a 0.8 Msun white-dwarf envelope using ``u_flag`` hydrodynamics and +time-dependent convection. + +The ``rn`` script runs the original five stages in order: + +#. load and prepare the supplied starting model; +#. remove the central region; +#. settle the envelope with hydrodynamics enabled; +#. inject energy and follow the outgoing pulse; and +#. continue through the weak-shock breakouts. + +The original numerical settings are retained where current MESA has a +direct equivalent. Obsolete inlist controls and ``run_star_extras`` +interfaces use their current forms. diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/ck b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/ck new file mode 100755 index 0000000000..fee50d38aa --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/ck @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# this provides the definition of check_one +# check_one +MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +check_one diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/history_columns.list b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/history_columns.list new file mode 100644 index 0000000000..04b5811600 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/history_columns.list @@ -0,0 +1,1068 @@ +! 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 + !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, including photodisintegrations + power_nuc_burn ! total thermal power from all burning, including 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) ! does not include photodisintegration + Lnuc ! (LH + LHe + LZ) ! does not include photodisintegration + !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 their 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. + + ! individual 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/astero_Teff_sun)^0.5) + !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) diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_edep b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_edep new file mode 100644 index 0000000000..2f72d0a3df --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_edep @@ -0,0 +1,203 @@ + +&star_job + show_log_description_at_start = .false. + + load_saved_model = .true. + load_model_filename = 'mods/ready_to_inject.mod' + + save_model_when_terminate = .true. + save_model_filename = 'mods/ready_to_finish_1d46_v0.mod' + + set_to_this_tau_factor = 1d-3 + set_tau_factor = .true. + + set_initial_dt = .true. + seconds_for_initial_dt = 1d-6 + + set_initial_age = .true. + initial_age = 0 + + set_initial_model_number = .true. + initial_model_number = 0 + + pgstar_flag = .true. + + change_u_flag = .true. + change_initial_u_flag = .true. + new_u_flag = .true. + + + set_initial_cumulative_energy_error = .true. +! set_cumulative_energy_error = .true. + new_cumulative_energy_error = 0d0 + +/ ! end of star_job namelist + +&kap + use_Type2_opacities = .true. + Zbase = 0.02d0 + +/ ! end of kap namelist + +&controls + + initial_mass = 0.8 + initial_z = 0.02 + + + velocity_logT_lower_bound = 0 + calculate_Brunt_N2 = .false. + + max_model_number = 3000 ! 10000 + + max_age_in_seconds = 2d-4 + + ! stop before r_peak reaches surface, in case max_age_in_seconds is set incorrectly + x_ctrl(22) = 7.8d8 ! in cm - r_terminate -- terminate when r_peak > x_ctrl(22) + + + x_logical_ctrl(1) = .true. ! switch BCs when have mass ejection + + x_ctrl(1) = 1d46 ! Other values: 2d46, 6d46, 1.2d47 ! ergs/s for injection + x_ctrl(2) = 1d-4 ! seconds for injection + x_ctrl(3) = 1d-6 ! max_timesteps during injection + x_ctrl(4) = 2d-4 ! max_timesteps after finish injection + + x_ctrl(5) = 7.3475d8 ! r_inject (cm) determines cell for injection + + ! controls for removing surface layer + ! see run_star_extras for details + x_ctrl(17) = 0.5d0 ! remove down to this fraction of v escape + x_ctrl(18) = 0.999999d0 ! only remove if remaining q(k) < this + x_ctrl(19) = 0.99d0 ! only check v/v_esc for q(k) >= this + x_integer_ctrl(20) = 10 ! remove at least this many cells + + ! Tolerance used to measure the pulse width in history output. + x_ctrl(21) = 0.1d0 + + use_other_energy = .true. + + +! enforce v at surface to be zero -- added because of post-shock problems at higher resolution + ! use_fixed_vsurf_outer_BC = .true. + ! fixed_vsurf = 0d0 + + +! equation controls + energy_eqn_option = 'dedt' + use_dPrad_dm_form_of_T_gradient_eqn = .true. + + !use_compression_outer_BC = .true. + use_momentum_outer_BC = .true. + + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + +! mixing controls + mixing_length_alpha = 1.9 + MLT_option = 'TDC' + include_mlt_corr_to_TDC = .false. + thermohaline_coeff = 0 + okay_to_reduce_gradT_excess = .false. + make_gradr_sticky_in_solver_iters = .true. + convergence_ignore_equL_residuals = .true. + use_TDC_enthalpy_flux_limiter = .true. + + max_abs_du_div_cs_for_convection = 1d99 !0.03d0 + max_v_div_cs_for_convection = 1d99 + + TDC_alpha_M = 0d0 !2d0 +! TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation = .true. + TDC_include_eturb_in_energy_equation = .true. + + +report_solver_progress = .true. +! mesh controls + !okay_to_remesh = .false. + okay_to_remesh = .true. + use_split_merge_amr = .true. + split_merge_amr_log_zoning = .false. + split_merge_amr_nz_baseline = 4000 !Was 4000 for most stuff before + split_merge_amr_MaxLong = 1.1d0 + split_merge_amr_MaxShort = 2.5d0 + split_merge_amr_max_iters = 50 + ! merge_amr_inhibit_at_jumps = .true. + !trace_split_merge_amr = .true. + + +! timestep controls + varcontrol_target = 1d-3 + + delta_lgL_limit = 0.05d0 + delta_lgTeff_limit = 0.05d0 + + limit_for_rel_error_in_energy_conservation = 1d-2 !3d-10 + hard_limit_for_rel_error_in_energy_conservation = 1d0 !3d-7 + + dt_div_min_dr_div_cs_limit = 0.45 + min_q_for_dt_div_min_dr_div_cs_limit = 0.005d0 + max_q_for_dt_div_min_dr_div_cs_limit = 1d0 + min_abs_du_div_cs_for_dt_div_min_dr_div_cs_limit = 0.01d0 + + + min_timestep_limit = 1d-12 + +! solver controls + + solver_iters_timestep_limit = 20 ! 10 + solver_max_tries_before_reject = 30 !11 + !iter_for_resid_tol2 = 10 + + tol_residual_norm1 = 1d-9 + tol_max_residual1 = 1d-6 + + tiny_corr_coeff_limit = 999999 + solver_itermin_until_reduce_min_corr_coeff = 999999 + max_resid_jump_limit = 1d99 + +! output controls + max_num_profile_models = 1000 + terminal_show_age_units = 'seconds' + + !num_trace_history_values = 1 + !trace_history_value_name(1) = 'v_surf_div_v_esc' + + + photo_interval = 30 + profile_interval = 5 + history_interval = 1 + terminal_interval = 5 + write_header_frequency = 10 + + !photo_interval = 5 + !profile_interval = 5 + !history_interval = 1 + !terminal_interval = 1 + + + + +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_pgstar' + + + Grid2_win_flag = .true. + + Profile_Panels1_xmax = -101d0 + + !Grid2_title = '0.8 M\d\(2281)\u Z=0.02 RGB' + + Grid2_file_flag = .true. + file_digits = 7 + Grid2_file_dir = 'png' + Grid2_file_prefix = 'grid' + Grid2_file_interval = 5 ! output when mod(model_number,Grid2_file_interval)==0 + + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_finish b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_finish new file mode 100644 index 0000000000..b33039ca44 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_finish @@ -0,0 +1,183 @@ + +&star_job + show_log_description_at_start = .false. + + load_saved_model = .true. + load_model_filename = 'mods/ready_to_finish_1d46_v0.mod' + + save_model_when_terminate = .true. + save_model_filename = 'mods/final.mod' + + set_to_this_tau_factor = 1d-3 + set_tau_factor = .true. + + set_initial_age = .true. + initial_age = 0 + + set_initial_model_number = .true. + initial_model_number = 0 + + set_initial_cumulative_energy_error = .true. + new_cumulative_energy_error = 0 + + pgstar_flag = .true. + +/ ! end of star_job namelist + +&kap + use_Type2_opacities = .true. + Zbase = 0.02d0 + +/ ! end of kap namelist + +&controls + + initial_mass = 0.8 + initial_z = 0.02 + + velocity_logT_lower_bound = 0 + calculate_Brunt_N2 = .false. + + + x_logical_ctrl(1) = .true. ! .true. switch BCs when have mass ejection + x_logical_ctrl(2) = .true. ! set this to true to use a fixed vsurf BC + + ! controls for removing surface layer + ! see run_star_extras for details + x_ctrl(17) = 0.5d0 ! remove down to this fraction of v escape + x_ctrl(18) = 0.999999d0 ! only remove if remaining q(k) < this + x_ctrl(19) = 0.99d0 ! only check v/v_esc for q(k) >= this + x_integer_ctrl(20) = 10 ! remove at least this many cells + + ! Just for history column files that measure pulse energy and width + x_ctrl(21) = 0.1 !tolerance to define pulse width up to (tol*v_peak) + + +! Stopping controls + x_ctrl(22) = 7.82d8 ! in cm - r_terminate -- terminate when r_peak > x_ctrl(22) + max_model_number = 30000 ! Do not let it run forever + max_age_in_seconds = 2d0 + + +! equation controls + energy_eqn_option = 'dedt' + use_dPrad_dm_form_of_T_gradient_eqn = .true. + + use_compression_outer_BC = .false. !.true. + !use_momentum_outer_BC = .false. !.true. + + use_fixed_vsurf_outer_BC = .true. !added because of v_surf problems at high resolution + fixed_vsurf = 0d0 ! enforce v at surface to be zero + + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + +! mixing controls + mixing_length_alpha = 1.9 + MLT_option = 'TDC' + include_mlt_corr_to_TDC = .false. + thermohaline_coeff = 0 + make_gradr_sticky_in_solver_iters = .true. + convergence_ignore_equL_residuals = .true. + use_TDC_enthalpy_flux_limiter = .true. + + + max_abs_du_div_cs_for_convection = 1d99 !0.03d0 + max_v_div_cs_for_convection = 1d99 + + TDC_alpha_M = 0d0 !2d0 +! TDC_alpha_M_use_explicit_mlt_vc_in_momentum_equation = .true. + TDC_include_eturb_in_energy_equation = .true. + + +! mesh controls + !okay_to_remesh = .false. + okay_to_remesh = .true. + use_split_merge_amr = .true. + split_merge_amr_log_zoning = .false. + split_merge_amr_nz_baseline = 8000 ! 2000 + split_merge_amr_MaxLong = 1.1d0 + split_merge_amr_MaxShort = 2.5d0 + split_merge_amr_max_iters = 50 + ! merge_amr_inhibit_at_jumps = .true. + !trace_split_merge_amr = .true. + + +! timestep controls + varcontrol_target = 1d-3 + + delta_lgL_limit = 0.05d0 + delta_lgTeff_limit = 0.05d0 + + limit_for_rel_error_in_energy_conservation = 1d-2 !3d-10 + hard_limit_for_rel_error_in_energy_conservation = 1d0 !3d-7 + + dt_div_min_dr_div_cs_limit = 0.45 + min_q_for_dt_div_min_dr_div_cs_limit = 0.005d0 + max_q_for_dt_div_min_dr_div_cs_limit = 1d0 + min_abs_du_div_cs_for_dt_div_min_dr_div_cs_limit = 0.01d0 + + min_timestep_limit = 1d-12 + max_timestep = 2d-4 ! 1d-2 + +! solver controls + + solver_iters_timestep_limit = 20 ! 10 + solver_max_tries_before_reject = 30!11 + !iter_for_resid_tol2 = 10 + + tol_residual_norm1 = 1d-9 + tol_max_residual1 = 1d-6 + + tiny_corr_coeff_limit = 999999 + solver_itermin_until_reduce_min_corr_coeff = 999999 + max_resid_jump_limit = 1d99 + +! output controls + max_num_profile_models = 1000 + terminal_show_age_units = 'seconds' + + num_trace_history_values = 2 + trace_history_value_name(1) = 'rel_E_err' + trace_history_value_name(2) = 'log_rel_run_E_err' + + + photo_interval = 50 + profile_interval = 50 + history_interval = 1 + terminal_interval = 10 + write_header_frequency = 10 + + !photo_interval = 5 + !profile_interval = 5 + !history_interval = 1 + !terminal_interval = 1 + + + +report_solver_progress = .true. + +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_pgstar' + + + Grid2_win_flag = .true. + + Profile_Panels1_xmax = -101d0 + + !Grid2_title = '0.8 M\d\(2281)\u Z=0.02 RGB' + + Grid2_file_flag = .true. + file_digits = 7 + Grid2_file_dir = 'png' + Grid2_file_prefix = 'grid' + Grid2_file_interval = 25 ! output when mod(model_number,Grid2_file_interval)==0 + + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_pgstar b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_pgstar new file mode 100644 index 0000000000..6fa2729664 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_pgstar @@ -0,0 +1,122 @@ +&pgstar + +Grid1_win_flag = .true. + +!pause = .true. + + + pgstar_xaxis_label_scale = 1.0 + pgstar_left_yaxis_label_scale = 1.0 + pgstar_right_yaxis_label_scale = 1.0 + + + Grid2_win_flag = .true. + !Grid2_title = '25 M\d\(2281)\u Z=0.02 RSG' + + + Grid2_win_width = 7 + Grid2_win_aspect_ratio = 0.75 ! aspect_ratio = height/width + Grid2_num_cols = 2 ! divide plotting region into this many equal width cols + Grid2_num_rows = 5 ! divide plotting region into this many equal height rows + Grid2_num_plots = 2 ! <= 10 + + Grid2_plot_name(1) = 'Profile_Panels1' + Grid2_plot_row(1) = 1 ! number from 1 at top + Grid2_plot_rowspan(1) = 3 ! plot spans this number of rows + Grid2_plot_col(1) = 1 ! number from 1 at left + Grid2_plot_colspan(1) = 2 ! plot spans this number of columns + Grid2_plot_pad_left(1) = -0.02 ! fraction of full window width for padding on left + Grid2_plot_pad_right(1) = 0.09 ! fraction of full window width for padding on right + Grid2_plot_pad_top(1) = -0.02 ! fraction of full window height for padding at top + Grid2_plot_pad_bot(1) = -0.2 ! fraction of full window height for padding at bottom + Grid2_txt_scale_factor(1) = 0.7 ! multiply txt_scale for subplot by this + + Grid2_plot_name(2) = 'Text_Summary1' + Grid2_plot_row(2) = 5 ! number from 1 at top + Grid2_plot_rowspan(2) = 1 ! plot spans this number of rows + Grid2_plot_col(2) = 1 ! number from 1 at left + Grid2_plot_colspan(2) = 2 ! plot spans this number of columns + Grid2_plot_pad_left(2) = -0.08 ! fraction of full window width for padding on left + Grid2_plot_pad_right(2) = 0.0 ! fraction of full window width for padding on right + Grid2_plot_pad_top(2) = 0.1 ! fraction of full window height for padding at top + Grid2_plot_pad_bot(2) = -0.04 ! fraction of full window height for padding at bottom + Grid2_txt_scale_factor(2) = 0.2 ! multiply txt_scale for subplot by this + + ! Grid2_file_flag = .true. + file_digits = 7 + Grid2_file_dir = 'png' + Grid2_file_prefix = 'grid1' + Grid2_file_interval = 10 ! output when mod(model_number,Grid2_file_interval)==0 + + + + Profile_Panels1_win_flag = .false. + Profile_Panels1_title = '' + + Profile_Panels1_xaxis_name = 'radius_cm' + !Profile_Panels1_xaxis_reversed = .false. + Profile_Panels1_xmin = 7.09615d8 ! -101D0 + Profile_Panels1_xmax = -101D0 + Profile_Panels1_show_mix_regions_on_xaxis = .true. + + Profile_Panels1_num_panels = 4 + + Profile_Panels1_yaxis_name(1) = 'v_div_csound' + Profile_Panels1_ymax(1) = -101D0 ! 1 + Profile_Panels1_ymin(1) = -101D0 ! -1 + Profile_Panels1_other_yaxis_name(1) = 'vel_km_per_s' + Profile_Panels1_other_ymax(1) = -101D0 ! 2e6 + Profile_Panels1_other_ymin(1) = -101D0 ! -2e6 + + Profile_Panels1_yaxis_name(2) = 'entropy' + Profile_Panels1_other_yaxis_name(2) = 'opacity' + + Profile_Panels1_yaxis_name(3) = 'logRho' + Profile_Panels1_ymax(3) = -101D0 ! 5.7 + Profile_Panels1_ymin(3) = -101D0 ! 4.2 + Profile_Panels1_other_yaxis_name(3) = 'rho_times_r3' + Profile_Panels1_other_ymax(3) = -101D0 ! 6.45 + Profile_Panels1_other_ymin(3) = -101D0 ! 4 + + Profile_Panels1_yaxis_name(4) = 'conv_vel' + Profile_Panels1_ymax(4) = -101D0 ! 3.7 + Profile_Panels1_ymin(4) = -101D0 ! 3.1 + Profile_Panels1_other_yaxis_name(4) = 'logP' + Profile_Panels1_other_ymax(4) = 21D0 ! 3.7 + Profile_Panels1_other_ymin(4) = 0 ! -101D0 ! 3.1 + + + Profile_Panels1_file_flag = .false. + Profile_Panels1_file_dir = 'png' + Profile_Panels1_file_prefix = 'profile_panels1_' + Profile_Panels1_file_interval = 1 + + Text_Summary1_num_rows = 4 ! <= 20 + Text_Summary1_num_cols = 4 ! <= 20 + Text_Summary1_name(:,:) = '' + + Text_Summary1_name(1,1) = 'model_number' + Text_Summary1_name(2,1) = 'star_age_day' + Text_Summary1_name(3,1) = 'time_step_sec' + Text_Summary1_name(4,1) = 'surf_escape_v' + Text_Summary1_name(5,1) = '' + + Text_Summary1_name(1,2) = 'v_surf_km_s' + Text_Summary1_name(2,2) = 'v_div_csound_surf' + Text_Summary1_name(3,2) = 'radius' + Text_Summary1_name(4,2) = 'log_R' + Text_Summary1_name(5,2) = '' + + Text_Summary1_name(1,3) = 'effective_T' + Text_Summary1_name(2,3) = 'log_Teff' + Text_Summary1_name(3,3) = 'luminosity' + Text_Summary1_name(4,3) = 'log_L' + Text_Summary1_name(5,3) = '' + + Text_Summary1_name(1,4) = 'star_mass' + Text_Summary1_name(2,4) = 'num_zones' + Text_Summary1_name(3,4) = 'num_retries' + Text_Summary1_name(4,4) = 'num_iters' + Text_Summary1_name(5,4) = '' + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_prepare b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_prepare new file mode 100644 index 0000000000..c92f07c02f --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_prepare @@ -0,0 +1,163 @@ + +&star_job + show_log_description_at_start = .false. + + save_model_when_terminate = .true. + save_model_filename = 'mods/ready_to_inject.mod' + + load_saved_model = .true. + load_model_filename = 'mods/removed_core.mod' + + change_initial_u_flag = .true. + change_initial_v_flag = .true. + new_v_flag = .false. + new_u_flag = .true. + + set_initial_dt = .true. + seconds_for_initial_dt = 1d-6 + + set_initial_age = .true. + initial_age = 0 + + pgstar_flag = .true. + + set_initial_cumulative_energy_error = .true. + set_cumulative_energy_error = .true. + new_cumulative_energy_error = 0d0 + +/ ! end of star_job namelist + +&kap + use_Type2_opacities = .true. + Zbase = 0.02d0 + +/ ! end of kap namelist + +&controls + ! initial conditions (ignored for a loaded model) + initial_mass = 0.8 + initial_z = 0.02 + + max_model_number = 100000 + + max_timestep = 1d-2 + max_age_in_seconds = 100. !Allow the model to settle down + velocity_logT_lower_bound = 0 + calculate_Brunt_N2 = .false. + +! equation controls + energy_eqn_option = 'dedt' + use_dPrad_dm_form_of_T_gradient_eqn = .true. + + !use_compression_outer_BC = .true. + use_momentum_outer_BC = .true. + + mix_factor = 0d0 + dxdt_nuc_factor = 0d0 + non_nuc_neu_factor = 0d0 + eps_nuc_factor = 0d0 + + +! mixing controls + mixing_length_alpha = 1.9 + MLT_option = 'TDC' + thermohaline_coeff = 0 + okay_to_reduce_gradT_excess = .false. + +! mesh controls + !okay_to_remesh = .false. + okay_to_remesh = .true. + use_split_merge_amr = .true. + split_merge_amr_log_zoning = .false. + split_merge_amr_nz_baseline = 2000 + split_merge_amr_MaxLong = 1.1d0 + split_merge_amr_MaxShort = 2.5d0 + split_merge_amr_max_iters = 50 + !trace_split_merge_amr = .true. + + +! timestep controls + varcontrol_target = 1d-3 + + delta_lgL_limit = 0.05d0 + delta_lgTeff_limit = 0.05d0 + + limit_for_rel_error_in_energy_conservation = 3d-10 + hard_limit_for_rel_error_in_energy_conservation = 3d-7 + +! solver controls + + solver_iters_timestep_limit = 10 + solver_max_tries_before_reject = 11 + iter_for_resid_tol2 = 10 + + tol_residual_norm1 = 1d-9 + tol_max_residual1 = 1d-6 + + tiny_corr_coeff_limit = 999999 + solver_itermin_until_reduce_min_corr_coeff = 999999 + max_resid_jump_limit = 1d99 + + + +! output controls + + he_core_boundary_h1_fraction = 0.5 + co_core_boundary_he4_fraction = 0.5 + one_core_boundary_he4_c12_fraction = 0.5 + fe_core_boundary_si28_fraction = 0.5 + + max_num_profile_models = 1000 + terminal_show_age_units = 'seconds' + + num_trace_history_values = 0 + trace_history_value_name(1) = 'rel_E_err' + trace_history_value_name(2) = 'log_rel_run_E_err' + + !photo_interval = 1 + !profile_interval = 1 + !history_interval = 1 + !terminal_interval = 1 + + + +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_pgstar' + + Abundance_xaxis_name = 'logxm' + Abundance_xaxis_reversed = .true. + Abundance_xmin = -8 + Abundance_xmax = -3 + + Summary_Burn_xaxis_name = 'logxm' + Summary_Burn_xaxis_reversed = .true. + Summary_Burn_xmin = -8 + Summary_Burn_xmax = -3 + + !Grid2_win_flag = .true. + Grid2_file_flag = .true. + Grid2_file_dir = 'png' + Grid2_file_prefix = 'stabilizing_' + Grid2_file_interval = 1 + + !Grid8_win_flag = .true. + Grid8_win_width = 7 + + Grid8_file_flag = .false. + Grid8_file_dir = 'png' + Grid8_file_prefix = '1.00Msun_Tc_3e7_mdot_1.00e-09_Z0.00_grid8_' + Grid8_file_interval = 1 + Grid8_file_width = -1 + Grid8_file_aspect_ratio = -1 + + + Profile_Panels3_win_flag = .false. + Profile_Panels3_file_flag = .true. + Profile_Panels3_file_dir = 'png/apm' + Profile_Panels3_file_prefix = 'apm_' + Profile_Panels3_file_interval = 1 + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_remove_core b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_remove_core new file mode 100644 index 0000000000..57dd88d16b --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_remove_core @@ -0,0 +1,57 @@ + +&star_job + show_log_description_at_start = .false. + + load_saved_model = .true. + load_model_filename = 'mods/start.mod' + + save_model_when_terminate = .true. + save_model_filename = 'mods/removed_core.mod' + + remove_initial_center_by_radius_cm = 7.1d8 + + pgstar_flag = .false. + + +/ ! end of star_job namelist + +&kap + use_Type2_opacities = .true. + Zbase = 0.02d0 + +/ ! end of kap namelist + +&controls + ! initial conditions (ignored for a loaded model) + initial_mass = 0.8 + initial_z = 0.02 + + ! stopping condition + max_model_number = 5 ! 1000 + + ! ouput + terminal_interval = 1 + write_header_frequency = 10 + photo_interval = 10 + history_interval = 1 + profile_interval = 10 + + ! Things to panic about if they become important + gamma_center_limit = 1000 + + min_timestep_limit = 1d-12 + + ! Convection parameters + mixing_length_alpha = 1.9 + ! use_Ledoux_criterion = .true. + ! alpha_semiconvection = 0.001 + ! thermohaline_coeff = 2 + MLT_option = 'Henyey' + +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_pgstar' + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_start b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_start new file mode 100644 index 0000000000..efa034111a --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/inlist_start @@ -0,0 +1,228 @@ + +&star_job + show_log_description_at_start = .false. + + ! show plots during the run + pgstar_flag = .false. + + ! save final model for future use + save_model_when_terminate = .true. + save_model_filename = 'mods/start.mod' + + ! start from a saved model + load_saved_model = .true. + load_model_filename = 'mods/0.80Msun_Tc_3e7_mdot_1.00e-08.mod' + + ! Rezero all clocks + set_initial_age = .true. + initial_age = 0 + set_initial_model_number = .true. + initial_model_number = 0 + + ! Set outer boundary condition to be at optical depth of 30 + set_to_this_tau_factor = 30 + set_initial_tau_factor = .true. + relax_initial_tau_factor = .true. + relax_to_this_tau_factor = 1 + + ! Allow for at least minimal hydrodynamics (shock treatment probably requires + ! more controls than this) + change_v_flag = .true. + new_v_flag = .true. + + ! Strong Hydrogen burning => good CNO network + new_net_name = 'cno_extras_o18_to_mg26_plus_fe56.net' + change_initial_net = .true. + + auto_extend_net = .false. + +/ ! end of star_job namelist + +&kap + ! this is necessary to get opacities right in metal-enhanced areas + use_Type2_opacities = .true. + Zbase = 0.02d0 + +/ ! end of kap namelist + +&controls + ! initial conditions (ignored for a loaded model) + initial_mass = 0.8 + initial_z = 0.02 + + ! stopping condition + max_model_number = 1 ! 1000 + + ! ouput + terminal_interval = 1 + write_header_frequency = 10 + photo_interval = 10 + history_interval = 1 + profile_interval = 10 + + ! Things to panic about if they become important + gamma_center_limit = 1000 + + min_timestep_limit = 1d-12 + + ! Convection parameters + mixing_length_alpha = 1.9 + ! use_Ledoux_criterion = .true. + ! alpha_semiconvection = 0.001 + ! thermohaline_coeff = 2 + MLT_option = 'TDC' + max_q_for_convection_with_hydro_on = 0.999968377223398d0 + + ! Allow elemental diffusion + do_element_diffusion = .true. + ! as of 9793, this is the default behavior + ! diffusion_use_cgs_solver = .true. + + ! Outer boundary condition; important during mass loss + Pextra_factor = -1 + + ! Accretion rate during quiescence (run_star_extras sets this to zero during + ! a flash and then restores it for you afterwards) + mass_change = 1d-10 + + ! Primary mass loss mechanism: super Eddington winds + super_eddington_scaling_factor = 1 + super_eddington_wind_Ledd_factor = 1 + + mass_change_full_on_dt = 1d-06 + mass_change_full_off_dt = 1d-06 + + ! fallback mass loss: Roche lobe overflow starting at radius of 1 Rsun + rlo_scaling_factor = 1 + rlo_wind_min_L = 1000 + rlo_wind_max_Teff = 300000 + rlo_wind_roche_lobe_radius = 1 + rlo_wind_base_mdot = 1d-07 + rlo_wind_scale_height = 1 + + ! shut off accretion when R/R_L > 0.8 (redundant with run_star_extras...) + roche_lobe_xfer_full_off = 0.8 + + ! set composition of accreted material + accrete_same_as_surface = .false. + accrete_given_mass_fractions = .false. + accretion_h1 = 7d-1 + accretion_he3 = 5d-4 + accretion_he4 = 2.795d-1 + accretion_zfracs = 4 + + ! you can be really anal about how to specify accreted material + ! accretion_species_id(1) = 'h1' + ! accretion_species_id(2) = 'he3' + ! accretion_species_id(3) = 'he4' + ! accretion_species_id(4) = 'c12' + ! accretion_species_id(5) = 'c13' + ! accretion_species_id(6) = 'n13' + ! accretion_species_id(7) = 'n14' + ! accretion_species_id(8) = 'n15' + ! accretion_species_id(9) = 'o14' + ! accretion_species_id(10) = 'o15' + ! accretion_species_id(11) = 'o16' + ! accretion_species_id(12) = 'o17' + ! accretion_species_id(13) = 'o18' + ! accretion_species_id(14) = 'f17' + ! accretion_species_id(15) = 'f18' + ! accretion_species_id(16) = 'f19' + ! accretion_species_id(17) = 'ne18' + ! accretion_species_id(18) = 'ne19' + ! accretion_species_id(19) = 'ne20' + ! accretion_species_id(20) = 'ne22' + ! accretion_species_id(21) = 'mg22' + ! accretion_species_id(22) = 'mg24' + ! accretion_species_id(23) = 'mg26' + ! accretion_species_id(24) = 'fe56' + ! accretion_species_xa(1) = 0.7 + ! accretion_species_xa(2) = 5.21387d-05 + ! accretion_species_xa(3) = 0.279971 + ! accretion_species_xa(4) = 0.00375441 + ! accretion_species_xa(5) = 4.55587d-05 + ! accretion_species_xa(6) = 0 + ! accretion_species_xa(7) = 0.00121563 + ! accretion_species_xa(8) = 4.7882d-06 + ! accretion_species_xa(9) = 0 + ! accretion_species_xa(10) = 0 + ! accretion_species_xa(11) = 0.0100818 + ! accretion_species_xa(12) = 3.99609d-06 + ! accretion_species_xa(13) = 2.27405d-05 + ! accretion_species_xa(14) = 0 + ! accretion_species_xa(15) = 0 + ! accretion_species_xa(16) = 7.14171d-07 + ! accretion_species_xa(17) = 0 + ! accretion_species_xa(18) = 0 + ! accretion_species_xa(19) = 0.00178399 + ! accretion_species_xa(20) = 0.000144328 + ! accretion_species_xa(21) = 0 + ! accretion_species_xa(22) = 0.000864143 + ! accretion_species_xa(23) = 0.000130483 + ! accretion_species_xa(24) = 0.00192424 + + ! might need this if you go to higher resolution (mesh_delta_coeff < 1.0) + ! max_allowed_nz = 20000 + mesh_delta_coeff = 1.0 + + ! make remesher care more about changes in h1 and he4 abundances + xa_function_species(1) = 'h1' + xa_function_species(2) = 'he4' + xa_function_weight(1) = 20 + xa_function_weight(2) = 20 + + xa_function_param(1) = 1d-06 + xa_function_param(2) = 0.01 + + ! make timesteps bigger and cut down on retries at the expense of + ! sloppier convergence + tol_max_correction = 0.03 + + ! shrink this to get finer time resolution during "happy" times + varcontrol_target = 1e-3 + + ! set limits on how much different quantities can change between timesteps + delta_lgRho_limit = 1 + delta_lgRho_hard_limit = -1 + + delta_lgT_limit = 0.5 + + delta_lgL_H_limit = 0.1 + delta_lgL_H_hard_limit = 0.5 + lgL_H_burn_min = 1 + + delta_lgL_He_limit = 0.25 + + lgL_He_burn_min = 2.5 + + delta_lgTeff_limit = 0.1 + + delta_lgL_limit = 0.05 + +/ ! end of controls namelist + +&pgstar + read_extra_pgstar_inlist(1) = .true. + extra_pgstar_inlist_name(1) = 'inlist_pgstar' + + Abundance_xaxis_name = 'logxm' + Abundance_xaxis_reversed = .true. + Abundance_xmin = -8 + Abundance_xmax = -3 + + Summary_Burn_xaxis_name = 'logxm' + Summary_Burn_xaxis_reversed = .true. + Summary_Burn_xmin = -8 + Summary_Burn_xmax = -3 + + Grid8_win_flag = .true. + Grid8_win_width = 7 + + Grid8_file_flag = .false. + Grid8_file_dir = 'png' + Grid8_file_prefix = '1.00Msun_Tc_3e7_mdot_1.00e-09_Z0.00_grid8_' + Grid8_file_interval = 1 + Grid8_file_width = -1 + Grid8_file_aspect_ratio = -1 + +/ ! end of pgstar namelist diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/0.80Msun_Tc_3e7_mdot_1.00e-08.mod b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/0.80Msun_Tc_3e7_mdot_1.00e-08.mod new file mode 100644 index 0000000000..cc4891e384 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/0.80Msun_Tc_3e7_mdot_1.00e-08.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2014bf6e5c0f407a038f6359743d854bf46795e172cd1c8a3bef4b746aea53c +size 10198889 diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/ready_to_finish_1d46_v0.mod b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/ready_to_finish_1d46_v0.mod new file mode 100644 index 0000000000..54ccc27306 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/ready_to_finish_1d46_v0.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58c8001d92be4743b7c7cdd967b38f63e4ee8b3a15512b7dcf9d0a0d87b08842 +size 4506007 diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/ready_to_inject.mod b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/ready_to_inject.mod new file mode 100644 index 0000000000..cc04cb3070 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/ready_to_inject.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:882fc803256b79b2bcaeb9e5f9d5a93260c787ae85db31bd335fb0106359feeb +size 1438850 diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/removed_core.mod b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/removed_core.mod new file mode 100644 index 0000000000..afd7d598a7 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/removed_core.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:36b68b3de59640310c3afd2786c67b6b576fd37563c9c7c26cad956f8581ab86 +size 613412 diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/start.mod b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/start.mod new file mode 100644 index 0000000000..b4fc16df9f --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/mods/start.mod @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:80903f4beb68d3030615f1507faec1a8e3aa90c588decc59be23a211de987320 +size 1503207 diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/profile_columns.list b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/profile_columns.list new file mode 100644 index 0000000000..170aab09f9 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/profile_columns.list @@ -0,0 +1,984 @@ +! 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 + !psi_roche ! dimensionless Roche potential at outer boundary of zone (only works if in a binary model and b% use_tidal_deformation is used; else is -99) + !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 + !flux_limit_lambda ! flux limiter defined as in Levermore & Pomraning 1981 + !flux_limit_R ! flux ratio defined as in Levermore & Pomraning 1981 + + !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 their 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 ! cell specific work per unit time, Work = dwork_dm*dm*dt + + !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 ! grada-gradT at cell boundary + !gradT_sub_grada ! gradT-grada at cell boundary + !gradT_div_grada ! gradT/grada at cell boundary + + !gradr_sub_gradT ! gradr-gradT at cell boundary + !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 ! gradL-gradr at cell boundary + !gradP_div_rho ! finite difference (deltaP/deltam)* 4*pi*r^2, at cell boundary + !gradT_excess_effect ! 1 - alpha, where alpha is the gradT_excess_alpha from mlt++ + !gradT_rel_err ! gradT - actual_gradT / gradT, actual_gradT = deltaT/deltaP from finite difference + !gradT_sub_a ! same as gradT_sub_grada ! gradT-grada at cell boundary + !grada_face ! grada at cell boundary + !grada_sub_gradr ! grada-gradr at cell boundary + !diff_grads ! gradr - gradL at cell boundary + !log_diff_grads ! log10(diff_grads) + + !mlt_D ! The chemical diffusion coefficient (cm^2/s) + !mlt_Gamma ! The convective efficiency parameter from the mlt equation, Gamma=(grad-gradE)/(gradE-gradL) + mlt_Y_face ! The superadiabaticity Y = dlnT/dlnP - grada, or dlnT/dlnP - gradL at cell boundary + !mlt_Zeta ! convective efficiency as Zeta = (gradr-gradT)/(gradr-grada) + !mlt_gradT ! same as gradT, mlt/TDC value for dlnT/dlnP. + !mlt_log_abs_Y ! log10(abs(Y_face)) + !mlt_vc ! convective velocity from mlt/TDC in cm/s + !log_mlt_vc ! log10(mlt_vc) + !dvc_dt_TDC_div_g ! dimensionless ratio of convective velocity to g + + !superad_reduction_factor ! gamma_factor from superad_reduction + !conv_vel_div_mlt_vc ! conv_vel from any convection model (including RSP) / mlt_vc, for comparison + + !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 + !Riemann_shock_compression ! max(0, (u_inner-u_outer)/cs_face) + !Riemann_shock_pressure_jump ! max(0, P_face/min(P_inner,P_outer) - 1) + !Riemann_shock_strength ! minimum of compression and pressure jump + !Riemann_shock_D_mix_factor ! factor applied to final chemical D_mix + !Uq + !Y_face + + !reconstructed_T_face + !reconstructed_rho_face + !reconstructed_P_face + !reconstructed_Cp_face + !reconstructed_ChiRho_face + !reconstructed_ChiT_face + !reconstructed_grada_face + !reconstructed_opacity_face + !reconstructed_scale_height_face + !reconstructed_gradr_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 ! gravity = -grav = -Gm/r^2 + !grav_eff ! effective gravity = -(grav - dvdt) + + !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_test_TDC/dev_TDC_weak_shocks/re b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/re new file mode 100755 index 0000000000..7093783a31 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/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_test_TDC/dev_TDC_weak_shocks/rn b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn new file mode 100755 index 0000000000..c5c15a5eb6 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# this provides the definition of do_one (run one part of test) +# do_one [inlist] [output model] [LOGS directory] +MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +mkdir -p mods + +do_one inlist_start mods/start.mod LOGS_start +do_one inlist_remove_core mods/removed_core.mod LOGS_remove_core +do_one inlist_prepare mods/ready_to_inject.mod LOGS_prepare +do_one inlist_edep mods/ready_to_finish_1d46_v0.mod LOGS_edep +do_one inlist_finish mods/final.mod LOGS_finish + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +echo 'finished' diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn1 b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn1 new file mode 100755 index 0000000000..f4ce7695fe --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn1 @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +rm -f restart_photo + +make run diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn_last b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn_last new file mode 100755 index 0000000000..8b1b1eab65 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/rn_last @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# this provides the definition of do_one (run one part of test) +# do_one [inlist] [output model] [LOGS directory] +MESA_DIR=../../.. +source "${MESA_DIR}/star/test_suite/test_suite_helpers" + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +mkdir -p mods + +#do_one inlist_start mods/start.mod LOGS_start +#do_one inlist_remove_core mods/removed_core.mod LOGS_remove_core +#do_one inlist_prepare mods/ready_to_inject.mod LOGS_prepare +do_one inlist_edep mods/ready_to_finish_1d46_v0.mod LOGS_edep +do_one inlist_finish mods/final.mod LOGS_finish + +date "+DATE: %Y-%m-%d%nTIME: %H:%M:%S" + +echo 'finished' diff --git a/star/dev_cases_test_TDC/dev_TDC_weak_shocks/src/run.f90 b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/src/run.f90 new file mode 100644 index 0000000000..76d423f1af --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/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_test_TDC/dev_TDC_weak_shocks/src/run_star_extras.f90 b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/src/run_star_extras.f90 new file mode 100644 index 0000000000..1ccf4f6008 --- /dev/null +++ b/star/dev_cases_test_TDC/dev_TDC_weak_shocks/src/run_star_extras.f90 @@ -0,0 +1,575 @@ +! *********************************************************************** +! +! Copyright (C) 2010 Bill Paxton +! +! this file is part of mesa. +! +! mesa is free software; you can redistribute it and/or modify +! it under the terms of the gnu general library public license as published +! by the free software foundation; either version 2 of the license, or +! (at your option) any later version. +! +! mesa 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 library general public license for more details. +! +! you should have received a copy of the gnu library general public license +! along with this software; if not, write to the free software +! foundation, inc., 59 temple place, suite 330, boston, ma 02111-1307 usa +! +! *********************************************************************** + + module run_star_extras + + use star_lib + use star_def + use const_def + use math_lib + use auto_diff + + implicit none + + integer :: time0, time1, clock_rate, num_breakouts + logical :: currently_in_breakout + + real(dp) :: injection_eps, injection_L, run_total_e, fixed_surface_L + + + contains + + + 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 + s% other_energy => energy_dep + s% other_surface_PT => fixed_L_surface_PT + end subroutine extras_controls + + + subroutine energy_dep(id, ierr) + integer, intent(in) :: id + integer, intent(out) :: ierr + type (star_info), pointer :: s + integer :: k, nz + real(dp) :: r_inject + include 'formats' + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + injection_eps = 0d0 + injection_L = 0d0 + if (s% time >= s% x_ctrl(2) .or. s% x_ctrl(1) <= 0d0) then ! finished injection + if (s% max_timestep /= s% x_ctrl(4)) then + s% max_timestep = s% x_ctrl(4) + write(*,1) 'overwrite max_timestep, log10', & + s% max_timestep, safe_log10(s% max_timestep) + end if + return + end if + nz = s% nz + r_inject = s% x_ctrl(5) + do k=1,nz-1 + if (s% r(k+1) < r_inject .and. r_inject <= s% r(k)) then + injection_eps = s% x_ctrl(1)/s% dm(k) + injection_L = s% x_ctrl(1) + s% extra_heat(k) = injection_eps + exit + end if + end do + if (injection_L == 0d0) then + write(*,*) 'failed to find specified r_inject in model', r_inject + ierr = -1 + return + end if + end subroutine energy_dep + + + 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 system_clock(time0,clock_rate) + injection_eps = 0d0 + injection_L = 0d0 + if (.not. restart) then + run_total_e = 0d0 + fixed_surface_L = s% L(1) + num_breakouts = 0 + currently_in_breakout = .false. + call alloc_extra_info(s) + else ! it is a restart + call unpack_extra_info(s) + end if + if (s% x_logical_ctrl(1)) call switch_BCs(s) + if (s% use_other_energy .and. s% x_ctrl(2) > 0d0) then + s% max_timestep = s% x_ctrl(3) + write(*,1) 'overwrite max_timestep, log10', & + s% max_timestep, safe_log10(s% max_timestep) + end if + end subroutine extras_startup + + + subroutine switch_BCs(s) + type (star_info), pointer :: s + s% use_other_surface_PT = .true. + if (s% x_logical_ctrl(2)) then + s% use_compression_outer_BC = .false. + s% use_momentum_outer_BC = .false. + s% use_fixed_vsurf_outer_BC = .true. + else + s% use_compression_outer_BC = .true. + s% use_momentum_outer_BC = .false. + s% use_fixed_vsurf_outer_BC = .false. + end if + end subroutine switch_BCs + + + subroutine fixed_L_surface_PT(id, & + skip_partials, & + lnT_surf, dlnT_dL, dlnT_dlnR, dlnT_dlnM, dlnT_dlnkap, & + lnP_surf, dlnP_dL, dlnP_dlnR, dlnP_dlnM, dlnP_dlnkap, ierr) + integer, intent(in) :: id + logical, intent(in) :: skip_partials + real(dp), intent(out) :: & + lnT_surf, dlnT_dL, dlnT_dlnR, dlnT_dlnM, dlnT_dlnkap, & + lnP_surf, dlnP_dL, dlnP_dlnR, dlnP_dlnM, dlnP_dlnkap + integer, intent(out) :: ierr + type (star_info), pointer :: s + + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + if (fixed_surface_L <= 0d0 .or. s% r(1) <= 0d0) then + if (s% report_ierr) write(*,*) 'invalid fixed-L surface state' + ierr = -1 + return + end if + + ! Hold L fixed while the black-body temperature follows the surface radius. + lnT_surf = 0.25d0*log(fixed_surface_L/(pi4*boltz_sigma*pow2(s% r(1)))) + dlnT_dL = 0d0 + dlnT_dlnR = -0.5d0 + dlnT_dlnM = 0d0 + dlnT_dlnkap = 0d0 + + lnP_surf = s% lnPeos(1) + dlnP_dL = 0d0 + dlnP_dlnR = 0d0 + dlnP_dlnM = 0d0 + dlnP_dlnkap = 0d0 + end subroutine fixed_L_surface_PT + + + 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(2)) return + call system_clock(time1,clock_rate) + dt = dble(time1 - time0) / clock_rate / 60 + if (.not. currently_in_breakout .and. num_breakouts == 3 .and. & + abs(s% time - s% max_age_in_seconds) < 1d-6) then + write(*,*) 'did 3 shock breakouts' + else + write(*,*) 'ERROR: failed to do 3 shock breakouts' + end if + write(*,'(/,a50,f12.2,99i10/)') 'runtime (minutes), retries, steps', & + dt, s% num_retries, s% model_number + ierr = 0 + end subroutine extras_after_evolve + + + ! returns either keep_going, retry, or terminate. + integer function extras_check_model(id) + integer, intent(in) :: id + integer :: ierr + type (star_info), pointer :: s + 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 + if (s% use_other_energy) then + how_many_extra_history_columns = 34 + else if (s% x_logical_ctrl(1)) then ! doing inlist_final + how_many_extra_history_columns = 31 + else + how_many_extra_history_columns = 0 + end if + 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) + integer, intent(out) :: ierr + type (star_info), pointer :: s + real(dp), pointer :: v(:) + real(dp) :: r_peak, tol + real(dp) :: dr_peak, energy_result + integer :: k_peak, k_front, k_back, k + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + if (.not. (s% x_logical_ctrl(1) .or. s% use_other_energy)) return + if (s% u_flag) then + v => s% u + else + v => s% v + end if + k_peak = maxloc(v(1:s% nz), dim=1) + r_peak = s% r(k_peak) + names(1) = 'r_peak_u' + names(2) = 'r_peak' + names(3) = 'r_peak_cs' + names(4) = 'r_peak_u_div_cs' + names(5) = 'r_peak_log' + names(6) = 'r_peak_rho' + names(7) = 'r_peak_T' + names(8) = 'r_peak_gamma1' + names(9) = 'r_peak_P' + names(10) = 'r_peak_entropy' + names(11) = 'r_peak_Cp' + names(12) = 'r_peak_Cv' + names(13) = 'r_peak_L' + names(14) = 'r_peak_m' + vals(1) = v(k_peak) + vals(2) = r_peak + vals(3) = s% csound(k_peak) + vals(4) = v(k_peak)/s% csound(k_peak) + vals(5) = safe_log10(r_peak) + vals(6) = s% rho(k_peak) + vals(7) = s% T(k_peak) + vals(8) = s% gamma1(k_peak) + vals(9) = s% Peos(k_peak) + vals(10) = s% entropy(k_peak)*kerg*avo + vals(11) = s% Cp(k_peak) + vals(12) = s% Cv(k_peak) + vals(13) = s% L(k_peak) + vals(14) = s% m(k_peak) + + + tol = s% x_ctrl(21) + k_back = k_peak + do while ((v(k_back) > v(k_peak)*tol) .and. (k_back < s% nz)) + k_back = k_back + 1 + end do + k_front = k_peak + do while (v(k_front) > v(k_peak)*tol .and. (k_front> 1)) + k_front = k_front - 1 + enddo + + dr_peak = s% r(k_front) - s% r(k_back) + energy_result = 0d0 + do k = k_front, k_back + energy_result = energy_result + 0.5*v(k)*v(k)* s% dm(k) + end do + names(15) = 'pulse_dr' + vals(15) = dr_peak + names(16) = 'pulse_KE' + vals(16) = energy_result ! = 2 Pi r^2 rho v^2 dr !1/2 v^2 dm + + names(17) = 'pre_shock_u' + names(18) = 'r_front' + names(19) = 'k_peak_minus_k_front' + names(20) = 'pre_shock_cs' + names(21) = 'pre_shock_m' + names(22) = 'pre_shock_rho' + names(23) = 'pre_shock_T' + names(24) = 'pre_shock_gamma1' + names(25) = 'pre_shock_P' + names(26) = 'pre_shock_entropy' + names(27) = 'pre_shock_Cp' + names(28) = 'pre_shock_Cv' + names(29) = 'pre_shock_L' + + names(30) = 'r_front_minus_r_peak' + names(31) = 'shock_deltaS' + + vals(17) = v(k_front) + vals(18) = s%r(k_front) + vals(19) = k_peak - k_front + vals(20) = s% csound(k_front) + vals(21) = s% m(k_front) + vals(22) = s% rho(k_front) + vals(23) = s% T(k_front) + vals(24) = s% gamma1(k_front) + vals(25) = s% Peos(k_front) + vals(26) = s% entropy(k_front)*kerg*avo + vals(27) = s% Cp(k_front) + vals(28) = s% Cv(k_front) + vals(29) = s% L(k_front) + vals(30) = s% r(k_front) - s% r(k_peak) ! This is v_peak/c_sound_shock_front + vals(31) = s% entropy(k_peak) - s% entropy(k_front) + + if (.not. s% use_other_energy) return + names(32) = 'heating_L_div_Lsun' + vals(32) = injection_L/Lsun + names(33) = 'heating_run_etot' + vals(33) = run_total_e + names(34) = 'heating_eps' + vals(34) = injection_eps + + 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 = 0 + 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 + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + end subroutine data_for_extra_profile_columns + + + integer function extras_start_step(id) + integer, intent(in) :: id + integer :: ierr + type (star_info), pointer :: s + integer :: k, k0, k1 + real(dp) :: v_esc + include 'formats' + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + extras_start_step = keep_going + if (.not. s% x_logical_ctrl(1) .or. .not. s% u_flag) return + k0 = s% nz+1 + do k = 1, s% nz + v_esc = sqrt(2*s% cgrav(k)*s% m(k)/(s% r(k))) + if (s% q(k) < s% x_ctrl(19)) exit ! only check outer layer + if (s% u(k) > v_esc) then + k0 = k + exit + end if + end do + if (k0 >= s% nz) return + ! k0 is location below surface with u > escape velocity. + ! remove inward from k0 where u large enough compared to escape velocity. + k1 = k0 + do k = k0+1, s% nz + v_esc = sqrt(2*s% cgrav(k)*s% m(k)/(s% r(k))) + if (s% u(k) < s% x_ctrl(17)*v_esc) then ! stop removing here + k1 = k-1 + exit + end if + end do + if (s% q(k1) > s% x_ctrl(18)) return + k1 = min(s% nz - 1, max(k1, s% x_integer_ctrl(20))) + do while (k1 < s% nz) + if (s% L(k1) > 0d0) exit + k1 = k1 + 1 + end do + if (k1 >= s% nz .or. s% L(k1) <= 0d0) return + write(*,3) 'eject: model, k, delta, M_new, M_old', s% model_number, k1, & + (s% m(1) - s% m(k1))/Msun, sum(s% dm(1:k1))/Msun + extras_start_step = terminate + call star_remove_surface_at_cell_k(s% id, k1, ierr) + if (ierr /= 0) return + if (s% x_logical_ctrl(1)) then + fixed_surface_L = s% L(1) + call switch_BCs(s) + end if + extras_start_step = keep_going + end function extras_start_step + + + ! returns either keep_going or terminate. + integer function extras_finish_step(id) + integer, intent(in) :: id + integer :: ierr + integer :: k_peak + real(dp) :: r_peak + real(dp), pointer :: v(:) + type (star_info), pointer :: s + ierr = 0 + call star_ptr(id, s, ierr) + if (ierr /= 0) return + extras_finish_step = keep_going + ! Count injected energy once per accepted step, not for each other_energy call. + if (s% use_other_energy) run_total_e = run_total_e + s% total_extra_heating + if (s% x_logical_ctrl(1)) then + call switch_BCs(s) + if (currently_in_breakout) then + if (s% u(1) < s% csound(1)) currently_in_breakout = .false. + else ! not currently_in_breakout + if (s% u(1) >= s% csound(1)) then + num_breakouts = num_breakouts + 1 + currently_in_breakout = .true. + end if + end if + end if + + if (s% u_flag) then + v => s% u + else + v => s% v + end if + k_peak = maxloc(v(1:s% nz), dim=1) + r_peak = s% r(k_peak) + + if ((r_peak > s% x_ctrl(22)) .and. (s% x_logical_ctrl(2))) then + write(*,*) 'terminating because r_peak > r_peak_max' + extras_finish_step = terminate + call store_extra_info(s) + return + end if + call store_extra_info(s) + end function extras_finish_step + + + ! routines for saving and restoring extra data so can do restarts + + ! put these defs at the top and delete from the following routines + !integer, parameter :: extra_info_alloc = 1 + !integer, parameter :: extra_info_get = 2 + !integer, parameter :: extra_info_put = 3 + + + subroutine alloc_extra_info(s) + integer, parameter :: extra_info_alloc = 1 + type (star_info), pointer :: s + call move_extra_info(s,extra_info_alloc) + end subroutine alloc_extra_info + + + subroutine unpack_extra_info(s) + integer, parameter :: extra_info_get = 2 + type (star_info), pointer :: s + call move_extra_info(s,extra_info_get) + end subroutine unpack_extra_info + + + subroutine store_extra_info(s) + integer, parameter :: extra_info_put = 3 + type (star_info), pointer :: s + call move_extra_info(s,extra_info_put) + end subroutine store_extra_info + + + subroutine move_extra_info(s,op) + integer, parameter :: extra_info_alloc = 1 + integer, parameter :: extra_info_get = 2 + integer, parameter :: extra_info_put = 3 + type (star_info), pointer :: s + integer, intent(in) :: op + + integer :: i, num_ints, num_dbls, ierr + + i = 0 + ! call move_int or move_flg + call move_flg(currently_in_breakout) + call move_int(num_breakouts) + num_ints = i + + i = 0 + ! call move_dbl + call move_dbl(run_total_e) + call move_dbl(fixed_surface_L) + + num_dbls = i + + if (op /= extra_info_alloc) return + if (num_ints == 0 .and. num_dbls == 0) return + + ierr = 0 + call star_alloc_extras(s% id, num_ints, num_dbls, ierr) + if (ierr /= 0) then + write(*,*) 'failed in star_alloc_extras' + write(*,*) 'alloc_extras num_ints', num_ints + write(*,*) 'alloc_extras num_dbls', num_dbls + call mesa_error(__FILE__,__LINE__) + end if + + contains + + subroutine move_dbl(dbl) + real(dp) :: dbl + i = i+1 + select case (op) + case (extra_info_get) + dbl = s% extra_work(i) + case (extra_info_put) + s% extra_work(i) = dbl + end select + end subroutine move_dbl + + subroutine move_int(int) + integer :: int + i = i+1 + select case (op) + case (extra_info_get) + int = s% extra_iwork(i) + case (extra_info_put) + s% extra_iwork(i) = int + end select + end subroutine move_int + + subroutine move_flg(flg) + logical :: flg + i = i+1 + select case (op) + case (extra_info_get) + flg = (s% extra_iwork(i) /= 0) + case (extra_info_put) + if (flg) then + s% extra_iwork(i) = 1 + else + s% extra_iwork(i) = 0 + end if + end select + end subroutine move_flg + + end subroutine move_extra_info + + end module run_star_extras diff --git a/star/private/ctrls_io.f90 b/star/private/ctrls_io.f90 index 148e783e67..1f2e76ad0e 100644 --- a/star/private/ctrls_io.f90 +++ b/star/private/ctrls_io.f90 @@ -113,6 +113,7 @@ module ctrls_io 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, & + Riemann_shock_D_mix_reduction_on, Riemann_shock_D_mix_reduction_full_on, & use_face_reconstruction, & TDC_include_eturb_in_energy_equation, & use_rsp_form_of_scale_height, include_mlt_in_velocity_time_centering, & @@ -671,6 +672,15 @@ subroutine check_controls(s, ierr) return end if + if (s% Riemann_shock_D_mix_reduction_full_on > 0d0 .and. & + (s% Riemann_shock_D_mix_reduction_on < 0d0 .or. & + s% Riemann_shock_D_mix_reduction_on >= & + s% Riemann_shock_D_mix_reduction_full_on)) then + write(*,'(a)') 'Riemann shock D_mix reduction requires 0 <= onset < full_on' + ierr = -1 + return + end if + if (.not. (trim(s% energy_eqn_option) == 'dedt' .or. trim(s% energy_eqn_option) == 'eps_grav')) then write(*,'(A)') write(*,*) "Invalid choice for energy_eqn_option" @@ -2115,6 +2125,8 @@ subroutine store_controls(s) 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% Riemann_shock_D_mix_reduction_on = Riemann_shock_D_mix_reduction_on + s% Riemann_shock_D_mix_reduction_full_on = Riemann_shock_D_mix_reduction_full_on s% use_face_reconstruction = use_face_reconstruction 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 @@ -3846,6 +3858,8 @@ 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 + Riemann_shock_D_mix_reduction_on = s% Riemann_shock_D_mix_reduction_on + Riemann_shock_D_mix_reduction_full_on = s% Riemann_shock_D_mix_reduction_full_on use_face_reconstruction = s% use_face_reconstruction 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_riemann.f90 b/star/private/hydro_riemann.f90 index 13308d3708..4e65cacae2 100644 --- a/star/private/hydro_riemann.f90 +++ b/star/private/hydro_riemann.f90 @@ -43,7 +43,8 @@ module hydro_riemann private public :: do_surf_Riemann_dudt_eqn, do1_Riemann_momentum_eqn, & - do_uface_and_Pface, get_RTI_momentum_diffusion + do_uface_and_Pface, get_Riemann_shock_diagnostics, & + get_RTI_momentum_diffusion ! Riemann energy eqn is now part of the standard energy equation ! Riemann dlnR_dt rqn is now part of the standard radius equation @@ -337,6 +338,91 @@ subroutine get_G(s, k, G) end subroutine get_G + subroutine get_Riemann_shock_diagnostics( & + s, k, compression, pressure_jump, shock_strength, D_mix_factor, ierr) + use math_lib, only: pow3 + use star_utils, only: calc_Ptot_ad_tw + type (star_info), pointer :: s + integer, intent(in) :: k + real(dp), intent(out) :: & + compression, pressure_jump, shock_strength, D_mix_factor + integer, intent(out) :: ierr + + type(auto_diff_real_star_order1) :: & + r_ad, area_ad, PL_ad, PR_ad, G_ad, dPdm_grav_ad, & + csL_ad, csR_ad + real(dp), dimension(s% species) :: d_Ptot_dxa + real(dp) :: cs_face, P_face, P_min, onset, full_on, reduction, x + real(dp) :: delta_m, uL, uR, rhoL, rhoR, Sl, Sr, Ss + real(dp) :: numerator, denominator, P_face_L, P_face_R + logical, parameter :: skip_Peos = .false., skip_mlt_Pturb = .false. + + ierr = 0 + compression = 0d0 + pressure_jump = 0d0 + shock_strength = 0d0 + D_mix_factor = 1d0 + if (.not. s% u_flag .or. k <= 1 .or. k > s% nz) return + + call calc_Ptot_ad_tw(s, k, skip_Peos, skip_mlt_Pturb, & + PL_ad, d_Ptot_dxa, ierr) + if (ierr /= 0) return + call calc_Ptot_ad_tw(s, k-1, skip_Peos, skip_mlt_Pturb, & + PR_ad, d_Ptot_dxa, ierr) + if (ierr /= 0) return + PR_ad = shift_m1(PR_ad) + + if (PL_ad%val <= 0d0 .or. PR_ad%val <= 0d0) return + csL_ad = sqrt(wrap_gamma1_00(s,k)*PL_ad/wrap_d_00(s,k)) + csR_ad = sqrt(wrap_gamma1_m1(s,k)*PR_ad/wrap_d_m1(s,k)) + cs_face = 0.5d0*(csL_ad%val + csR_ad%val) + if (cs_face <= 0d0 .or. is_bad(cs_face)) return + uL = s% u(k) + uR = s% u(k-1) + rhoL = s% rho(k) + rhoR = s% rho(k-1) + Sl = min(uL - csL_ad%val, uR - csR_ad%val) + Sr = max(uR + csR_ad%val, uL + csL_ad%val) + + r_ad = wrap_r_00(s,k) + area_ad = 4d0*pi*pow2(r_ad) + call get_G(s, k, G_ad) + dPdm_grav_ad = -G_ad*s% m_grav(k)/(pow2(r_ad)*area_ad) + + delta_m = 0.5d0*s% dm(k) + PL_ad = PL_ad + delta_m*dPdm_grav_ad + delta_m = -0.5d0*s% dm(k-1) + PR_ad = PR_ad + delta_m*dPdm_grav_ad + + if (PL_ad%val <= 0d0 .or. PR_ad%val <= 0d0) return + + numerator = uR*rhoR*(Sr-uR) + uL*rhoL*(uL-Sl) + & + (PL_ad%val - PR_ad%val) + denominator = rhoR*(Sr-uR) + rhoL*(uL-Sl) + if (denominator == 0d0 .or. is_bad(denominator)) return + Ss = numerator/denominator + + P_face_L = rhoL*(uL-Sl)*(uL-Ss) + PL_ad%val + P_face_R = rhoR*(uR-Sr)*(uR-Ss) + PR_ad%val + P_face = 0.5d0*(P_face_L + P_face_R) + if (P_face <= 0d0 .or. is_bad(P_face)) return + + compression = max(0d0, (uL-uR)/cs_face) + P_min = min(PL_ad%val, PR_ad%val) + pressure_jump = max(0d0, P_face/P_min - 1d0) + shock_strength = min(compression, pressure_jump) + + onset = s% Riemann_shock_D_mix_reduction_on + full_on = s% Riemann_shock_D_mix_reduction_full_on + if (full_on <= onset .or. shock_strength <= onset) return + + x = min(1d0, (shock_strength-onset)/(full_on-onset)) + reduction = pow3(x)*(10d0 + x*(-15d0 + 6d0*x)) + D_mix_factor = 1d0 - reduction + + end subroutine get_Riemann_shock_diagnostics + + subroutine do1_uface_and_Pface(s, k, ierr) use eos_def, only: i_gamma1, i_lnfree_e, i_lnPgas use star_utils, only: calc_Ptot_ad_tw, get_face_weights diff --git a/star/private/mix_info.f90 b/star/private/mix_info.f90 index d75831aa80..d06b26a992 100644 --- a/star/private/mix_info.f90 +++ b/star/private/mix_info.f90 @@ -374,6 +374,9 @@ subroutine set_mixing_info(s, skip_set_cz_bdy_mass, ierr) end if end do + call reduce_D_mix_at_Riemann_shocks(s, ierr) + if (failed('reduce_D_mix_at_Riemann_shocks')) return + ! set these just for plotting. not used. s% mixing_type(1) = s% mixing_type(2) s% D_mix(1) = s% D_mix(2) @@ -429,6 +432,35 @@ end subroutine check end subroutine set_mixing_info + subroutine reduce_D_mix_at_Riemann_shocks(s, ierr) + use hydro_riemann, only: get_Riemann_shock_diagnostics + type (star_info), pointer :: s + integer, intent(out) :: ierr + + integer :: k + real(dp) :: compression, D_mix_factor, pressure_jump, shock_strength + + ierr = 0 + if (.not. s% u_flag .or. & + s% Riemann_shock_D_mix_reduction_full_on <= 0d0) return + + do k = 2, s% nz + call get_Riemann_shock_diagnostics( & + s, k, compression, pressure_jump, shock_strength, D_mix_factor, ierr) + if (ierr /= 0) return + + ! Retain the TDC state while limiting symmetric chemical transport. + s% D_mix(k) = D_mix_factor*s% D_mix(k) + s% D_mix_non_rotation(k) = & + D_mix_factor*s% D_mix_non_rotation(k) + if (s% rotation_flag) & + s% D_mix_rotation(k) = D_mix_factor*s% D_mix_rotation(k) + s% cdc(k) = D_mix_factor*s% cdc(k) + end do + + end subroutine reduce_D_mix_at_Riemann_shocks + + subroutine set_cz_boundary_info(s, ierr) type (star_info), pointer :: s integer, intent(out) :: ierr diff --git a/star/private/profile_getval.f90 b/star/private/profile_getval.f90 index 752c4f5619..98391d8762 100644 --- a/star/private/profile_getval.f90 +++ b/star/private/profile_getval.f90 @@ -262,6 +262,7 @@ end function get_profile_val subroutine getval_for_profile(s, c, k, val, int_flag, int_val) use chem_def + use hydro_riemann, only: get_Riemann_shock_diagnostics use rates_def use ionization_def use mod_typical_charge, only: eval_typical_charge @@ -1896,6 +1897,14 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) end if case(p_Pvsc) if (s% use_Pvsc_art_visc .or. s% RSP_flag) val = s% Pvsc(k) + case(p_Riemann_shock_compression) + val = get_Riemann_shock_diagnostic(1) + case(p_Riemann_shock_pressure_jump) + val = get_Riemann_shock_diagnostic(2) + case(p_Riemann_shock_strength) + val = get_Riemann_shock_diagnostic(3) + case(p_Riemann_shock_D_mix_factor) + val = get_Riemann_shock_diagnostic(4) case(p_Hp_face) if (rsp_or_w) val = s% Hp_face(k) case(p_Y_face) @@ -2279,6 +2288,27 @@ subroutine getval_for_profile(s, c, k, val, int_flag, int_val) contains + real(dp) function get_Riemann_shock_diagnostic(which) + integer, intent(in) :: which + integer :: ierr_local + real(dp) :: compression, pressure_jump, shock_strength, D_mix_factor + + call get_Riemann_shock_diagnostics( & + s, k, compression, pressure_jump, shock_strength, D_mix_factor, ierr_local) + + select case(which) + case(1) + get_Riemann_shock_diagnostic = compression + case(2) + get_Riemann_shock_diagnostic = pressure_jump + case(3) + get_Riemann_shock_diagnostic = shock_strength + case default + get_Riemann_shock_diagnostic = D_mix_factor + end select + end function get_Riemann_shock_diagnostic + + real(dp) function get_L_vel(k) result(v) ! velocity if L carried by convection integer, intent(in) :: k real(dp) :: rho_face diff --git a/star/private/star_profile_def.f90 b/star/private/star_profile_def.f90 index 9a65b438ce..b8dd5fe880 100644 --- a/star/private/star_profile_def.f90 +++ b/star/private/star_profile_def.f90 @@ -582,7 +582,11 @@ module star_profile_def integer, parameter :: p_etrb = p_w + 1 integer, parameter :: p_log_etrb = p_etrb + 1 integer, parameter :: p_Pvsc = p_log_etrb + 1 - integer, parameter :: p_Hp_face = p_Pvsc + 1 + integer, parameter :: p_Riemann_shock_compression = p_Pvsc + 1 + integer, parameter :: p_Riemann_shock_pressure_jump = p_Riemann_shock_compression + 1 + integer, parameter :: p_Riemann_shock_strength = p_Riemann_shock_pressure_jump + 1 + integer, parameter :: p_Riemann_shock_D_mix_factor = p_Riemann_shock_strength + 1 + integer, parameter :: p_Hp_face = p_Riemann_shock_D_mix_factor + 1 integer, parameter :: p_Y_face = p_Hp_face + 1 integer, parameter :: p_PII_face = p_Y_face + 1 integer, parameter :: p_Chi = p_PII_face + 1 @@ -1272,6 +1276,10 @@ subroutine profile_column_names_init(ierr) profile_column_name(p_etrb) = 'etrb' profile_column_name(p_log_etrb) = 'log_etrb' profile_column_name(p_Pvsc) = 'Pvsc' + profile_column_name(p_Riemann_shock_compression) = 'Riemann_shock_compression' + profile_column_name(p_Riemann_shock_pressure_jump) = 'Riemann_shock_pressure_jump' + profile_column_name(p_Riemann_shock_strength) = 'Riemann_shock_strength' + profile_column_name(p_Riemann_shock_D_mix_factor) = 'Riemann_shock_D_mix_factor' profile_column_name(p_Hp_face) = 'Hp_face' profile_column_name(p_Y_face) = 'Y_face' profile_column_name(p_PII_face) = 'PII_face' diff --git a/star_data/private/star_controls_dev.inc b/star_data/private/star_controls_dev.inc index 7e604d7c3a..2ea6ca212e 100644 --- a/star_data/private/star_controls_dev.inc +++ b/star_data/private/star_controls_dev.inc @@ -6,6 +6,8 @@ logical :: TDC_adjust_mass_fallback_to_mlt logical :: include_mlt_Pturb_in_thermodynamic_gradients logical :: use_TDC_enthalpy_flux_limiter + real(dp) :: Riemann_shock_D_mix_reduction_on, & + Riemann_shock_D_mix_reduction_full_on logical :: use_face_reconstruction logical :: include_mlt_in_velocity_time_centering logical :: use_hydro_merge_limits_in_mesh_plan