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

IsothermalSolver class for fluid solution method. More...

#include <IsothermalSolver.hpp>

Public Member Functions

void SetupMethod (Reservoir &rs, const OCPControl &ctrl)
 Setup the fluid solver. More...
 
void InitReservoir (Reservoir &rs) const
 Initialize the Reservoir and prepare variables for some method. More...
 
void Prepare (Reservoir &rs, OCPControl &ctrl)
 Prepare for assembling Mat. More...
 
void AssembleMat (const Reservoir &rs, OCPControl &ctrl)
 Assemble Mat. More...
 
void SolveLinearSystem (Reservoir &rs, OCPControl &ctrl)
 Solve the linear system in single problem. More...
 
OCP_BOOL UpdateProperty (Reservoir &rs, OCPControl &ctrl)
 Update properties of fluid. More...
 
OCP_BOOL FinishNR (Reservoir &rs, OCPControl &ctrl)
 Finish the Newton-Raphson iteration. More...
 
void FinishStep (Reservoir &rs, OCPControl &ctrl)
 Finish the current time step. More...
 

Detailed Description

IsothermalSolver class for fluid solution method.

Definition at line 19 of file IsothermalSolver.hpp.

Member Function Documentation

◆ AssembleMat()

void IsothermalSolver::AssembleMat ( const Reservoir rs,
OCPControl ctrl 
)

Assemble Mat.

Assemble linear systems for IMPEC and FIM.

Definition at line 79 of file IsothermalSolver.cpp.

80 {
81  const OCP_DBL dt = ctrl.GetCurDt();
82 
83  GetWallTime timer;
84  timer.Start();
85 
86  switch (method) {
87  case IMPEC:
88  impec.AssembleMat(LSolver, rs, dt);
89  break;
90  case FIMn:
91  fim_n.AssembleMat(LSolver, rs, dt);
92  break;
93  case FIM:
94  fim.AssembleMat(LSolver, rs, dt);
95  break;
96  case AIMc:
97  aimc.AssembleMat(LSolver, rs, dt);
98  break;
99  default:
100  OCP_ABORT("Wrong method type!");
101  }
102 
103  ctrl.RecordTimeAssembleMat(timer.Stop() / 1000);
104 }
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
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
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 AssembleMat(LinearSystem &ls, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
void AssembleMat(LinearSystem &ls, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
void AssembleMat(LinearSystem &ls, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
void AssembleMat(LinearSystem &ls, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
OCP_DBL GetCurDt() const
Return current time step size.
Definition: OCPControl.hpp:133
void RecordTimeAssembleMat(const OCP_DBL &t)
Record time used for assemble matrix.
Definition: OCPControl.hpp:166

References AIMc, IsoT_IMPEC::AssembleMat(), IsoT_FIM::AssembleMat(), IsoT_FIMn::AssembleMat(), IsoT_AIMc::AssembleMat(), FIM, FIMn, OCPControl::GetCurDt(), IMPEC, OCP_ABORT, OCPControl::RecordTimeAssembleMat(), GetWallTime::Start(), and GetWallTime::Stop().

◆ FinishNR()

OCP_BOOL IsothermalSolver::FinishNR ( Reservoir rs,
OCPControl ctrl 
)

Finish the Newton-Raphson iteration.

Finish up Newton-Raphson iteration for IMPEC and FIM.

Definition at line 158 of file IsothermalSolver.cpp.

159 {
160  switch (method) {
161  case IMPEC:
162  return impec.FinishNR(rs);
163  case FIMn:
164  return fim_n.FinishNR(rs, ctrl);
165  case FIM:
166  return fim.FinishNR(rs, ctrl);
167  case AIMc:
168  return aimc.FinishNR(rs, ctrl);
169  default:
170  OCP_ABORT("Wrong method type!");
171  }
172 }
OCP_BOOL FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish a Newton-Raphson iteration.
OCP_BOOL FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish a Newton-Raphson iteration.
OCP_BOOL FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish a Newton-Raphson iteration.
OCP_BOOL FinishNR(const Reservoir &rs)
Determine if NR iteration finishes.

References AIMc, FIM, FIMn, IsoT_IMPEC::FinishNR(), IsoT_FIM::FinishNR(), IsoT_FIMn::FinishNR(), IsoT_AIMc::FinishNR(), IMPEC, and OCP_ABORT.

◆ FinishStep()

void IsothermalSolver::FinishStep ( Reservoir rs,
OCPControl ctrl 
)

Finish the current time step.

Finish up time step for IMPEC and FIM.

Definition at line 175 of file IsothermalSolver.cpp.

176 {
177  switch (method) {
178  case IMPEC:
179  impec.FinishStep(rs, ctrl);
180  break;
181  case FIMn:
182  fim_n.FinishStep(rs, ctrl);
183  break;
184  case FIM:
185  fim.FinishStep(rs, ctrl);
186  break;
187  case AIMc:
188  aimc.FinishStep(rs, ctrl);
189  break;
190  default:
191  OCP_ABORT("Wrong method type!");
192  }
193  ctrl.UpdateIters();
194 }
void FinishStep(Reservoir &rs, OCPControl &ctrl) const
Finish a time step.
void FinishStep(Reservoir &rs, OCPControl &ctrl)
Finish a time step.
void FinishStep(Reservoir &rs, OCPControl &ctrl) const
Finish a time step.
void UpdateIters()
Update the number of iterations.
Definition: OCPControl.cpp:225

References AIMc, FIM, FIMn, IsoT_FIM::FinishStep(), IsoT_FIMn::FinishStep(), IsoT_AIMc::FinishStep(), IMPEC, OCP_ABORT, and OCPControl::UpdateIters().

◆ InitReservoir()

void IsothermalSolver::InitReservoir ( Reservoir rs) const

Initialize the Reservoir and prepare variables for some method.

Setup solution methods, including IMPEC and FIM.

Definition at line 37 of file IsothermalSolver.cpp.

38 {
39  switch (method) {
40  case IMPEC:
41  impec.InitReservoir(rs);
42  break;
43  case FIM:
44  fim.InitReservoir(rs);
45  break;
46  case FIMn:
47  fim_n.InitReservoir(rs);
48  break;
49  case AIMc:
50  aimc.InitReservoir(rs);
51  break;
52  default:
53  OCP_ABORT("Wrong method type!");
54  }
55 }
void InitReservoir(Reservoir &rs) const
Init.
void InitReservoir(Reservoir &rs) const
Init.
void InitReservoir(Reservoir &rs) const
Init.
void InitReservoir(Reservoir &rs) const
Init.

References AIMc, FIM, FIMn, IMPEC, IsoT_IMPEC::InitReservoir(), IsoT_FIM::InitReservoir(), IsoT_FIMn::InitReservoir(), IsoT_AIMc::InitReservoir(), and OCP_ABORT.

◆ Prepare()

void IsothermalSolver::Prepare ( Reservoir rs,
OCPControl ctrl 
)

Prepare for assembling Mat.

Prepare solution methods, including IMPEC and FIM.

Definition at line 58 of file IsothermalSolver.cpp.

59 {
60  switch (method) {
61  case IMPEC:
62  impec.Prepare(rs, ctrl);
63  break;
64  case FIMn:
65  fim_n.Prepare(rs, ctrl.GetCurDt());
66  break;
67  case FIM:
68  fim.Prepare(rs, ctrl.GetCurDt());
69  break;
70  case AIMc:
71  aimc.Prepare(rs, ctrl.GetCurDt());
72  break;
73  default:
74  OCP_ABORT("Wrong method type!");
75  }
76 }
void Prepare(Reservoir &rs, const OCP_DBL &dt)
Prepare for Assembling matrix.
void Prepare(Reservoir &rs, const OCP_DBL &dt)
Prepare for Assembling matrix.
void Prepare(Reservoir &rs, const OCP_DBL &dt)
Prepare for Assembling matrix.
void Prepare(Reservoir &rs, OCPControl &ctrl)
Prepare for Assembling matrix.

References AIMc, FIM, FIMn, OCPControl::GetCurDt(), IMPEC, OCP_ABORT, IsoT_FIM::Prepare(), IsoT_FIMn::Prepare(), IsoT_AIMc::Prepare(), and IsoT_IMPEC::Prepare().

◆ SetupMethod()

void IsothermalSolver::SetupMethod ( Reservoir rs,
const OCPControl ctrl 
)

Setup the fluid solver.

Setup solution methods, including IMPEC and FIM.

Definition at line 15 of file IsothermalSolver.cpp.

16 {
17  method = ctrl.GetMethod();
18 
19  switch (method) {
20  case IMPEC:
21  impec.Setup(rs, LSolver, ctrl);
22  break;
23  case AIMc:
24  aimc.Setup(rs, LSolver, ctrl);
25  break;
26  case FIMn:
27  fim_n.Setup(rs, LSolver, ctrl);
28  break;
29  case FIM:
30  default:
31  fim.Setup(rs, LSolver, ctrl);
32  break;
33  }
34 }
void Setup(Reservoir &rs, LinearSystem &ls, const OCPControl &ctrl)
Setup AIMc.
void Setup(Reservoir &rs, LinearSystem &ls, const OCPControl &ctrl)
Setup FIM.
void Setup(Reservoir &rs, LinearSystem &ls, const OCPControl &ctrl)
Setup FIM.
void Setup(Reservoir &rs, LinearSystem &ls, const OCPControl &ctrl)
Setup IMPEC.
USI GetMethod() const
Return type of the solution method.
Definition: OCPControl.hpp:124

References AIMc, FIM, FIMn, OCPControl::GetMethod(), IMPEC, IsoT_IMPEC::Setup(), IsoT_FIM::Setup(), IsoT_FIMn::Setup(), and IsoT_AIMc::Setup().

◆ SolveLinearSystem()

void IsothermalSolver::SolveLinearSystem ( Reservoir rs,
OCPControl ctrl 
)

Solve the linear system in single problem.

Solve linear systems for IMPEC and FIM.

Definition at line 107 of file IsothermalSolver.cpp.

108 {
109  switch (method) {
110  case IMPEC:
111  impec.SolveLinearSystem(LSolver, rs, ctrl);
112  break;
113  case FIMn:
114  fim_n.SolveLinearSystem(LSolver, rs, ctrl);
115  break;
116  case FIM:
117  fim.SolveLinearSystem(LSolver, rs, ctrl);
118  break;
119  case AIMc:
120  aimc.SolveLinearSystem(LSolver, rs, ctrl);
121  break;
122  default:
123  OCP_ABORT("Wrong method type!");
124  }
125 }
void SolveLinearSystem(LinearSystem &ls, Reservoir &rs, OCPControl &ctrl)
Solve the linear system.
void SolveLinearSystem(LinearSystem &ls, Reservoir &rs, OCPControl &ctrl) const
Solve the linear system.
void SolveLinearSystem(LinearSystem &ls, Reservoir &rs, OCPControl &ctrl) const
Solve the linear system.
void SolveLinearSystem(LinearSystem &ls, Reservoir &rs, OCPControl &ctrl)
Solve the linear system.

References AIMc, FIM, FIMn, IMPEC, OCP_ABORT, IsoT_IMPEC::SolveLinearSystem(), IsoT_AIMc::SolveLinearSystem(), IsoT_FIM::SolveLinearSystem(), and IsoT_FIMn::SolveLinearSystem().

◆ UpdateProperty()

OCP_BOOL IsothermalSolver::UpdateProperty ( Reservoir rs,
OCPControl ctrl 
)

Update properties of fluid.

Update physical properties for IMPEC and FIM.

Definition at line 128 of file IsothermalSolver.cpp.

129 {
130  OCP_BOOL flag;
131 
132  GetWallTime timer;
133  timer.Start();
134 
135  switch (method) {
136  case IMPEC:
137  flag = impec.UpdateProperty(rs, ctrl);
138  break;
139  case FIMn:
140  flag = fim_n.UpdateProperty(rs, ctrl);
141  break;
142  case FIM:
143  flag = fim.UpdateProperty(rs, ctrl);
144  break;
145  case AIMc:
146  flag = aimc.UpdateProperty(rs, ctrl);
147  break;
148  default:
149  OCP_ABORT("Wrong method type!");
150  }
151 
152  ctrl.RecordTimeUpdateProperty(timer.Stop() / 1000);
153 
154  return flag;
155 }
unsigned int OCP_BOOL
OCP_BOOL in OCP.
Definition: OCPConst.hpp:29
OCP_BOOL UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
OCP_BOOL UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
OCP_BOOL UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
OCP_BOOL UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
void RecordTimeUpdateProperty(const OCP_DBL &t)
Record time used for update property.
Definition: OCPControl.hpp:169

References AIMc, FIM, FIMn, IMPEC, OCP_ABORT, OCPControl::RecordTimeUpdateProperty(), GetWallTime::Start(), GetWallTime::Stop(), IsoT_IMPEC::UpdateProperty(), IsoT_FIM::UpdateProperty(), IsoT_FIMn::UpdateProperty(), and IsoT_AIMc::UpdateProperty().


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