mirror of
https://asciireactor.com/otho/cloudy-agn.git
synced 2024-12-05 01:55:08 +00:00
fixed multi-line stuff?
This commit is contained in:
parent
c7aab2929f
commit
26f18dcd5d
24
notes
24
notes
@ -5,6 +5,30 @@ look at paper from kirk's student and find the value of that parameter
|
||||
copy grids from thor
|
||||
|
||||
|
||||
this shows only the transition between 1s and 2p... where are the rest of the contributions?
|
||||
|
||||
if indeed cloudy is meaning to print these out individually?
|
||||
|
||||
this may not be true for hydrogen-like iron, but for H-alpha the three transitions should be included
|
||||
|
||||
is this just sloppy notation in output file, or is this really accurate and then where is all the rest of it?
|
||||
|
||||
|
||||
|
||||
|
||||
save species line "species_lines" all
|
||||
save species labels "species_labels" all
|
||||
|
||||
|
||||
OR
|
||||
|
||||
save species labels "species_labels"
|
||||
H[:]
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
2017 grids needed
|
||||
|
@ -29,66 +29,66 @@ cd fortfiles
|
||||
echo "Directory ready. Calling fort file creation."
|
||||
$bin_dir/create_fort_files ../mpi_grid.out $script_dir/../reference/linelist.c17
|
||||
|
||||
inwTfortnums=$(grep 'InwT' fort.*|sed 's@^fort\.\([0-9]\+\):InwT.*@\1@'|sort -nr)
|
||||
echo "Computing inward diffuse tables for $(echo "$inwTfortnums"|wc -l) coordinates."
|
||||
echo -n "Writing InwD tables to fortfiles and shifting files:"
|
||||
count=0
|
||||
for inwTnum in $(echo $inwTfortnums|sort -r)
|
||||
do
|
||||
inwCnum=$(($inwTnum + 1))
|
||||
inwDnum=$(($inwCnum + 1))
|
||||
allfortnums=$(ls fort.*|sed 's@fort\.\([0-9]\+\)@\1@g'|sort -n)
|
||||
fortnumstoproc=""
|
||||
for fortnum in $allfortnums
|
||||
do
|
||||
if (( $fortnum > $inwCnum ))
|
||||
then
|
||||
fortnumstoproc="$fortnum $fortnumstoproc"
|
||||
fi
|
||||
done
|
||||
# echo "Shifting $( echo "$fortnumstoproc"|wc -w ) files."
|
||||
for fortnum in $fortnumstoproc
|
||||
do
|
||||
newnum=$(( $fortnum + 1 ))
|
||||
mv fort.$fortnum fort.$newnum
|
||||
done
|
||||
#echo -n " $inwDnum"
|
||||
$bin_dir/subtract_fortfiles fort.$inwTnum fort.$inwCnum InwD > fort.$inwDnum
|
||||
echo -ne "\033[2K" ; printf "\r"
|
||||
echo -n "Writing InwD tables to fortfiles and shifting files: $(( ++count ))"
|
||||
done
|
||||
echo ""
|
||||
|
||||
inwCfortnums=$(grep 'InwC' fort.*|sed 's@^fort\.\([0-9]\+\):InwC.*@\1@'|sort -nr)
|
||||
echo "Computing total diffuse tables for $(echo "$inwCfortnums"|wc -l) coordinates."
|
||||
echo -n "Writing nFnD tables to fortfiles and shifting files: 0"
|
||||
count=0
|
||||
for inwCnum in $(echo $inwCfortnums|sort -r)
|
||||
do
|
||||
nFnunum=$(($inwCnum - 3))
|
||||
nFnDnum=$(($inwCnum + 2))
|
||||
allfortnums=$(ls fort.*|sed 's@fort\.\([0-9]\+\)@\1@g'|sort -n)
|
||||
fortnumstoproc=""
|
||||
for fortnum in $allfortnums
|
||||
do
|
||||
if (( $fortnum >= $nFnDnum ))
|
||||
then
|
||||
fortnumstoproc="$fortnum $fortnumstoproc"
|
||||
fi
|
||||
done
|
||||
# echo "Shifting $( echo "$fortnumstoproc"|wc -w ) files."
|
||||
for fortnum in $fortnumstoproc
|
||||
do
|
||||
newnum=$(( $fortnum + 1 ))
|
||||
mv fort.$fortnum fort.$newnum
|
||||
done
|
||||
|
||||
#echo -n " $nFnDnum"
|
||||
$bin_dir/subtract_fortfiles fort.$nFnunum fort.$inwCnum nFnD > fort.$nFnDnum
|
||||
echo -ne "\033[2K" ; printf "\r"
|
||||
echo -n "Writing nFnD tables to fortfiles and shifting files: $(( ++count ))"
|
||||
done
|
||||
echo ""
|
||||
# inwTfortnums=$(grep 'InwT' fort.*|sed 's@^fort\.\([0-9]\+\):InwT.*@\1@'|sort -nr)
|
||||
# echo "Computing inward diffuse tables for $(echo "$inwTfortnums"|wc -l) coordinates."
|
||||
# echo -n "Writing InwD tables to fortfiles and shifting files:"
|
||||
# count=0
|
||||
# for inwTnum in $(echo $inwTfortnums|sort -r)
|
||||
# do
|
||||
# inwCnum=$(($inwTnum + 1))
|
||||
# inwDnum=$(($inwCnum + 1))
|
||||
# allfortnums=$(ls fort.*|sed 's@fort\.\([0-9]\+\)@\1@g'|sort -n)
|
||||
# fortnumstoproc=""
|
||||
# for fortnum in $allfortnums
|
||||
# do
|
||||
# if (( $fortnum > $inwCnum ))
|
||||
# then
|
||||
# fortnumstoproc="$fortnum $fortnumstoproc"
|
||||
# fi
|
||||
# done
|
||||
# # echo "Shifting $( echo "$fortnumstoproc"|wc -w ) files."
|
||||
# for fortnum in $fortnumstoproc
|
||||
# do
|
||||
# newnum=$(( $fortnum + 1 ))
|
||||
# mv fort.$fortnum fort.$newnum
|
||||
# done
|
||||
# #echo -n " $inwDnum"
|
||||
# $bin_dir/subtract_fortfiles fort.$inwTnum fort.$inwCnum InwD > fort.$inwDnum
|
||||
# echo -ne "\033[2K" ; printf "\r"
|
||||
# echo -n "Writing InwD tables to fortfiles and shifting files: $(( ++count ))"
|
||||
# done
|
||||
# echo ""
|
||||
#
|
||||
# inwCfortnums=$(grep 'InwC' fort.*|sed 's@^fort\.\([0-9]\+\):InwC.*@\1@'|sort -nr)
|
||||
# echo "Computing total diffuse tables for $(echo "$inwCfortnums"|wc -l) coordinates."
|
||||
# echo -n "Writing nFnD tables to fortfiles and shifting files: 0"
|
||||
# count=0
|
||||
# for inwCnum in $(echo $inwCfortnums|sort -r)
|
||||
# do
|
||||
# nFnunum=$(($inwCnum - 3))
|
||||
# nFnDnum=$(($inwCnum + 2))
|
||||
# allfortnums=$(ls fort.*|sed 's@fort\.\([0-9]\+\)@\1@g'|sort -n)
|
||||
# fortnumstoproc=""
|
||||
# for fortnum in $allfortnums
|
||||
# do
|
||||
# if (( $fortnum >= $nFnDnum ))
|
||||
# then
|
||||
# fortnumstoproc="$fortnum $fortnumstoproc"
|
||||
# fi
|
||||
# done
|
||||
# # echo "Shifting $( echo "$fortnumstoproc"|wc -w ) files."
|
||||
# for fortnum in $fortnumstoproc
|
||||
# do
|
||||
# newnum=$(( $fortnum + 1 ))
|
||||
# mv fort.$fortnum fort.$newnum
|
||||
# done
|
||||
#
|
||||
# #echo -n " $nFnDnum"
|
||||
# $bin_dir/subtract_fortfiles fort.$nFnunum fort.$inwCnum nFnD > fort.$nFnDnum
|
||||
# echo -ne "\033[2K" ; printf "\r"
|
||||
# echo -n "Writing nFnD tables to fortfiles and shifting files: $(( ++count ))"
|
||||
# done
|
||||
# echo ""
|
||||
|
||||
echo "Applying interpolative smoothing."
|
||||
$script_dir/operations/bulk_interpolation_fix.sh fort.* > interpolation_report
|
||||
|
33
src/agn.hpp
33
src/agn.hpp
@ -17,7 +17,7 @@
|
||||
|
||||
namespace agn {
|
||||
|
||||
const bool debug = false;
|
||||
const bool debug = true;
|
||||
const bool line_debug = false;
|
||||
|
||||
// General constants
|
||||
@ -159,8 +159,8 @@ std::ostream& agn::operator<< (std::ostream& outstream, cloudy_result output) {
|
||||
<< std::setprecision(0)
|
||||
<< output.colden
|
||||
<< "): "
|
||||
<< output.emergent_line_intensity.size()
|
||||
<< " emission lines, "
|
||||
<< output.intrinsic_line_intensity.size()
|
||||
<< " intrinsic emission lines, "
|
||||
<< output.cautions.size()
|
||||
<< " cautions present.";
|
||||
return outstream;
|
||||
@ -363,33 +363,44 @@ agn::cloudy_grid agn::read_cloudy_grid(std::ifstream& inputfile) {
|
||||
eqwidthstr_len).c_str()
|
||||
<< "\n";
|
||||
}
|
||||
if(point.emergent_line_intensity.count(label) == 0) {
|
||||
if(point.intrinsic_line_intensity.count(label) == 0) {
|
||||
data.has_duplicates = false;
|
||||
point.emergent_line_intensity[label] = data;
|
||||
point.intrinsic_line_intensity[label] = data;
|
||||
}
|
||||
else {
|
||||
duplicate_labels.push_back(label);
|
||||
data.has_duplicates = true;
|
||||
point.emergent_line_intensity[label].has_duplicates = true;
|
||||
std::stringstream zerolabel(label);
|
||||
zerolabel << " j=0";
|
||||
point.intrinsic_line_intensity[zerolabel.str()]
|
||||
= point.intrinsic_line_intensity[label];
|
||||
point.intrinsic_line_intensity[zerolabel.str()].has_duplicates = true;
|
||||
point.intrinsic_line_intensity.erase(label);
|
||||
int j=1;
|
||||
data.has_duplicates = true;
|
||||
while(true) {
|
||||
std::stringstream newlabel;
|
||||
newlabel << label;
|
||||
newlabel << " j=" << j;
|
||||
if(point.emergent_line_intensity.count(newlabel.str()) != 0) {
|
||||
if(point.intrinsic_line_intensity.count(newlabel.str()) != 0) {
|
||||
j++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
point.emergent_line_intensity[newlabel.str()] = data;
|
||||
point.intrinsic_line_intensity[newlabel.str()] = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
linetext_it++;
|
||||
}
|
||||
if(agn::debug) std::cout
|
||||
<< " Grabbing footer.";
|
||||
if(agn::debug) {
|
||||
std::cout << " Duplicates found: ";
|
||||
std::list<std::string>::iterator dup_it = duplicate_labels.begin();
|
||||
while (dup_it != duplicate_labels.end() ) {
|
||||
std::cout << *dup_it << " ";
|
||||
}
|
||||
std::cout << " Grabbing footer.";
|
||||
}
|
||||
while (inputline == "")
|
||||
getline(inputfile,inputline);
|
||||
std::string footer="";
|
||||
|
@ -157,8 +157,9 @@ std::string agn::format_eqwidth_table_slice(agn::eqwidth_table table,agn::iterat
|
||||
|
||||
|
||||
std::ostream& agn::operator<< (std::ostream& outstream, agn::eqwidth_table table) {
|
||||
std::string header0_trimmed = table.header[0]; // need to setup a trim function for this
|
||||
outstream
|
||||
<< table.header[0]
|
||||
<< header0_trimmed
|
||||
<< std::endl
|
||||
<< table.header[1]
|
||||
<< std::endl;
|
||||
@ -222,6 +223,7 @@ agn::line_list agn::read_line_list(std::ifstream& inputfile) {
|
||||
std::list<agn::eqwidth_table> agn::compile_eqwidth_tables(agn::cloudy_grid grid,agn::line_list line_labels,double scale_factor) {
|
||||
std::list<eqwidth_table> table_list_eq_width,table_list_radiated_energy;
|
||||
agn::line_list::iterator line_label_it = line_labels.begin();
|
||||
// Iterate over labels, creating table for each:
|
||||
while (line_label_it != line_labels.end()) {
|
||||
double x,y;
|
||||
agn::cloudy_line_data data;
|
||||
@ -233,9 +235,8 @@ std::list<agn::eqwidth_table> agn::compile_eqwidth_tables(agn::cloudy_grid grid,
|
||||
std::stringstream header0;
|
||||
header0
|
||||
<< *line_label_it
|
||||
<< " relative to Inci 1215.00A scaled to "
|
||||
<< scale_factor
|
||||
<< "A.";
|
||||
<< " relative to Inci 1215.00A scaled to "
|
||||
<< scale_factor;
|
||||
new_table.header[0] = header0.str();
|
||||
new_table.header[1] = "Hden Phi(H) Eq_Width (A)";
|
||||
agn::cloudy_grid::iterator result_it = grid.begin();
|
||||
@ -243,12 +244,13 @@ std::list<agn::eqwidth_table> agn::compile_eqwidth_tables(agn::cloudy_grid grid,
|
||||
x = result_it->first.first;
|
||||
y = result_it->first.second;
|
||||
std::string label = *line_label_it;
|
||||
if ( result_it->second.emergent_line_intensity.count(label) == 0 ) {
|
||||
// if no data exist under this label, initialize some:
|
||||
if ( result_it->second.intrinsic_line_intensity.count(label) == 0 ) {
|
||||
data.radiated_energy=-35.0;
|
||||
data.eq_width=0.0;
|
||||
}
|
||||
else {
|
||||
data = result_it->second.emergent_line_intensity[label];
|
||||
data = result_it->second.intrinsic_line_intensity[label];
|
||||
data.eq_width /= scale_factor;
|
||||
if(agn::line_debug) std::cout
|
||||
<< "Added "
|
||||
|
Loading…
Reference in New Issue
Block a user