Skip to content

Commit 39d7c82

Browse files
jwreepJeffrey Reepwtbarnes
authored
Add functionality for time-variable abundances and radiative losses (#87)
* Add functionality to calculate abundance factor * add search function for nearest value in array * add misc.cpp and misc.h * add radiative loss data * add function to read abundance tables and calculate new losses * lots of debugging to get it to run * fixed format and input of radiative loss files * add correction for draining and later upflow events * use original radiation for initial conditions * add include guard for misc.h * change bool use_variable_abundances to string radiation input * add radiation to test configurations * revert config file to original values * use the power law by default in config * add descriptions of variables in helper.h * revert the config file * rename function * remove hardcoding of radiation filenames and number of files -- requires > C++ 17 * use_variable_abundances -> use_lookup_table_losses * remove hardcoding of indices * add comment about initial conditions radiation * remove overloaded find_closest * add tests for new radiative loss option * document radiative loss options --------- Co-authored-by: Jeffrey Reep <reep@kahiku.local> Co-authored-by: Will Barnes <will.t.barnes@gmail.com>
1 parent f1f42fb commit 39d7c82

20 files changed

+1127
-13
lines changed

SConstruct

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ AddOption('--linkflags', dest='linkflags', type='string', nargs=1, action='store
1818

1919

2020
subdirs = ['source']
21-
cxx_flags = ['-std=c++14',]
21+
cxx_flags = ['-std=c++17',]
2222
try:
2323
CXX = os.environ['CXX']
2424
except KeyError:
@@ -31,9 +31,13 @@ env = Environment(CXX=CXX, CXXFLAGS=cxx_flags)
3131

3232
if 'darwin' in sys.platform:
3333
print("Using Mac OS X compile options.")
34-
env.Append(CPPPATH=['/opt/local/include', '/usr/include/malloc'])
34+
if 'HOMEBREW_PREFIX' in os.environ:
35+
env.Append(CPPPATH=['/opt/local/include','/usr/include/malloc','/opt/homebrew/include'])
36+
env.Append(LIBPATH=['/opt/homebrew/lib'])
37+
else:
38+
env.Append(CPPPATH=['/opt/local/include', '/usr/include/malloc'])
39+
env.Append(LIBPATH=['/opt/local/lib'])
3540
env.Append(LIBS=['boost_program_options-mt'])
36-
env.Append(LIBPATH=['/opt/local/lib'])
3741
elif 'linux' in sys.platform:
3842
print("Using Linux compile options.")
3943
env.Append(CPPPATH=['/usr/include'])

config/ebtel.example.cfg.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<total_time>5000.0</total_time>
44
<tau>1.0</tau>
55
<tau_max>1e+300</tau_max>
6-
<loop_length>40.0e+8</loop_length>
6+
<loop_length>40e+8</loop_length>
77
<saturation_limit>1.0</saturation_limit>
88
<force_single_fluid>False</force_single_fluid>
99
<use_c1_loss_correction>True</use_c1_loss_correction>
@@ -12,6 +12,7 @@
1212
<calculate_dem>False</calculate_dem>
1313
<save_terms>False</save_terms>
1414
<use_adaptive_solver>False</use_adaptive_solver>
15+
<radiation>power_law</radiation>
1516
<output_filename>ebtel++_results_file.txt</output_filename>
1617
<adaptive_solver_error>1e-6</adaptive_solver_error>
1718
<adaptive_solver_safety>0.5</adaptive_solver_safety>
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
1.0,8.0,8.69897,9.0,9.69897,10.0,10.69897,11.0
2+
04.00,-23.309,-23.274,-23.265,-23.259,-23.259,-23.260,-23.260
3+
04.05,-22.814,-22.770,-22.760,-22.751,-22.751,-22.751,-22.751
4+
04.10,-22.365,-22.318,-22.307,-22.299,-22.298,-22.298,-22.298
5+
04.15,-22.007,-21.960,-21.951,-21.943,-21.942,-21.942,-21.942
6+
04.20,-21.811,-21.768,-21.760,-21.753,-21.753,-21.753,-21.753
7+
04.25,-21.791,-21.753,-21.746,-21.742,-21.741,-21.742,-21.742
8+
04.30,-21.866,-21.834,-21.829,-21.827,-21.827,-21.828,-21.829
9+
04.35,-21.962,-21.937,-21.933,-21.933,-21.935,-21.937,-21.938
10+
04.40,-22.035,-22.017,-22.015,-22.018,-22.021,-22.025,-22.026
11+
04.45,-22.067,-22.055,-22.055,-22.061,-22.064,-22.070,-22.072
12+
04.50,-22.068,-22.061,-22.063,-22.071,-22.075,-22.082,-22.084
13+
04.55,-22.048,-22.046,-22.048,-22.059,-22.063,-22.071,-22.074
14+
04.60,-22.007,-22.009,-22.012,-22.025,-22.030,-22.039,-22.043
15+
04.65,-21.943,-21.948,-21.952,-21.967,-21.973,-21.983,-21.987
16+
04.70,-21.858,-21.864,-21.869,-21.884,-21.891,-21.901,-21.905
17+
04.75,-21.757,-21.764,-21.769,-21.784,-21.789,-21.798,-21.801
18+
04.80,-21.650,-21.656,-21.661,-21.674,-21.678,-21.683,-21.685
19+
04.85,-21.550,-21.556,-21.560,-21.571,-21.574,-21.576,-21.577
20+
04.90,-21.477,-21.482,-21.486,-21.495,-21.497,-21.498,-21.499
21+
04.95,-21.430,-21.435,-21.438,-21.446,-21.448,-21.450,-21.452
22+
05.00,-21.405,-21.409,-21.412,-21.419,-21.421,-21.425,-21.427
23+
05.05,-21.413,-21.416,-21.418,-21.423,-21.425,-21.431,-21.435
24+
05.10,-21.431,-21.433,-21.434,-21.438,-21.440,-21.449,-21.454
25+
05.15,-21.426,-21.428,-21.429,-21.432,-21.434,-21.446,-21.453
26+
05.20,-21.405,-21.407,-21.408,-21.410,-21.413,-21.426,-21.434
27+
05.25,-21.386,-21.388,-21.389,-21.391,-21.394,-21.407,-21.417
28+
05.30,-21.379,-21.381,-21.381,-21.384,-21.386,-21.399,-21.409
29+
05.35,-21.376,-21.378,-21.379,-21.381,-21.383,-21.396,-21.406
30+
05.40,-21.386,-21.387,-21.388,-21.390,-21.391,-21.403,-21.412
31+
05.45,-21.442,-21.444,-21.444,-21.446,-21.447,-21.456,-21.464
32+
05.50,-21.565,-21.566,-21.567,-21.568,-21.569,-21.575,-21.580
33+
05.55,-21.696,-21.697,-21.698,-21.699,-21.700,-21.703,-21.706
34+
05.60,-21.776,-21.778,-21.778,-21.780,-21.780,-21.782,-21.784
35+
05.65,-21.807,-21.808,-21.809,-21.810,-21.811,-21.812,-21.814
36+
05.70,-21.815,-21.816,-21.817,-21.818,-21.819,-21.821,-21.821
37+
05.75,-21.826,-21.827,-21.828,-21.830,-21.830,-21.832,-21.833
38+
05.80,-21.849,-21.850,-21.851,-21.853,-21.854,-21.856,-21.857
39+
05.85,-21.868,-21.869,-21.870,-21.873,-21.875,-21.877,-21.877
40+
05.90,-21.872,-21.874,-21.875,-21.879,-21.880,-21.883,-21.884
41+
05.95,-21.869,-21.871,-21.873,-21.877,-21.879,-21.882,-21.883
42+
06.00,-21.872,-21.874,-21.875,-21.879,-21.881,-21.884,-21.885
43+
06.05,-21.884,-21.886,-21.887,-21.891,-21.893,-21.896,-21.897
44+
06.10,-21.902,-21.903,-21.904,-21.908,-21.909,-21.912,-21.913
45+
06.15,-21.922,-21.923,-21.924,-21.927,-21.928,-21.930,-21.931
46+
06.20,-21.950,-21.951,-21.952,-21.954,-21.955,-21.956,-21.957
47+
06.25,-21.994,-21.995,-21.996,-21.998,-21.998,-22.000,-22.000
48+
06.30,-22.065,-22.066,-22.066,-22.068,-22.069,-22.070,-22.070
49+
06.35,-22.162,-22.163,-22.163,-22.165,-22.165,-22.167,-22.167
50+
06.40,-22.265,-22.266,-22.266,-22.268,-22.268,-22.269,-22.269
51+
06.45,-22.359,-22.359,-22.359,-22.360,-22.361,-22.362,-22.362
52+
06.50,-22.434,-22.434,-22.434,-22.435,-22.435,-22.436,-22.436
53+
06.55,-22.487,-22.487,-22.487,-22.487,-22.487,-22.488,-22.488
54+
06.60,-22.519,-22.519,-22.519,-22.519,-22.519,-22.520,-22.520
55+
06.65,-22.535,-22.535,-22.535,-22.535,-22.535,-22.536,-22.536
56+
06.70,-22.539,-22.539,-22.539,-22.539,-22.540,-22.540,-22.540
57+
06.75,-22.536,-22.536,-22.536,-22.536,-22.536,-22.536,-22.536
58+
06.80,-22.529,-22.529,-22.529,-22.529,-22.529,-22.529,-22.529
59+
06.85,-22.521,-22.521,-22.521,-22.521,-22.521,-22.521,-22.521
60+
06.90,-22.516,-22.516,-22.516,-22.516,-22.516,-22.516,-22.516
61+
06.95,-22.518,-22.518,-22.518,-22.518,-22.518,-22.518,-22.518
62+
07.00,-22.529,-22.530,-22.530,-22.530,-22.530,-22.530,-22.530
63+
07.05,-22.554,-22.554,-22.554,-22.554,-22.554,-22.554,-22.554
64+
07.10,-22.592,-22.592,-22.592,-22.592,-22.592,-22.592,-22.593
65+
07.15,-22.641,-22.641,-22.641,-22.641,-22.641,-22.641,-22.641
66+
07.20,-22.689,-22.689,-22.689,-22.689,-22.689,-22.689,-22.689
67+
07.25,-22.727,-22.727,-22.727,-22.727,-22.727,-22.727,-22.727
68+
07.30,-22.752,-22.752,-22.752,-22.752,-22.752,-22.752,-22.752
69+
07.35,-22.766,-22.766,-22.766,-22.766,-22.766,-22.766,-22.766
70+
07.40,-22.771,-22.771,-22.771,-22.771,-22.771,-22.770,-22.770
71+
07.45,-22.768,-22.768,-22.768,-22.768,-22.768,-22.768,-22.768
72+
07.50,-22.762,-22.762,-22.762,-22.762,-22.762,-22.762,-22.762
73+
07.55,-22.751,-22.751,-22.751,-22.751,-22.751,-22.751,-22.751
74+
07.60,-22.738,-22.738,-22.738,-22.738,-22.738,-22.738,-22.738
75+
07.65,-22.723,-22.723,-22.723,-22.723,-22.723,-22.723,-22.723
76+
07.70,-22.706,-22.706,-22.706,-22.706,-22.706,-22.706,-22.706
77+
07.75,-22.688,-22.688,-22.688,-22.688,-22.688,-22.688,-22.688
78+
07.80,-22.670,-22.670,-22.670,-22.670,-22.670,-22.670,-22.670
79+
07.85,-22.651,-22.651,-22.651,-22.651,-22.651,-22.651,-22.651
80+
07.90,-22.632,-22.632,-22.632,-22.632,-22.632,-22.632,-22.632
81+
07.95,-22.612,-22.612,-22.612,-22.612,-22.612,-22.612,-22.612
82+
08.00,-22.592,-22.592,-22.592,-22.592,-22.592,-22.592,-22.592
83+
08.05,-22.572,-22.572,-22.572,-22.572,-22.572,-22.572,-22.572
84+
08.10,-22.552,-22.552,-22.552,-22.552,-22.552,-22.552,-22.552
85+
08.15,-22.531,-22.531,-22.531,-22.531,-22.531,-22.531,-22.531
86+
08.20,-22.510,-22.510,-22.510,-22.510,-22.510,-22.510,-22.510
87+
08.25,-22.488,-22.488,-22.488,-22.488,-22.488,-22.488,-22.488
88+
08.30,-22.467,-22.467,-22.467,-22.467,-22.467,-22.467,-22.467
89+
08.35,-22.444,-22.444,-22.444,-22.444,-22.444,-22.444,-22.444
90+
08.40,-22.422,-22.422,-22.422,-22.422,-22.422,-22.422,-22.422
91+
08.45,-22.399,-22.399,-22.399,-22.399,-22.399,-22.399,-22.399
92+
08.50,-22.376,-22.376,-22.376,-22.376,-22.376,-22.376,-22.376
93+
08.55,-22.353,-22.353,-22.353,-22.353,-22.353,-22.353,-22.353
94+
08.60,-22.330,-22.330,-22.330,-22.330,-22.330,-22.330,-22.330
95+
08.65,-22.306,-22.306,-22.306,-22.306,-22.306,-22.306,-22.306
96+
08.70,-22.283,-22.283,-22.283,-22.283,-22.283,-22.283,-22.283
97+
08.75,-22.259,-22.259,-22.259,-22.259,-22.259,-22.259,-22.259
98+
08.80,-22.235,-22.235,-22.235,-22.235,-22.235,-22.235,-22.235
99+
08.85,-22.211,-22.211,-22.211,-22.211,-22.211,-22.211,-22.211
100+
08.90,-22.187,-22.187,-22.187,-22.187,-22.187,-22.187,-22.187
101+
08.95,-22.163,-22.163,-22.163,-22.163,-22.163,-22.163,-22.163
102+
09.00,-22.138,-22.138,-22.138,-22.138,-22.138,-22.138,-22.138
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
1.5,8.0,8.69897,9.0,9.69897,10.0,10.69897,11.0
2+
04.00,-23.249,-23.220,-23.213,-23.208,-23.208,-23.209,-23.210
3+
04.05,-22.775,-22.735,-22.726,-22.718,-22.718,-22.718,-22.719
4+
04.10,-22.340,-22.296,-22.286,-22.278,-22.277,-22.277,-22.278
5+
04.15,-21.990,-21.945,-21.936,-21.929,-21.928,-21.928,-21.928
6+
04.20,-21.796,-21.755,-21.747,-21.741,-21.740,-21.740,-21.740
7+
04.25,-21.775,-21.739,-21.732,-21.728,-21.728,-21.728,-21.728
8+
04.30,-21.848,-21.818,-21.813,-21.811,-21.811,-21.813,-21.813
9+
04.35,-21.941,-21.917,-21.914,-21.915,-21.916,-21.919,-21.920
10+
04.40,-22.010,-21.993,-21.992,-21.995,-21.998,-22.003,-22.005
11+
04.45,-22.036,-22.025,-22.025,-22.031,-22.035,-22.041,-22.044
12+
04.50,-22.030,-22.025,-22.026,-22.034,-22.037,-22.045,-22.048
13+
04.55,-22.005,-22.004,-22.006,-22.015,-22.019,-22.028,-22.032
14+
04.60,-21.962,-21.965,-21.968,-21.979,-21.983,-21.993,-21.997
15+
04.65,-21.900,-21.905,-21.909,-21.922,-21.927,-21.938,-21.942
16+
04.70,-21.817,-21.824,-21.828,-21.842,-21.848,-21.858,-21.863
17+
04.75,-21.720,-21.727,-21.731,-21.745,-21.751,-21.759,-21.763
18+
04.80,-21.618,-21.624,-21.628,-21.640,-21.645,-21.650,-21.652
19+
04.85,-21.525,-21.531,-21.535,-21.545,-21.548,-21.550,-21.551
20+
04.90,-21.462,-21.467,-21.470,-21.479,-21.481,-21.482,-21.483
21+
04.95,-21.422,-21.427,-21.430,-21.439,-21.441,-21.443,-21.444
22+
05.00,-21.401,-21.405,-21.408,-21.415,-21.417,-21.422,-21.424
23+
05.05,-21.410,-21.414,-21.415,-21.420,-21.422,-21.429,-21.433
24+
05.10,-21.428,-21.431,-21.432,-21.435,-21.438,-21.446,-21.452
25+
05.15,-21.423,-21.425,-21.426,-21.429,-21.432,-21.443,-21.450
26+
05.20,-21.401,-21.403,-21.404,-21.407,-21.410,-21.423,-21.431
27+
05.25,-21.382,-21.384,-21.385,-21.387,-21.390,-21.403,-21.412
28+
05.30,-21.373,-21.375,-21.376,-21.378,-21.381,-21.394,-21.403
29+
05.35,-21.369,-21.371,-21.372,-21.374,-21.376,-21.388,-21.398
30+
05.40,-21.376,-21.377,-21.378,-21.380,-21.382,-21.393,-21.402
31+
05.45,-21.427,-21.429,-21.430,-21.431,-21.433,-21.442,-21.449
32+
05.50,-21.539,-21.541,-21.541,-21.543,-21.544,-21.550,-21.555
33+
05.55,-21.653,-21.654,-21.655,-21.656,-21.657,-21.661,-21.663
34+
05.60,-21.713,-21.714,-21.715,-21.717,-21.718,-21.720,-21.721
35+
05.65,-21.726,-21.728,-21.728,-21.730,-21.731,-21.733,-21.734
36+
05.70,-21.719,-21.721,-21.721,-21.723,-21.724,-21.726,-21.727
37+
05.75,-21.715,-21.716,-21.717,-21.719,-21.720,-21.722,-21.723
38+
05.80,-21.720,-21.722,-21.723,-21.725,-21.727,-21.729,-21.729
39+
05.85,-21.723,-21.725,-21.726,-21.730,-21.731,-21.734,-21.734
40+
05.90,-21.718,-21.720,-21.721,-21.725,-21.727,-21.730,-21.731
41+
05.95,-21.710,-21.712,-21.714,-21.718,-21.720,-21.724,-21.725
42+
06.00,-21.711,-21.713,-21.715,-21.719,-21.721,-21.725,-21.726
43+
06.05,-21.723,-21.726,-21.727,-21.731,-21.733,-21.736,-21.737
44+
06.10,-21.742,-21.744,-21.745,-21.749,-21.750,-21.753,-21.754
45+
06.15,-21.765,-21.766,-21.767,-21.770,-21.771,-21.773,-21.774
46+
06.20,-21.795,-21.796,-21.797,-21.800,-21.801,-21.802,-21.803
47+
06.25,-21.844,-21.845,-21.846,-21.848,-21.849,-21.850,-21.851
48+
06.30,-21.922,-21.923,-21.924,-21.926,-21.927,-21.928,-21.928
49+
06.35,-22.030,-22.031,-22.031,-22.033,-22.034,-22.035,-22.035
50+
06.40,-22.145,-22.145,-22.146,-22.147,-22.148,-22.149,-22.149
51+
06.45,-22.246,-22.247,-22.247,-22.248,-22.248,-22.249,-22.250
52+
06.50,-22.325,-22.326,-22.326,-22.326,-22.327,-22.328,-22.328
53+
06.55,-22.379,-22.379,-22.379,-22.380,-22.380,-22.380,-22.380
54+
06.60,-22.409,-22.409,-22.410,-22.410,-22.410,-22.410,-22.410
55+
06.65,-22.422,-22.422,-22.422,-22.422,-22.422,-22.422,-22.422
56+
06.70,-22.422,-22.422,-22.422,-22.422,-22.422,-22.422,-22.422
57+
06.75,-22.415,-22.415,-22.415,-22.415,-22.415,-22.415,-22.415
58+
06.80,-22.404,-22.404,-22.404,-22.404,-22.404,-22.404,-22.404
59+
06.85,-22.394,-22.394,-22.394,-22.394,-22.394,-22.394,-22.394
60+
06.90,-22.388,-22.388,-22.388,-22.388,-22.388,-22.388,-22.388
61+
06.95,-22.390,-22.390,-22.390,-22.390,-22.390,-22.390,-22.390
62+
07.00,-22.404,-22.404,-22.404,-22.404,-22.404,-22.404,-22.404
63+
07.05,-22.432,-22.432,-22.433,-22.433,-22.433,-22.433,-22.433
64+
07.10,-22.479,-22.479,-22.479,-22.479,-22.479,-22.479,-22.479
65+
07.15,-22.539,-22.539,-22.539,-22.539,-22.539,-22.539,-22.539
66+
07.20,-22.600,-22.600,-22.600,-22.600,-22.600,-22.600,-22.600
67+
07.25,-22.651,-22.651,-22.651,-22.651,-22.651,-22.651,-22.651
68+
07.30,-22.688,-22.688,-22.688,-22.688,-22.688,-22.688,-22.688
69+
07.35,-22.711,-22.711,-22.711,-22.711,-22.711,-22.711,-22.711
70+
07.40,-22.723,-22.723,-22.723,-22.723,-22.723,-22.723,-22.723
71+
07.45,-22.727,-22.727,-22.727,-22.727,-22.727,-22.727,-22.727
72+
07.50,-22.724,-22.724,-22.724,-22.724,-22.724,-22.724,-22.724
73+
07.55,-22.717,-22.717,-22.717,-22.717,-22.717,-22.717,-22.717
74+
07.60,-22.707,-22.707,-22.707,-22.707,-22.707,-22.707,-22.707
75+
07.65,-22.693,-22.693,-22.693,-22.693,-22.693,-22.693,-22.693
76+
07.70,-22.679,-22.679,-22.679,-22.679,-22.679,-22.679,-22.679
77+
07.75,-22.662,-22.662,-22.662,-22.662,-22.662,-22.662,-22.662
78+
07.80,-22.645,-22.645,-22.645,-22.645,-22.645,-22.645,-22.645
79+
07.85,-22.628,-22.628,-22.628,-22.628,-22.628,-22.628,-22.628
80+
07.90,-22.610,-22.610,-22.610,-22.610,-22.610,-22.610,-22.610
81+
07.95,-22.592,-22.592,-22.592,-22.592,-22.592,-22.592,-22.592
82+
08.00,-22.573,-22.573,-22.573,-22.573,-22.573,-22.573,-22.573
83+
08.05,-22.554,-22.554,-22.554,-22.554,-22.554,-22.554,-22.554
84+
08.10,-22.535,-22.535,-22.535,-22.535,-22.535,-22.535,-22.535
85+
08.15,-22.516,-22.516,-22.516,-22.516,-22.516,-22.516,-22.516
86+
08.20,-22.496,-22.496,-22.496,-22.496,-22.496,-22.496,-22.496
87+
08.25,-22.475,-22.475,-22.475,-22.475,-22.475,-22.475,-22.475
88+
08.30,-22.454,-22.454,-22.454,-22.454,-22.454,-22.454,-22.454
89+
08.35,-22.433,-22.433,-22.433,-22.433,-22.433,-22.433,-22.433
90+
08.40,-22.411,-22.411,-22.411,-22.411,-22.411,-22.411,-22.411
91+
08.45,-22.389,-22.389,-22.389,-22.389,-22.389,-22.389,-22.389
92+
08.50,-22.367,-22.367,-22.367,-22.367,-22.367,-22.367,-22.367
93+
08.55,-22.344,-22.344,-22.344,-22.344,-22.344,-22.344,-22.344
94+
08.60,-22.321,-22.321,-22.321,-22.321,-22.321,-22.321,-22.321
95+
08.65,-22.298,-22.298,-22.298,-22.298,-22.298,-22.298,-22.298
96+
08.70,-22.275,-22.275,-22.275,-22.275,-22.275,-22.275,-22.275
97+
08.75,-22.251,-22.251,-22.251,-22.251,-22.251,-22.251,-22.251
98+
08.80,-22.227,-22.227,-22.227,-22.227,-22.227,-22.227,-22.227
99+
08.85,-22.204,-22.204,-22.204,-22.204,-22.204,-22.204,-22.204
100+
08.90,-22.180,-22.180,-22.180,-22.180,-22.180,-22.180,-22.180
101+
08.95,-22.156,-22.156,-22.156,-22.156,-22.156,-22.156,-22.156
102+
09.00,-22.131,-22.131,-22.131,-22.131,-22.131,-22.131,-22.131

0 commit comments

Comments
 (0)