OpenCAEPoro  v0.5.0
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 21 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 45 of file Solver.cpp.

46 {
47  switch (OCPModel) {
48  case ISOTHERMALMODEL:
49  IsoTSolver.InitReservoir(rs);
50  break;
51  case THERMALMODEL:
52  TSolver.InitReservoir(rs);
53  break;
54  default:
55  OCP_ABORT("Wrong model type specified!");
56  break;
57  }
58 }
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
void InitReservoir(Reservoir &rs) const
Initialize the Reservoir and prepare variables for some method.

◆ 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 61 of file Solver.cpp.

62 {
63  GetWallTime timer;
64  timer.Start();
65  output.PrintInfoSched(rs, ctrl, timer.Stop());
66  USI numTSteps = ctrl.GetNumTSteps();
67  for (USI d = 0; d < numTSteps - 1; d++) {
68  rs.ApplyControl(d);
69  ctrl.ApplyControl(d, rs);
70  while (!ctrl.IsCriticalTime(d + 1)) {
71  GoOneStep(rs, ctrl);
72  output.SetVal(rs, ctrl);
73  if (ctrl.printLevel >= PRINT_ALL) {
74  // Print Summary and critical information at every time step
75  output.PrintInfo();
76  }
77  }
78  output.PrintInfoSched(rs, ctrl, timer.Stop());
79  // rs.allWells.ShowWellStatus(rs.bulk);
80  }
81  rs.OutInfoFinal();
82  ctrl.RecordTotalTime(timer.Stop() / 1000);
83 }
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
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:173
void RecordTotalTime(const OCP_DBL &t)
Record the total time of simulation.
Definition: OCPControl.hpp:172
OCP_BOOL IsCriticalTime(const USI &d)
Determine whether the critical time point has been reached.
Definition: OCPControl.hpp:175
void ApplyControl(const USI &i)
Apply the control of ith critical time point.
Definition: Reservoir.cpp:48

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


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