OpenCAEPoro  0.2.0 Sep/22/2022
A simulator for multicomponent porous media flow
Public Member Functions | List of all members
Solver Class Reference

Solver class for overall solution methods. More...

#include <Solver.hpp>

Public Member Functions

void Setup (Reservoir &rs, const OCPControl &ctrl)
 Setup Solver.
 
void InitReservoir (Reservoir &rs) const
 Initialize the reservoir. More...
 
void RunSimulation (Reservoir &rs, OCPControl &ctrl, OCPOutput &output)
 Start simulation. More...
 

Detailed Description

Solver class for overall solution methods.

Definition at line 20 of file Solver.hpp.

Member Function Documentation

◆ InitReservoir()

void Solver::InitReservoir ( Reservoir rs) const

Initialize the reservoir.

Initialize the reservoir setting for different solution methods.

Definition at line 18 of file Solver.cpp.

19 {
20  // Initialize the fluid part
21  IsoTSolver.InitReservoir(rs);
22 }
void InitReservoir(Reservoir &rs) const
Initialize the Reservoir and prepare variables for some method.

References IsothermalSolver::InitReservoir().

◆ RunSimulation()

void Solver::RunSimulation ( Reservoir rs,
OCPControl ctrl,
OCPOutput output 
)

Start simulation.

Simulation will go through all time steps and call GoOneStep at each step.

Definition at line 25 of file Solver.cpp.

26 {
27  GetWallTime timer;
28  timer.Start();
29  output.PrintInfoSched(rs, ctrl, timer.Stop());
30  USI numTSteps = ctrl.GetNumTSteps();
31  for (USI d = 0; d < numTSteps - 1; d++)
32  {
33  rs.ApplyControl(d);
34  ctrl.ApplyControl(d, rs);
35  while (!ctrl.IsCriticalTime(d + 1))
36  {
37  GoOneStep(rs, ctrl);
38  output.SetVal(rs, ctrl);
39  }
40  output.PrintInfoSched(rs, ctrl, timer.Stop());
41  if (ctrl.printLevel > 2) {
42  // Print Summary and critical information at every TSTEP
43  output.PrintInfo();
44  }
45  // rs.allWells.ShowWellStatus(rs.bulk);
46  }
47 
48  if (rs.bulk.GetMixMode() == EOS_PVTW)
49  {
50  cout << "SSMSTA: " << setw(12) << rs.bulk.GetSSMSTAiters()
51  << setw(15) << rs.bulk.GetSSMSTAiters() * 1.0 / rs.bulk.GetSSMSTAcounts() << endl;
52  cout << "NRSTA: " << setw(12) << rs.bulk.GetNRSTAiters()
53  << setw(15) << rs.bulk.GetNRSTAiters() * 1.0 / rs.bulk.GetNRSTAcounts() << endl;
54  cout << "SSMSP: " << setw(12) << rs.bulk.GetSSMSPiters()
55  << setw(15) << rs.bulk.GetSSMSPiters() * 1.0 / rs.bulk.GetSSMSPcounts() << endl;
56  cout << "NRSP: " << setw(12) << rs.bulk.GetNRSPiters()
57  << setw(15) << rs.bulk.GetNRSPiters() * 1.0 / rs.bulk.GetNRSPcounts() << endl;
58  cout << "NRRR: " << setw(12) << rs.bulk.GetRRiters()
59  << setw(15) << rs.bulk.GetRRiters() * 1.0 / rs.bulk.GetRRcounts() << endl;
60  }
61  ctrl.RecordTotalTime(timer.Stop() / 1000);
62 }
const USI EOS_PVTW
Mixture model = equation-of-state.
Definition: OCPConst.hpp:89
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:22
USI GetMixMode() const
Return the mixture mode.
Definition: Bulk.cpp:2270
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
USI GetNumTSteps() const
Return number of TSTEPs.
Definition: OCPControl.hpp:127
void ApplyControl(const USI &i, const Reservoir &rs)
Apply control for time step i.
Definition: OCPControl.cpp:191
void RecordTotalTime(const OCP_DBL &t)
Record the total time of simulation.
Definition: OCPControl.hpp:166
bool IsCriticalTime(const USI &d)
Determine whether the critical time point has been reached.
Definition: OCPControl.hpp:173
void ApplyControl(const USI &i)
Apply the control of ith critical time point.
Definition: Reservoir.cpp:38

References Reservoir::ApplyControl(), OCPControl::ApplyControl(), EOS_PVTW, Bulk::GetMixMode(), OCPControl::GetNumTSteps(), OCPControl::IsCriticalTime(), OCPControl::RecordTotalTime(), GetWallTime::Start(), and GetWallTime::Stop().


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