12 #ifndef __OCP_OUTPUT_HEADER__
13 #define __OCP_OUTPUT_HEADER__
65 activity = src.activity;
71 activity = src.activity;
72 obj.assign(src.obj.begin(), src.obj.end());
116 void PrintInfo(
const string& dir)
const;
119 vector<SumItem> Sumdata;
158 void Setup(
const OCP_DBL& totalTime);
164 void PrintFastReview(
const string& dir)
const;
167 vector<OCP_DBL> time;
169 vector<OCP_DBL> dPmax;
170 vector<OCP_DBL> dVmax;
171 vector<OCP_DBL> dSmax;
172 vector<OCP_DBL> dNmax;
214 void Setup(
const string& dir,
const Reservoir& reservoir);
215 void PrintRPT(
const string& dir,
const Reservoir& rs,
const OCP_DBL& days)
const;
216 template <
typename T>
217 void PrintRPT_Scalar(ofstream& ifs,
218 const string& dataName,
222 const vector<GB_Pair>& gbPair,
223 const bool& useActive,
224 const OCP_DBL& alpha = 1.0)
const;
236 template <
typename T>
237 void Out4RPT::PrintRPT_Scalar(ofstream& myRPT,
238 const string& dataName,
242 const vector<GB_Pair>& gbPair,
243 const bool& useActive,
249 myRPT << OCP_SEP01(50) <<
"\n";
250 myRPT << dataName <<
" " << fixed << setprecision(3) << days
254 for (
OCP_USI n = 0; n < numGrid; n++) {
255 if (n % nx == 0) myRPT <<
"\n";
256 if (n % (nx * ny) == 0) myRPT <<
"\n\n";
259 GetIJKGrid(I, J, K, n);
260 myRPT << GetIJKformat(
"*", to_string(J), to_string(K), IJKspace);
263 if (gbPair[n].IsAct()) {
264 bId = gbPair[n].GetId();
265 myRPT << setw(10) << fixed << setprecision(3)
266 << gridVal[bId * gap] * alpha;
268 myRPT << setw(10) <<
" --- ";
272 for (
OCP_USI n = 0; n < numGrid; n++) {
273 if (n % nx == 0) myRPT <<
"\n";
274 if (n % (nx * ny) == 0) myRPT <<
"\n\n";
277 GetIJKGrid(I, J, K, n);
278 myRPT << GetIJKformat(
"*", to_string(J), to_string(K), IJKspace);
280 myRPT << setw(10) << fixed << setprecision(3) << gridVal[n * gap] * alpha;
291 void Setup(
const string& dir,
const Reservoir& rs,
const USI& ndates);
292 void PrintVTK(
const string& dir,
const Reservoir& rs,
const OCP_DBL& days)
const;
293 OCP_BOOL IfOutputVTK()
const {
return useVTK; }
297 mutable USI index{0};
303 mutable class MyMetisTest
315 mutable idx_t nedges;
316 mutable idx_t ncon{1};
317 mutable idx_t nparts{8};
318 mutable vector<idx_t> xadj;
319 mutable vector<idx_t> adjncy;
320 mutable vector<idx_t> adjwgt;
321 mutable vector<idx_t> vwgt;
322 mutable vector<idx_t> part;
323 mutable vector<USI> partitions;
324 const idx_t MAXWEIGHT = 100000000;
329 if (!useMetis)
return;
332 ng = rs.
grid.GetGridNum();
342 tmpConn[n].push_back(nb + w);
345 tmpConn.push_back(tmp);
349 const vector<vector<OCP_USI>>& myConn = tmpConn;
351 for (
OCP_USI n = 0; n < nb; n++) {
357 xadj.resize(nvtxs + 1);
359 adjncy.reserve(nedges);
360 adjwgt.reserve(nedges);
362 for (
OCP_USI n = 0; n < nb; n++) {
363 xadj[n + 1] = xadj[n] + myConn[n].size() - 1;
367 adjncy.push_back(myConn[n][i]);
372 adjncy.push_back(myConn[n][i]);
377 adjncy.push_back(myConn[n][i]);
378 adjwgt.push_back(MAXWEIGHT);
382 for (
USI w = 0; w < nw; w++) {
383 xadj[nb + w + 1] += xadj[nb + w] + myConn[nb + w].size();
384 for (
auto v : myConn[nb + w]) {
386 adjwgt.push_back(MAXWEIGHT);
391 part.resize(nvtxs, 0);
392 partitions.resize(ng + nw, nparts);
395 void MyPartitionFunc(decltype(METIS_PartGraphKway)* METIS_PartGraphFunc)
const
398 if (!useMetis)
return;
400 int ret = METIS_PartGraphFunc(&nvtxs, &ncon, xadj.data(), adjncy.data(),
401 vwgt.data(), NULL, adjwgt.data(), &nparts,
402 NULL, NULL, NULL, &objval, part.data());
404 if (ret != rstatus_et::METIS_OK) {
407 cout <<
"METIS_OK" << endl;
408 cout <<
"objval: " << objval << endl;
411 void SetPartitions(
const vector<USI> b2g)
const
413 if (!useMetis)
return;
416 for (n = 0; n < nb; n++) {
417 partitions[b2g[n]] = part[n];
420 for (
USI w = 0; w < nw; w++) {
421 partitions[ng + w] = part[n];
443 void PrintInfo()
const;
447 OCP_BOOL IfOutputVTK()
const {
return out4VTK.IfOutputVTK(); }
unsigned int USI
Generic unsigned integer.
double OCP_DBL
Double precision.
unsigned int OCP_USI
Long unsigned integer.
unsigned int OCP_BOOL
OCP_BOOL in OCP.
OCPControl class declaration.
Output reservoir information in vtk format.
ParamOutput class declaration.
Reservoir class declaration.
#define OCP_ABORT(msg)
Abort if critical error happens.
Supply basic tools used to output files.
Elapsed wall-time and CPU-cycles declaration.
vector< Well > wells
well set.
USI GetWellPerfNum(const USI &i) const
Return the num of perforations of well i.
Basic grid properties for output.
vector< USI > selfPtr
Self-pointer, the indices of the i-th bulk in neighbor[i]: numBulk.
vector< vector< OCP_USI > > neighbor
Neighboring information of each bulk: activeGridNum.
vector< USI > neighborNum
Number of neighbors of the i-th bulk: numBulk, self-included.
A structure of three-dimensional coordinates.
Collect important information of each time step for fast review.
All control parameters except for well controllers.
3D coordinate representation in OpenCAEPoro
The OCPOutput class manages different kinds of ways to output information.
vector< USI > index
Records the index of bulk or well, whose properties will be printed.
Top-level data structure for the OpenCAEPoro simulator.
void InputParam(ParamRead ¶m)
Read input parameters to an internal structure.
Collect more detailed information of each time step.
BulkConn conn
Bulk's connection info.
USI GetWellNum() const
Return the num of Well.
AllWells allWells
Wells class info.
OCP_USI GetBulkNum() const
Return the num of Bulk.
The SumItem class is an auxiliary structure storing summary data to output.
The Summary class manages the output in the summary file.
Used to store the contents of keyword whose contents are in form of string.
Used to store the contents of keyword whose contents are in form of coordinates.