Version 0.1 (Alpha)
Performance depends on system.
(30 fps)
", pos: scene.title_anchor})]);
"107";
spliter = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "
", pos: scene.title_anchor})]);
"108";
information_text = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "
Information Star:", pos: scene.title_anchor})]);
"109";
information_text_mass = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "\nMass: "["+"](str(new_sun_mass))["+"](" kg (")["+"](str(round(new_sun_mass["/"](sun_mass), 3)))["+"](" *sun_mass)
"), pos: scene.title_anchor})]);
"111";
async function remove_mass(b) {
var RS_ls, addition_value, old_sun_mass, percentage_mass_add, old_amount, helium, old_amount_h, hydrogen;
"112";
"113";
addition_value = 2["*"](GS_power(10, 30));
"114";
old_sun_mass = new_sun_mass;
"115";
new_sun_mass=new_sun_mass["-"](addition_value);
"116";
percentage_mass_add = new_sun_mass["/"](addition_value);
"118";
old_amount = helium["*"](old_sun_mass);
"119";
helium = old_amount["/"](new_sun_mass);
"120";
old_amount_h = hydrogen["*"](old_sun_mass)["*"](.1);
"121";
hydrogen = old_amount_h["-"](.1["*"](addition_value))["/"](new_sun_mass["*"](.1));
};
if (!remove_mass.__argnames__) Object.defineProperties(remove_mass, {
__argnames__ : {value: ["b"]}
});
"122";
RS_interpolate_kwargs.call(this, button, [RS_desugar_kwargs({bind: remove_mass, text: "- 1*sun_mass (Hydrogen, equaly distributed) (BUG)", pos: scene.title_anchor})]);
"124";
async function add_mass(b) {
var RS_ls, addition_value, old_sun_mass, percentage_mass_add, old_amount, helium, old_amount_h, hydrogen;
"125";
"126";
addition_value = sun_mass;
"127";
old_sun_mass = new_sun_mass;
"128";
new_sun_mass=new_sun_mass["+"](addition_value);
"129";
percentage_mass_add = new_sun_mass["/"](addition_value);
"131";
old_amount = helium["*"](old_sun_mass);
"132";
helium = old_amount["/"](new_sun_mass);
"135";
old_amount_h = hydrogen["*"](old_sun_mass)["*"](.1);
"136";
hydrogen = old_amount_h["+"](addition_value["*"](.1))["/"](new_sun_mass["*"](.1));
};
if (!add_mass.__argnames__) Object.defineProperties(add_mass, {
__argnames__ : {value: ["b"]}
});
"137";
RS_interpolate_kwargs.call(this, button, [RS_desugar_kwargs({bind: add_mass, text: "+ 1*sun_mass (Hydrogen, equaly distributed)", pos: scene.title_anchor})]);
"139";
information_text_radius = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "\nRadius: "["+"](str(new_sun_radius))["+"](" m
"), pos: scene.title_anchor})]);
"141";
async function remove_radius(b) {
var RS_ls, addition_value_radius;
"142";
"143";
addition_value_radius = GS_power(10, 3);
"144";
new_sun_radius=new_sun_radius["-"](addition_value_radius);
};
if (!remove_radius.__argnames__) Object.defineProperties(remove_radius, {
__argnames__ : {value: ["b"]}
});
"145";
RS_interpolate_kwargs.call(this, button, [RS_desugar_kwargs({bind: remove_radius, text: "- 10^3 m", pos: scene.title_anchor})]);
"147";
async function add_radius(b) {
var RS_ls, addition_value_radius;
"148";
"149";
"150";
"151";
addition_value_radius = GS_power(10, 3);
"152";
new_sun_radius=new_sun_radius["+"](addition_value_radius);
"153";
new_sun_density = new_sun_mass["/"](4["/"](3)["*"](pi)["*"](GS_power(new_sun_radius, 3)));
"154";
new_sun_mass = new_sun_density["*"](4)["/"](3)["*"](pi)["*"](GS_power(new_sun_radius, 3));
"155";
print(new_sun_mass);
};
if (!add_radius.__argnames__) Object.defineProperties(add_radius, {
__argnames__ : {value: ["b"]}
});
"156";
RS_interpolate_kwargs.call(this, button, [RS_desugar_kwargs({bind: add_radius, text: "+ 10^3 m", pos: scene.title_anchor})]);
"158";
spliter_core = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "
", pos: scene.title_anchor})]);
"159";
information_text_core = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "
Information Star Core:\n", pos: scene.title_anchor})]);
"160";
information_text_sun_core_mass = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "\nCore Mass: "["+"](str(new_sun_mass["/"](10)))["+"](" kg
"), pos: scene.title_anchor})]);
"161";
information_text_sun_core_temp = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "\nCore Temperature: "["+"](str(sun_core_temp))["+"](" K"), pos: scene.title_anchor})]);
"162";
information_text_sun_core_pressure = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "\nCore Pressure: "["+"](str((await P(0))))["+"](" Pa"), pos: scene.title_anchor})]);
"163";
information_text_composition_dict = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "Elements: H("["+"](str(hydrogen))["+"]("), He(")["+"](str(helium))["+"]("), C(")["+"](str(co))["+"](")"), pos: scene.title_anchor})]);
"165";
information_text_links = RS_interpolate_kwargs.call(this, wtext, [RS_desugar_kwargs({text: "
\nhttp://earthguide.ucsd.edu/virtualmuseum/images/raw/protonprotonchain.jpg\nhttp://astronomy.swin.edu.au/cosmos/M/Main+Sequence+Lifetime\nhttp://www.pa.uky.edu/~wilhelm/ast192_f09/Calculating%20the%20Lifetime%20of%20the%20Sun.pdf\n\nhttps://www.atnf.csiro.au/outreach/education/senior/astrophysics/stellarevolution_postmain.html\nhttp://abyss.uoregon.edu/~js/ast122/lectures/lec16.html\nHyperphysics: http://230nsc1.phy-astr.gsu.edu/hbase/hframe.html
", pos: scene.caption_anchor})]);
"167";
e_plot = RS_interpolate_kwargs.call(this, graph, [RS_desugar_kwargs({scroll: true, fast: false, xmin: 0, xmax: new_sun_mass, title: "Fusion temperatures compared with simulated star fusion potentials", xtitle: "Years", ytitle: "Temperature Potetntial", width: 16["*"](40), height: 9["*"](25)})]);
"168";
plot_e = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({label: "Energy", color: color.red})]);
"169";
plot_h = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({label: "H to He fusion"})]);
"170";
plot_k = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({label: "He to Co/O fusion"})]);
"171";
plot_c = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({label: "Co to Mg/Na/Ne fusion"})]);
"172";
plot_o = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({label: "O to S/P/Si fusion"})]);
"173";
plot_s = RS_interpolate_kwargs.call(this, gcurve, [RS_desugar_kwargs({label: "Si to Fe fusion"})]);
"179";
while (current_time[">"](1["-u"]())) {
"180";
;(await rate(r));
"183";
per_reaction_energy = 4.32["*"](GS_power(10, 12["-u"]()));
"184";
reaction_per_sec = new_sun_lightforce["/"](per_reaction_energy);
"186";
sun_core_mass = core_mass;
"187";
information_text_sun_core_mass.text = "Core Mass: "["+"](str(new_sun_mass["/"](10)))["+"](" kg");
"188";
kg_per_reaction = 6.692["*"](GS_power(10, 27["-u"]()));
"189";
possible_reactions = sun_core_mass["/"](kg_per_reaction);
"191";
lifetime = possible_reactions["/"](reaction_per_sec);
"192";
sun_lifetime = lifetime["/"](pi["*"](GS_power(10, 7)));
"194";
RS_interpolate_kwargs.call(plot_e, plot_e.plot, [RS_desugar_kwargs({pos: RS_list_decorate([ current_time, sun_core_temp["+"](temp_change) ])})]);
"195";
RS_interpolate_kwargs.call(plot_k, plot_k.plot, [RS_desugar_kwargs({pos: RS_list_decorate([ current_time, GS_power(10, 8) ])})]);
"196";
RS_interpolate_kwargs.call(plot_h, plot_h.plot, [RS_desugar_kwargs({pos: RS_list_decorate([ current_time, 15["*"](GS_power(10, 6)) ])})]);
"197";
RS_interpolate_kwargs.call(plot_c, plot_c.plot, [RS_desugar_kwargs({pos: RS_list_decorate([ current_time, 5["*"](GS_power(10, 8)) ])})]);
"198";
RS_interpolate_kwargs.call(plot_o, plot_o.plot, [RS_desugar_kwargs({pos: RS_list_decorate([ current_time, 1.4["*"](GS_power(10, 9)) ])})]);
"199";
RS_interpolate_kwargs.call(plot_s, plot_s.plot, [RS_desugar_kwargs({pos: RS_list_decorate([ current_time, 2["*"](GS_power(10, 9)) ])})]);
"200";
e_plot.xmax = current_time;
"209";
if ((time_run === true || typeof time_run === "object" && RS_equals(time_run, true))) {
"210";
current_time=current_time["+"](addition_years);
"211";
current_time_text.text = "Lived: "["+"](str(current_time))["+"](" years (")["+"](str(addition_years["*"](60)))["+"](" years/sec)\n");
"212";
sun_lifetime_progress_bar.text = "
")["+"](str(round(current_time["/"](sun_lifetime)["*"](100), 2)))["+"]("%
");
"213";
star_helium_burning.visible = true;
"214";
if (round(current_time["/"](sun_lifetime)["*"](100), 2)[">"](100)) {
"215";
sun_lifetime_text.text = "";
"216";
sun_lifetime_text_extended.text = "";
"217";
status = "Main sequence end, Hertzsprung gap";
"218";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"220";
free_fall_time_counter = 0;
"221";
if (sun_core_temp["+"](temp_change)["<"](GS_power(10, 8))) {
"222";
status = "Burning Hydrogen end. Helium white dwarf.";
"223";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"224";
sun_lifetime_progress_bar.text = false;
"225";
star_helium_burning.visible = false;
"227";
free_fall_time = GS_power((3["*"](pi)["/"](32["*"](G)["*"](new_sun_density))), (1["/"](2)))["/"](60)["/"](60)["/"](24)["/"](365);
"228";
free_fall_time_counter=free_fall_time_counter["+"](free_fall_time);
"229";
if (free_fall_time_counter[">"](addition_years)) {
"230";
free_fall_time_counter=free_fall_time_counter["-"](addition_years);
"231";
} else {
"233";
white_dwarf = true;
"234";
radius_wd = 4["*"](pi)["*"](K)["/"](G["*"](GS_power((4["/"](3)["*"](pi)), (5["/"](3))))["*"](GS_power(new_sun_mass, (1["/"](3)))));
"235";
print(radius_wd);
"236";
star.radius = radius_wd;
"237";
}
} else if (GS_power(10, 8)["<"](RS_cond_temp = sun_core_temp["+"](temp_change)) && RS_cond_temp["<"](5["*"](GS_power(10, 8)))) {
"238";
sun_lifetime_progress_bar.text = false;
"239";
star_helium_burning.visible = false;
"240";
if (helium["<"](.01)) {
"241";
status = "Burning to Carbon complete.";
"242";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"243";
} else {
"244";
status = "Burning till C-O star (Triple Alpha Process)";
"245";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"247";
helium_loss = addition_years["*"](60)["*"](60)["*"](24)["*"](365)["*"](8.8)["*"](GS_power(10, 37))["*"](24["*"](helium_atom_mass)["/"](core_mass));
"248";
co_gain = addition_years["*"](60)["*"](60)["*"](24)["*"](365)["*"](8.8)["*"](GS_power(10, 37))["*"](1["*"](co_atom_mass)["/"](core_mass));
"249";
helium = helium["-"](helium_loss);
"250";
co = co["+"](co_gain);
"251";
information_text_composition_dict.text = "\nElements: H("["+"](str(round(hydrogen, 3)))["+"]("), He(")["+"](str(round(helium, 3)))["+"]("), C(")["+"](str(co))["+"](")");
"253";
per_reaction_energy_co = 1.3273["*"](GS_power(10, 23["-u"]()))["+"](2.15891["*"](GS_power(10, 26["-u"]())))["+"](1.602["*"](GS_power(10, 19["-u"]()))["*"](2e5));
"254";
reaction_per_sec_co = new_sun_lightforce["/"](per_reaction_energy_co);
"256";
sun_core_mass = core_mass;
"257";
information_text_sun_core_mass.text = "Core Mass: "["+"](str(new_sun_mass["/"](10)))["+"](" kg");
"258";
kg_per_reaction_co = 6.692["*"](GS_power(10, 27["-u"]()));
"259";
possible_reactions_co = sun_core_mass["/"](kg_per_reaction_co);
"261";
lifetime_co = possible_reactions_co["/"](reaction_per_sec_co);
"262";
sun_lifetime_co = lifetime_co["/"](pi["*"](GS_power(10, 7)));
"263";
sun_lifetime_text.text = "Total Lifetime (C-O white dwarf): "["+"](str(round(sun_lifetime_co, 2)))["+"](" years");
"264";
sun_lifetime_text_extended.text = " ≈ 10^"["+"](str(len(str(round(sun_lifetime_co)))))["+"](" years");
"265";
}
} else if (5["*"](GS_power(10, 8))["<"](RS_cond_temp = sun_core_temp["+"](temp_change)) && RS_cond_temp["<"](1.4["*"](GS_power(10, 9)))) {
"266";
status = "Burning Carbon.";
"267";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"268";
} else if (1.4["*"](GS_power(10, 9))["<"](RS_cond_temp = sun_core_temp["+"](temp_change)) && RS_cond_temp["<"](2["*"](GS_power(10, 9)))) {
"269";
status = "Burning Oxygen.";
"270";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"271";
} else if (2["*"](GS_power(10, 9))["<"](RS_cond_temp = sun_core_temp["+"](temp_change)) && RS_cond_temp["<"](5["*"](GS_power(10, 8)))) {
"272";
status = "Burning Silicon.";
"273";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"274";
} else {
"275";
status = "Burning till Fe core star, then black hole or neutron star.";
"276";
status_text.text = "
Status: "["+"](status)["+"]("\n");
"277";
}
} else {
"278";
hydrogen_loss = addition_years["*"](60)["*"](60)["*"](24)["*"](365)["*"](8.8)["*"](GS_power(10, 37))["*"](4["*"](hydrogen_atom_mass)["/"](core_mass));
"279";
helium_gain = addition_years["*"](60)["*"](60)["*"](24)["*"](365)["*"](8.8)["*"](GS_power(10, 37))["*"](1["*"](helium_atom_mass)["/"](core_mass));
"280";
hydrogen = hydrogen["-"](hydrogen_loss);
"281";
helium = helium["+"](hydrogen_loss);
"282";
information_text_composition_dict.text = "Elements: H("["+"](str(hydrogen))["+"]("), He(")["+"](str(helium))["+"]("), C(")["+"](str(co))["+"](")");
"283";
sun_lifetime_text.text = "Total Lifetime (Main Sequence): "["+"](str(round(sun_lifetime, 2)))["+"](" years");
"284";
sun_lifetime_text_extended.text = " ≈ 10^"["+"](str(len(str(round(sun_lifetime)))))["+"](" years");
}
"286";
new_sun_mass=new_sun_mass["-"](sun_mass_loss_per_year["*"](addition_years));
"287";
new_sun_density = new_sun_mass["/"](sun_volume);
"289";
sun_core_temp = G["*"](new_sun_mass)["*"](average_atom_mass_core)["/"](new_sun_radius["*"](3["/"](2))["*"](k));
"290";
average_atom_mass_core = helium["*"](100)["*"](helium_atom_mass)["+"](hydrogen["*"](100)["*"](hydrogen_atom_mass))["+"](co["*"](100)["*"](co_atom_mass))["/"](100);
"291";
temp_change = 3["/"](10)["*"](G)["*"](GS_power(new_sun_mass, 2)["/"](new_sun_radius))["/"](new_sun_mass["*"](average_heat_capacity_core));
"292";
core_mass = new_sun_mass["*"](.1);
}
"295";
pressure_eq = (await P(new_sun_radius["+"](new_sun_radius["/"](2)["/"](2))))["-"]((await P(new_sun_radius["-"](new_sun_radius["/"](2)["/"](2)))))["/"](new_sun_radius["/"](2));
"296";
gravity_eq = 2["*"](G["*"]((await M(new_sun_radius["/"](2))))["*"](new_sun_density)["/"](GS_power((new_sun_radius["/"](2)), 2))["-u"]());
"297";
if (RS_equals(round(pressure_eq), round(gravity_eq))) {
"298";
status_eq = "Pressure and gravity are in check.";
"299";
status_eq_text.text = "
Hydrostatic Equilibrium Status: "["+"](status_eq)["+"]("(")["+"](str(round(pressure_eq)))["+"]("=")["+"](str(round(gravity_eq)))["+"](")\n");
"300";
} else {
"301";
status_eq = "Pressure and gravity are NOT in check.";
"302";
status_eq_text.text = "
Hydrostatic Equilibrium Status: "["+"](status_eq)["+"]("(")["+"](str(round(pressure_eq)))["+"]("=")["+"](str(round(gravity_eq)))["+"](")\n");
"304";
}
if ((white_dwarf === false || typeof white_dwarf === "object" && RS_equals(white_dwarf, false))) {
"305";
star.radius = new_sun_radius;
}
"306";
star.mass = new_sun_mass;
"308";
information_text_sun_core_temp.text = "\nCore Temperature: "["+"](str(sun_core_temp))["+"](" K");
"309";
information_text_sun_core_pressure.text = "\nCore Pressure: "["+"](str((await P(0))))["+"](" Pa
");
"310";
information_text_mass.text = "\nMass: "["+"](str(new_sun_mass))["+"](" kg (")["+"](str(round(new_sun_mass["/"](sun_mass), 3)))["+"](" *sun_mass)
");
"311";
information_text_radius.text = "\nRadius: "["+"](str(new_sun_radius))["+"](" m
");
"312";
t = G["*"](sun_mass)["*"](2)["*"](GS_power(10, 30))["-u"]()["/"](GS_power(sun_radius, 2));
}
};
;$(function(){ window.__context = { glowscript_container: $("#glowscript").removeAttr("id") }; __main__() })})()
// END JAVASCRIPT
//-->