OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Main.cpp
Go to the documentation of this file.
1 
12 // Standard header files
13 #include <cstdio>
14 #include <iostream>
15 #include <string>
16 
17 // OpenCAEPoro header files
18 #include "OCP.hpp"
19 #include "ParamRead.hpp"
20 
21 using namespace std;
22 
24 int main(int argc, const char* argv[])
25 {
26  // Step 0. Print simulator version information.
27  OpenCAEPoro simulator;
28  if (argc < 2) {
29  simulator.PrintUsage(argv[0]);
30  return OCP_ERROR_NUM_INPUT; // Need at least one parameter
31  } else {
32  simulator.PrintVersion();
33  if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) {
34  simulator.PrintUsage(argv[0]);
35  return OCP_SUCCESS;
36  }
37  }
38 
39  // Step 1. Read params from an input file to internal data structure.
40  // Remark: The keywords are almost compatible with Ecl100/300; see Keywords.md.
41  simulator.ReadInputFile(argv[1]);
42 
43  // Step 2. Set params using command-line
44  // Remark: It sets up static info, such as active grids and their connections.
45  // Remark: Memory allocation for linear systems will also be done at this step.
46  simulator.SetupSimulator(argc, argv);
47 
48  // Step 3. Initialize the reservoir, which finishes the first step in iterations.
49  // Examples: Initial pressure, saturations, moles of components, initial guess of
50  // well pressure.
51  simulator.InitReservoir();
52 
53  // Step 4. Run dynamic simulation using methods like IMPEC, AIM, and FIM.
54  simulator.RunSimulation();
55 
56  // Step 5. Output the results according to control params.
57  // Remark: It will generate a summary file in your input data directory.
58  simulator.OutputResults();
59 
60  return OCP_SUCCESS;
61 }
62 
63 /*----------------------------------------------------------------------------*/
64 /* Brief Change History of This File */
65 /*----------------------------------------------------------------------------*/
66 /* Author Date Actions */
67 /*----------------------------------------------------------------------------*/
68 /* Shizhe Li Oct/01/2021 Create file */
69 /* Chensong Zhang Jan/07/2022 Update documentation */
70 /*----------------------------------------------------------------------------*/
int main(int argc, const char *argv[])
The main() function performs dynamic simulation in five steps.
Definition: Main.cpp:24
const int OCP_SUCCESS
Finish without trouble.
Definition: OCPConst.hpp:32
const int OCP_ERROR_NUM_INPUT
Wrong number of input param.
Definition: OCPConst.hpp:33
Main header file for OpenCAEPoro simulator.
ParamRead class declaration.
Top-level data structure for the OpenCAEPoro simulator.
Definition: OCP.hpp:27
void PrintUsage(string cmdname) const
Provide at least InputFileName for the input data.
Definition: OCP.hpp:38
void RunSimulation()
Run dynamic simulation.
Definition: OCP.cpp:87
void OutputResults() const
Output necessary information for post-processing.
Definition: OCP.cpp:118
void InitReservoir()
Initialize or get initial status of reservoir.
Definition: OCP.cpp:69
void SetupSimulator(const USI &argc, const char *options[])
Setup reservoir based on an internal structure.
Definition: OCP.cpp:32
void PrintVersion() const
Output OpenCAEPoro version information.
Definition: OCP.hpp:30
void ReadInputFile(const string &filename)
Read Param from an input file.
Definition: OCP.cpp:15