OpenCAEPoro  0.2.0 Sep/22/2022
A simulator for multicomponent porous media flow
OCP.cpp
Go to the documentation of this file.
1 
12 #include "OCP.hpp"
13 
16 {
17  reservoir.InputParam(param);
18  control.InputParam(param.paramControl);
19  output.InputParam(param.paramOutput);
20 }
21 
24  const USI& argc,
25  const char* options[])
26 {
27  GetWallTime timer;
28  timer.Start();
29 
30  // Read parameters from input file
31  InputParam(param);
32  // Read Fast control
33  control.SetupFastControl(argc, options);
34  // Setup static infomation for reservoir
35  reservoir.Setup();
36  // Setup output for dynamic simulation
37  output.Setup(reservoir, control);
38  // Setup static information for solver
39  solver.Setup(reservoir, control);
40 
41  cout << endl
42  << "Setup simulation done. Wall time : " << fixed << setprecision(3)
43  << timer.Stop() / 1000 << " Sec" << endl
44  << endl;
45  control.RecordTotalTime(timer.Stop() / 1000);
46 }
47 
50 {
51  GetWallTime timer;
52  timer.Start();
53 
54  solver.InitReservoir(reservoir);
55 
56  cout << endl
57  << "Initialization done. Wall time : " << fixed << setprecision(3)
58  << timer.Stop() / 1000 << " Sec" << endl;
59  control.RecordTotalTime(timer.Stop() / 1000);
60 }
61 
64 {
65  cout << "\n=========================================" << endl;
66  switch (control.GetMethod()) {
67  case IMPEC:
68  cout << "Dynamic simulation with IMPEC";
69  break;
70  case FIM:
71  cout << "Dynamic simulation with FIM";
72  break;
73  case FIMn:
74  cout << "Dynamic simulation with FIMn";
75  break;
76  case AIMc:
77  cout << "Dynamic simulation with AIMc";
78  break;
79  case AIMs:
80  cout << "Dynamic simulation with AIMs";
81  break;
82  case AIMt:
83  cout << "Dynamic simulation with AIMt";
84  break;
85  default:
86  OCP_ABORT("Wrong method type is used!");
87  }
88  cout << "\n=========================================" << endl;
89 
90  solver.RunSimulation(reservoir, control, output);
91 }
92 
95 {
96  cout << "=========================================" << endl;
97  cout << "Final time: " << control.current_time << " Days" << endl;
98  cout << "Total time steps: " << control.numTstep << endl;
99  cout << "Total Newton steps: " << control.iterNR_total << " (+"
100  << control.wastedIterNR << " wasted steps)" << endl;
101  cout << "Total linear steps: " << control.iterLS_total << " (+"
102  << control.wastedIterLS << " wasted steps)" << endl;
103  cout << "Linear solve time: " << control.totalLStime << "s"
104  << " (" << 100.0 * control.totalLStime / control.totalSimTime << "%)" << endl;
105  cout << "Simulation time: " << control.totalSimTime << "s" << endl;
106  output.PrintInfo();
107 }
108 
109 /*----------------------------------------------------------------------------*/
110 /* Brief Change History of This File */
111 /*----------------------------------------------------------------------------*/
112 /* Author Date Actions */
113 /*----------------------------------------------------------------------------*/
114 /* Shizhe Li Oct/01/2021 Create file */
115 /* Chensong Zhang Dec/05/2021 Format file */
116 /*----------------------------------------------------------------------------*/
const USI AIMs
Adaptive implicit.
Definition: OCPConst.hpp:72
const USI AIMt
improved version of IMPEC, loacl FIM after IMPEC
Definition: OCPConst.hpp:73
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:22
const USI FIMn
Solution method = FIM.
Definition: OCPConst.hpp:75
const USI FIM
Solution method = FIM.
Definition: OCPConst.hpp:71
const USI AIMc
Adaptive implicit -— Collins.
Definition: OCPConst.hpp:74
const USI IMPEC
Solution method = IMPEC.
Definition: OCPConst.hpp:70
Main header file for OpenCAEPoro simulator.
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
Get elapsed wall-time in millisecond.
Definition: UtilTiming.hpp:32
__inline__ double Stop() const
Stop the timer and return duration from start() in ms.
Definition: UtilTiming.hpp:54
__inline__ void Start()
Start the timer.
Definition: UtilTiming.hpp:51
void SetupFastControl(const USI &argc, const char *optset[])
Setup fast Control.
Definition: OCPControl.cpp:217
void RecordTotalTime(const OCP_DBL &t)
Record the total time of simulation.
Definition: OCPControl.hpp:166
void InputParam(const ParamControl &CtrlParam)
Input parameters for control.
Definition: OCPControl.cpp:149
USI GetMethod() const
Return type of the solution method.
Definition: OCPControl.hpp:124
void InputParam(ParamRead &param)
Read input parameters to an internal structure.
Definition: OCP.cpp:15
void SetupSimulator(ParamRead &param, const USI &argc, const char *options[])
Setup reservoir based on an internal structure.
Definition: OCP.cpp:23
void RunSimulation()
Run dynamic simulation.
Definition: OCP.cpp:63
void OutputResults() const
Output necessary information for post-processing.
Definition: OCP.cpp:94
void InitReservoir()
Initialize or get initial status of reservoir.
Definition: OCP.cpp:49
Pre-processing unit for OpenCAEPoro for reading params from input files.
Definition: ParamRead.hpp:33
ParamOutput paramOutput
Read the output params.
Definition: ParamRead.hpp:45
ParamControl paramControl
Read the control params.
Definition: ParamRead.hpp:44
void Setup()
Setup static information for reservoir with input params.
Definition: Reservoir.cpp:28
void InputParam(ParamRead &param)
Definition: Reservoir.cpp:18
void Setup(Reservoir &rs, const OCPControl &ctrl)
Setup Solver.
Definition: Solver.cpp:15
void RunSimulation(Reservoir &rs, OCPControl &ctrl, OCPOutput &output)
Start simulation.
Definition: Solver.cpp:25
void InitReservoir(Reservoir &rs) const
Initialize the reservoir.
Definition: Solver.cpp:18