17 if(argc < 2)
return(1);
18 std::string caseName(argv[1]);
20 std::string configFileName(caseName+
".probe_config");
21 std::ifstream configIn;
22 configIn.open(configFileName.c_str());
28 std::vector<double> probeLocations;
29 double location = 0.0;
30 while(configIn >> location)
31 probeLocations.push_back(location);
33 int nProbeCoordinates = probeLocations.size();
34 assert(nProbeCoordinates == nProbes*3);
35 std::vector<double>::iterator coordinateIterator = probeLocations.begin();
37 std::ostringstream htmlOut;
38 htmlOut <<
"<html>" << std::endl
39 <<
" <head>" << std::endl
41 << caseName <<
" Probe Monitor"
42 <<
"</title>" << std::endl
43 <<
" <meta http-equiv=\"refresh\" content=\"300\" />"
45 <<
" </head>" << std::endl
46 <<
" <body>" << std::endl
47 <<
" <p>" << std::endl
48 <<
" <h1><center>" << caseName
49 <<
" Probe Monitor</center></h1>" << std::endl
50 <<
" </p>" << std::endl << std::endl
51 <<
" <hr>" << std::endl << std::endl;
54 std::vector<IR::flowprobe> probesData;
55 for(
int iProbe = 1;iProbe <= nProbes;iProbe++){
57 double probeLocationX = *coordinateIterator++;
58 double probeLocationY = *coordinateIterator++;
59 double probeLocationZ = *coordinateIterator++;
61 htmlOut <<
" <p>" << std::endl
62 <<
" <h2><center>Probe "
63 << iProbe <<
"</center></h2>" << std::endl
64 <<
" <img src=\"velocity_plot_" << iProbe <<
".png\" "
65 <<
"style=\"float: left; width: 50%\">" << std::endl
66 <<
" <img src=\"pandt_plot_" << iProbe <<
".png\" "
67 <<
"style=\"float: left; width: 50%\">" << std::endl
68 <<
" </p>" << std::endl << std::endl
69 <<
" <hr>" << std::endl
73 std::fstream probeFile;
74 probeFile.open(probeFileName.c_str());
76 std::cout <<
"probemon: Unable to open probe file: "
77 << probeFileName << std::endl;
84 flowProbe.
SetLocation(probeLocationX,probeLocationY,probeLocationZ);
85 probesData.push_back(flowProbe);
86 std::cout <<
"probemon: Got " << nTimes <<
" probe values from "
87 << probeFileName <<
"." << std::endl;
90 std::ofstream plotFile;
91 std::ostringstream dataStreamOut;
92 dataStreamOut <<
"plot_data_" << iProbe <<
".txt";
93 std::string plotFileName(dataStreamOut.str());
94 plotFile.open(plotFileName.c_str());
96 std::cout <<
"probemon: Unable to open plot data file: " << plotFileName << std::endl;
102 std::ostringstream plotCommands;
103 plotCommands <<
"set title 'Probe " << iProbe <<
" Velocity'" << std::endl
104 <<
"set ylabel 'Velocity (m/s)" << std::endl
105 <<
"set term png" << std::endl
106 <<
"set key top right title ''" << std::endl
107 <<
"set output 'velocity_plot_"<< iProbe <<
".png'" << std::endl
108 <<
"plot '" << plotFileName <<
"' using 4:6 w l t 'X-velocity','"
109 << plotFileName <<
"' "
110 <<
"using 4:7 w l t 'Y-velocity','" << plotFileName
111 <<
"' using 4:8 w l t 'Z-velocity'"
115 plotCommands.clear();
116 plotCommands.str(
"");
117 plotCommands <<
"set title 'Probe " << iProbe <<
" Pressure and Temperature'" << std::endl
118 <<
"set ylabel 'Pressure (Pa)" << std::endl
119 <<
"set y2label 'Temperature (K)'" << std::endl
120 <<
"set term png" << std::endl
121 <<
"set key bottom right title ''" << std::endl
122 <<
"set ytics nomirror" << std::endl
123 <<
"set y2tics" << std::endl
124 <<
"set output 'pandt_plot_" << iProbe <<
".png'" << std::endl
125 <<
"plot '"<< plotFileName <<
"' using 4:9 w l t 'Pressure'"
126 <<
",'" << plotFileName <<
"' using 4:10 w l t 'Temperature' axes x1y2"
131 configFileName.assign(caseName+
".derived_config");
132 configIn.open(configFileName.c_str());
135 std::vector<IR::derivedprobe> derivedProbes;
141 htmlOut <<
" </body>" << std::endl
142 <<
"</html>" << std::endl;
143 std::ofstream htmlFile;
144 htmlFile.open(
"probemonitor.html");
145 htmlFile << htmlOut.str();
void WriteData(std::ostream &outStream, bool writeLoc=false)
int GNUPlot(const std::string &commands)
void SetLocation(double xLoc, double yLoc, double zLoc)
unsigned int ReadProbeData(std::istream &inStream)
std::string BuildProbeFileName(const std::string &caseName, int probeNumber)