OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
Public Member Functions | List of all members
OpenCAEPoro Class Reference

Top-level data structure for the OpenCAEPoro simulator. More...

#include <OCP.hpp>

Public Member Functions

void PrintVersion () const
 Output OpenCAEPoro version information.
 
void PrintUsage (string cmdname) const
 Provide at least InputFileName for the input data.
 
void ReadInputFile (const string &filename)
 Read Param from an input file. More...
 
void InputParam (ParamRead &param)
 Read input parameters to an internal structure. More...
 
void SetupSimulator (const USI &argc, const char *options[])
 Setup reservoir based on an internal structure. More...
 
void InitReservoir ()
 Initialize or get initial status of reservoir. More...
 
void RunSimulation ()
 Run dynamic simulation. More...
 
void OutputResults () const
 Output necessary information for post-processing. More...
 

Detailed Description

Top-level data structure for the OpenCAEPoro simulator.

Definition at line 26 of file OCP.hpp.

Member Function Documentation

◆ InitReservoir()

void OpenCAEPoro::InitReservoir ( )

Initialize or get initial status of reservoir.

Initialize the reservoir class.

Definition at line 69 of file OCP.cpp.

70 {
71  GetWallTime timer;
72  timer.Start();
73 
74  solver.InitReservoir(reservoir);
75 
76  double finalTime = timer.Stop() / 1000;
77  if (control.printLevel >= PRINT_MIN) {
78  cout << endl
79  << "Initialization done. Wall time : " << fixed << setprecision(3)
80  << finalTime << " Sec" << endl;
81  }
82  control.RecordTotalTime(finalTime);
83  control.initTime = finalTime;
84 }
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 RecordTotalTime(const OCP_DBL &t)
Record the total time of simulation.
Definition: OCPControl.hpp:172
void InitReservoir(Reservoir &rs) const
Initialize the reservoir.
Definition: Solver.cpp:45

References Solver::InitReservoir(), OCPControl::RecordTotalTime(), GetWallTime::Start(), and GetWallTime::Stop().

◆ InputParam()

void OpenCAEPoro::InputParam ( ParamRead param)

Read input parameters to an internal structure.

Read from internal param (from input files) and set control and output params.

Definition at line 24 of file OCP.cpp.

25 {
26  reservoir.InputParam(param);
27  control.InputParam(param.paramControl);
28  output.InputParam(param.paramOutput);
29 }
void InputParam(const ParamControl &CtrlParam)
Input parameters for control.
Definition: OCPControl.cpp:134
ParamOutput paramOutput
Read the output params.
Definition: ParamRead.hpp:45
ParamControl paramControl
Read the control params.
Definition: ParamRead.hpp:44
void InputParam(ParamRead &param)
Definition: Reservoir.cpp:18

References OCPControl::InputParam(), Reservoir::InputParam(), ParamRead::paramControl, and ParamRead::paramOutput.

◆ OutputResults()

void OpenCAEPoro::OutputResults ( ) const

Output necessary information for post-processing.

Print summary information on screen and SUMMARY.out file.

Definition at line 118 of file OCP.cpp.

119 {
120  // find an appropriate size for printing times
121  int fixWidth =
122  MAX(log10(control.current_time), log10(MAX(control.totalSimTime, 1.0))) + 6;
123 
124  cout << "==================================================" << endl;
125 
126  // print numbers of steps
127  cout << "Final time: " << right << fixed << setprecision(3)
128  << setw(fixWidth) << control.current_time << " (Days)" << endl;
129  cout << " - Avg time step size ......." << setw(fixWidth)
130  << control.current_time / control.numTstep << " (" << control.numTstep
131  << " steps)" << endl;
132  cout << " - Avg Newton steps ........." << setw(fixWidth)
133  << static_cast<double>(control.iterNR_total) / control.numTstep << " ("
134  << control.iterNR_total << " succeeded + " << control.wastedIterNR
135  << " wasted)" << endl;
136  cout << " - Avg linear steps ........." << setw(fixWidth)
137  << static_cast<double>(control.iterLS_total) / control.iterNR_total << " ("
138  << control.iterLS_total << " succeeded + " << control.wastedIterLS
139  << " wasted)" << endl;
140 
141  // print time usages
142  cout << "Simulation time: " << setw(fixWidth) << control.totalSimTime
143  << " (Seconds)" << endl;
144  cout << " - % Initialization ........." << setw(fixWidth)
145  << 100.0 * control.initTime / control.totalSimTime << " (" << control.initTime
146  << "s)" << endl;
147  cout << " - % Assembling ............." << setw(fixWidth)
148  << 100.0 * control.totalAssembleMatTime / control.totalSimTime << " ("
149  << control.totalAssembleMatTime << "s)" << endl;
150  cout << " - % Linear solver .........." << setw(fixWidth)
151  << 100.0 * control.totalLStime / control.totalSimTime << " ("
152  << control.totalLStime << "s)" << endl;
153  cout << " - % Updating properties ...." << setw(fixWidth)
154  << 100.0 * control.totalUpdatePropertyTime / control.totalSimTime << " ("
155  << control.totalUpdatePropertyTime << "s)" << endl;
156  cout << " - % Scheduled output ......." << setw(fixWidth)
157  << 100.0 * output.outputTime / control.totalSimTime << " ("
158  << output.outputTime << "s)" << endl;
159 
160  cout << "==================================================" << endl;
161 
162  output.PrintInfo();
163 }

◆ ReadInputFile()

void OpenCAEPoro::ReadInputFile ( const string &  filename)

Read Param from an input file.

Read Param from input file.

Definition at line 15 of file OCP.cpp.

16 {
17  ParamRead rp;
18  rp.ReadInputFile(filename);
19  // Read parameters from input file
20  InputParam(rp);
21 }
void InputParam(ParamRead &param)
Read input parameters to an internal structure.
Definition: OCP.cpp:24
Pre-processing unit for OpenCAEPoro for reading params from input files.
Definition: ParamRead.hpp:33
void ReadInputFile(const string &file)
General interface for reading input data.
Definition: ParamRead.cpp:39

References InputParam(), and ParamRead::ReadInputFile().

◆ RunSimulation()

void OpenCAEPoro::RunSimulation ( )

Run dynamic simulation.

Call IMPEC, FIM, AIM, etc for dynamic simulation.

Definition at line 87 of file OCP.cpp.

88 {
89  switch (control.GetMethod()) {
90  case IMPEC:
91  if (control.printLevel >= PRINT_MIN) {
92  cout << "\nDynamic simulation with IMPEC\n" << endl;
93  }
94  break;
95  case FIM:
96  if (control.printLevel >= PRINT_MIN) {
97  cout << "\nDynamic simulation with FIM\n" << endl;
98  }
99  break;
100  case FIMn:
101  if (control.printLevel >= PRINT_MIN) {
102  cout << "\nDynamic simulation with FIMn\n" << endl;
103  }
104  break;
105  case AIMc:
106  if (control.printLevel >= PRINT_MIN) {
107  cout << "\nDynamic simulation with AIMc\n" << endl;
108  }
109  break;
110  default:
111  OCP_ABORT("Wrong method type is used!");
112  }
113 
114  solver.RunSimulation(reservoir, control, output);
115 }
const USI FIMn
Solution method = FIM.
Definition: OCPConst.hpp:84
const USI FIM
Solution method = FIM.
Definition: OCPConst.hpp:82
const USI AIMc
Adaptive implicit -— Collins.
Definition: OCPConst.hpp:83
const USI IMPEC
Solution method = IMPEC.
Definition: OCPConst.hpp:81
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
USI GetMethod() const
Return type of the solution method.
Definition: OCPControl.hpp:124
void RunSimulation(Reservoir &rs, OCPControl &ctrl, OCPOutput &output)
Start simulation.
Definition: Solver.cpp:61

References AIMc, FIM, FIMn, OCPControl::GetMethod(), IMPEC, OCP_ABORT, and Solver::RunSimulation().

◆ SetupSimulator()

void OpenCAEPoro::SetupSimulator ( const USI argc,
const char *  options[] 
)

Setup reservoir based on an internal structure.

Call setup procedures for reservoir, output, and linear solver.

Definition at line 32 of file OCP.cpp.

33 {
34  GetWallTime timer;
35  timer.Start();
36 
37  control.SetupFastControl(argc, options); // Read Fast control
38 
39  switch (control.GetModel()) {
40  case ISOTHERMALMODEL:
41  if (control.printLevel >= PRINT_MIN) {
42  cout << endl << "Dynamic simulation for isothermal models" << endl;
43  }
44  break;
45  case THERMALMODEL:
46  if (control.printLevel >= PRINT_MIN) {
47  cout << endl << "Dynamic simulation for thermal models" << endl;
48  }
49  break;
50  default:
51  OCP_ABORT("Wrong model type specified!");
52  }
53 
54  solver.Setup(reservoir, control); // Setup static info for solver
55 
56  output.Setup(reservoir, control); // Setup output for dynamic simulation
57 
58  double finalTime = timer.Stop() / 1000;
59  if (control.printLevel >= PRINT_MIN) {
60  cout << endl
61  << "Setup simulation done. Wall time : " << fixed << setprecision(3)
62  << finalTime << " Sec" << endl;
63  }
64 
65  control.RecordTotalTime(finalTime);
66 }
void SetupFastControl(const USI &argc, const char *optset[])
Setup fast Control.
Definition: OCPControl.cpp:197
USI GetModel() const
Get model.
Definition: OCPControl.hpp:112
void Setup(Reservoir &rs, const OCPControl &ctrl)
Setup Solver.
Definition: Solver.cpp:15

References OCPControl::GetModel(), OCPControl::SetupFastControl(), and GetWallTime::Start().


The documentation for this class was generated from the following files: