mirror of
https://asciireactor.com/otho/cloudy-agn.git
synced 2024-12-05 02:05:07 +00:00
create_fort_files now also creates a cautions report for non-convergence
This commit is contained in:
parent
7f4bc149e3
commit
6b4849f75c
16
src/agn.hpp
16
src/agn.hpp
@ -45,7 +45,7 @@ struct cloudy_line_data {
|
||||
|
||||
typedef std::map<std::string,cloudy_line_data> cloudy_line_output;
|
||||
|
||||
struct cloudy_result {
|
||||
struct cloudy_result {
|
||||
std::string header, footer;
|
||||
std::list<std::string> emergent_line_raw_text;
|
||||
std::list<std::string> cautions;
|
||||
@ -60,7 +60,7 @@ struct cloudy_result {
|
||||
iterations(0),
|
||||
phi(0),
|
||||
hden(0),
|
||||
colden(0)
|
||||
colden(0)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -70,7 +70,7 @@ cloudy_grid read_cloudy_grid(std::ifstream&);
|
||||
// Operator<< prints general info about the run result.
|
||||
std::ostream& operator<< (std::ostream&, cloudy_result);
|
||||
// Seeks an instream to the line after the first occurrence of seek_string.
|
||||
void seek_to(std::string,std::istream&);
|
||||
void seek_to(std::string,std::istream&);
|
||||
|
||||
|
||||
} // end namespace agn
|
||||
@ -123,7 +123,7 @@ void agn::seek_to(std::string seek_string,std::istream& stream) {
|
||||
|
||||
std::string agn::format_table1d(agn::table1d table) {
|
||||
std::stringstream output;
|
||||
output
|
||||
output
|
||||
<< std::scientific
|
||||
<< std::setprecision(5);
|
||||
agn::table1d::iterator x=table.begin();
|
||||
@ -272,7 +272,7 @@ agn::cloudy_grid agn::read_cloudy_grid(std::ifstream& inputfile) {
|
||||
}
|
||||
}
|
||||
point.colden = colden;
|
||||
if(agn::debug) std::cout
|
||||
if(agn::debug) std::cout
|
||||
<< " Grabbing emission lines.";
|
||||
agn::seek_to("Emergent line intensities",inputfile);
|
||||
std::list<std::string> emergent_line_raw_text;
|
||||
@ -321,7 +321,7 @@ agn::cloudy_grid agn::read_cloudy_grid(std::ifstream& inputfile) {
|
||||
}
|
||||
linetext_it++;
|
||||
}
|
||||
if(agn::debug) std::cout
|
||||
if(agn::debug) std::cout
|
||||
<< " Grabbing footer.";
|
||||
while (inputline == "")
|
||||
getline(inputfile,inputline);
|
||||
@ -332,9 +332,9 @@ agn::cloudy_grid agn::read_cloudy_grid(std::ifstream& inputfile) {
|
||||
footer.append("\n");
|
||||
getline(inputfile,inputline);
|
||||
}
|
||||
if(agn::debug) std::cout
|
||||
if(agn::debug) std::cout
|
||||
<< "\nAdding point to grid: "
|
||||
<< point
|
||||
<< point
|
||||
<< std::endl;
|
||||
grid[*coords] = point;
|
||||
coords++;
|
||||
|
@ -19,8 +19,8 @@ int main(int argc, char const *argv[]) {
|
||||
std::ifstream line_list_file;
|
||||
line_list_file.open(argv[2]);
|
||||
agn::line_list lines_to_print = agn::read_line_list(line_list_file);
|
||||
std::cout
|
||||
<< "Compiling table2ds for "
|
||||
std::cout
|
||||
<< "Compiling table2ds for "
|
||||
<< lines_to_print.size()
|
||||
<< " emission lines.\n";
|
||||
std::list<agn::eqwidth_table> tables = agn::compile_eqwidth_tables(grid,lines_to_print,1215.00);
|
||||
@ -43,10 +43,46 @@ int main(int argc, char const *argv[]) {
|
||||
fortfilenum++;
|
||||
}
|
||||
|
||||
int num_unconverged = 0;
|
||||
agn::cloudy_grid::iterator result_it = grid.begin();
|
||||
std::ofstream cautionreportfile;
|
||||
cautionreportfile.open("cautions");
|
||||
cautionreportfile
|
||||
<< "The following solutions probably did not converge."
|
||||
<< std::endl << std::endl;
|
||||
while(result_it != grid.end()) {
|
||||
if (result_it->second.iterations >= 40) {
|
||||
num_unconverged++;
|
||||
cautionreportfile
|
||||
<< "hden = "
|
||||
<< std::fixed
|
||||
<< std::setprecision(3)
|
||||
<< result_it->second.hden
|
||||
<< ", phi = "
|
||||
<< result_it->second.phi
|
||||
<< std::endl
|
||||
<< "───────────────────────────"
|
||||
<< std::endl;
|
||||
std::list<std::string>::iterator caution_it = result_it->second.cautions.begin();
|
||||
while(caution_it != result_it->second.cautions.end()) {
|
||||
cautionreportfile
|
||||
<< *caution_it
|
||||
<< std::endl;
|
||||
caution_it++;
|
||||
}
|
||||
cautionreportfile << std::endl << std::endl;
|
||||
}
|
||||
result_it++;
|
||||
}
|
||||
|
||||
std::cout
|
||||
<< "Saved cautions for "
|
||||
<< num_unconverged
|
||||
<< " unconverged solutions."
|
||||
<< std::endl;
|
||||
cautionreportfile.close();
|
||||
|
||||
std::cout << "Done.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user