OpenCAEPoro  0.2.0 Sep/22/2022
A simulator for multicomponent porous media flow
IsothermalSolver.cpp
Go to the documentation of this file.
1 
12 #include "IsothermalSolver.hpp"
13 
16 {
17  method = ctrl.GetMethod();
18 
19  switch (method)
20  {
21  case AIMt:
22  aimt.Setup(rs, LSolver, auxLSolver, ctrl);
23  break;
24  case AIMs:
25  aims.Setup(rs, LSolver, ctrl);
26  break;
27  case IMPEC:
28  impec.Setup(rs, LSolver, ctrl);
29  break;
30  case AIMc:
31  aimc.Setup(rs, LSolver, ctrl);
32  break;
33  case FIMn:
34  fim_n.Setup(rs, LSolver, ctrl);
35  break;
36  case FIM:
37  default:
38  fim.Setup(rs, LSolver, ctrl);
39  break;
40  }
41 }
42 
45 {
46  switch (method)
47  {
48  case IMPEC:
49  case AIMt:
50  case AIMs:
51  impec.InitReservoir(rs);
52  break;
53  case FIM:
54  fim.InitReservoir(rs);
55  break;
56  case FIMn:
57  fim_n.InitReservoir(rs);
58  break;
59  case AIMc:
60  aimc.InitReservoir(rs);
61  break;
62  default:
63  OCP_ABORT("Wrong method type!");
64  }
65 }
66 
69 {
70  switch (method)
71  {
72  case IMPEC:
73  impec.Prepare(rs, dt);
74  break;
75  case FIMn:
76  fim_n.Prepare(rs, dt);
77  break;
78  case FIM:
79  fim.Prepare(rs, dt);
80  break;
81  case AIMc:
82  aimc.Prepare(rs, dt);
83  break;
84  case AIMs:
85  aims.Prepare(rs, dt);
86  break;
87  case AIMt:
88  aimt.Prepare(rs, dt);
89  break;
90  default:
91  OCP_ABORT("Wrong method type!");
92  }
93 }
94 
97 {
98  switch (method)
99  {
100  case IMPEC:
101  case AIMt:
102  rs.AssembleMatIMPEC(LSolver, dt);
103  break;
104  case FIMn:
105  fim_n.AssembleMat(LSolver, rs, dt);
106  break;
107  case FIM:
108  fim.AssembleMat(LSolver, rs, dt);
109  break;
110  case AIMc:
111  aimc.AssembleMat(LSolver, rs, dt);
112  break;
113  case AIMs:
114  aims.AssembleMat(LSolver, rs, dt);
115  break;
116  default:
117  OCP_ABORT("Wrong method type!");
118  }
119 }
120 
123 {
124  switch (method)
125  {
126  case IMPEC:
127  case AIMt:
128  impec.SolveLinearSystem(LSolver, rs, ctrl);
129  break;
130  case FIMn:
131  fim_n.SolveLinearSystem(LSolver, rs, ctrl);
132  break;
133  case FIM:
134  fim.SolveLinearSystem(LSolver, rs, ctrl);
135  break;
136  case AIMc:
137  aimc.SolveLinearSystem(LSolver, rs, ctrl);
138  break;
139  case AIMs:
140  aims.SolveLinearSystem(LSolver, rs, ctrl);
141  break;
142  default:
143  OCP_ABORT("Wrong method type!");
144  }
145 }
146 
149 {
150  switch (method) {
151  case IMPEC:
152  return impec.UpdateProperty(rs, ctrl);
153  // return impec.UpdateProperty01(rs, ctrl);
154  case FIMn:
155  return fim_n.UpdateProperty(rs, ctrl);
156  case FIM:
157  return fim.UpdateProperty(rs, ctrl);
158  case AIMc:
159  return aimc.UpdateProperty(rs, ctrl);
160  case AIMs:
161  return aims.UpdateProperty(rs, ctrl);
162  case AIMt:
163  return aimt.UpdateProperty(rs, ctrl, auxLSolver);
164  default:
165  OCP_ABORT("Wrong method type!");
166  }
167 }
168 
171 {
172  switch (method) {
173  case IMPEC:
174  case AIMt:
175  return impec.FinishNR(rs);
176  // return impec.FinishNR01(rs, ctrl);
177  case AIMs:
178  return aims.FinishNR(rs, ctrl);
179  case FIMn:
180  return fim_n.FinishNR(rs, ctrl);
181  case FIM:
182  return fim.FinishNR(rs, ctrl);
183  case AIMc:
184  return aimc.FinishNR(rs, ctrl);
185  default:
186  OCP_ABORT("Wrong method type!");
187  }
188 }
189 
192 {
193  switch (method)
194  {
195  case IMPEC:
196  case AIMt:
197  return impec.FinishStep(rs, ctrl);
198  case FIMn:
199  return fim_n.FinishStep(rs, ctrl);
200  case FIM:
201  case AIMc:
202  return fim.FinishStep(rs, ctrl);
203  case AIMs:
204  return aims.FinishStep(rs, ctrl);
205  default:
206  OCP_ABORT("Wrong method type!");
207  }
208 }
209 
210 /*----------------------------------------------------------------------------*/
211 /* Brief Change History of This File */
212 /*----------------------------------------------------------------------------*/
213 /* Author Date Actions */
214 /*----------------------------------------------------------------------------*/
215 /* Shizhe Li Oct/21/2021 Create file */
216 /* Chensong Zhang Jan/08/2022 Update Doxygen */
217 /*----------------------------------------------------------------------------*/
IsothermalSolver class declaration.
const USI AIMs
Adaptive implicit.
Definition: OCPConst.hpp:72
const USI AIMt
improved version of IMPEC, loacl FIM after IMPEC
Definition: OCPConst.hpp:73
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:26
const USI FIMn
Solution method = FIM.
Definition: OCPConst.hpp:75
const USI FIM
Solution method = FIM.
Definition: OCPConst.hpp:71
const USI AIMc
Adaptive implicit -— Collins.
Definition: OCPConst.hpp:74
const USI IMPEC
Solution method = IMPEC.
Definition: OCPConst.hpp:70
#define OCP_ABORT(msg)
Abort if critical error happens.
Definition: UtilError.hpp:47
void SolveLinearSystem(Reservoir &rs, OCPControl &ctrl)
Solve the linear system in single problem.
void InitReservoir(Reservoir &rs) const
Initialize the Reservoir and prepare variables for some method.
void SetupMethod(Reservoir &rs, const OCPControl &ctrl)
Setup the fluid solver.
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluid.
bool FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish the Newton-Raphson iteration.
void FinishStep(Reservoir &rs, OCPControl &ctrl)
Finish the current time step.
void AssembleMat(const Reservoir &rs, const OCP_DBL &dt)
Assemble Mat.
void Prepare(Reservoir &rs, OCP_DBL &dt)
Prepare for assembling Mat.
All control parameters except for well controlers.
Definition: OCPControl.hpp:94
USI GetMethod() const
Return type of the solution method.
Definition: OCPControl.hpp:124
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
void InitReservoir(Reservoir &rs) const
Init.
void SolveLinearSystem(LinearSystem &myLS, Reservoir &rs, OCPControl &ctrl)
Solve the linear system.
void Prepare(Reservoir &rs, OCP_DBL &dt)
Prepare for Assembling matrix.
bool FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish a Newton-Raphson iteration.
void AssembleMat(LinearSystem &myLS, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
void Setup(Reservoir &rs, LinearSystem &myLS, const OCPControl &ctrl)
Setup AIMc.
void AssembleMat(LinearSystem &myLS, const Reservoir &rs, const OCP_DBL &dt)
Assemble Matrix.
void Setup(Reservoir &rs, LinearSystem &myLS, const OCPControl &ctrl)
Setup AIMs.
void SolveLinearSystem(LinearSystem &myLS, Reservoir &rs, OCPControl &ctrl)
Solve the linear system.
void Prepare(Reservoir &rs, OCP_DBL &dt)
Prepare for Assembling matrix.
void FinishStep(Reservoir &rs, OCPControl &ctrl)
Finish a time step.
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
bool FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish a Newton-Raphson iteration.
void Prepare(Reservoir &rs, OCP_DBL &dt)
Prepare for Assembling matrix.
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl, LinearSystem &myAuxLS)
Update properties of fluids.
void Setup(Reservoir &rs, LinearSystem &myLS, LinearSystem &myAuxLS, const OCPControl &ctrl)
Setup AIMt.
void AssembleMat(LinearSystem &myLS, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
void Prepare(Reservoir &rs, OCP_DBL &dt)
Prepare for Assembling matrix.
void SolveLinearSystem(LinearSystem &myLS, Reservoir &rs, OCPControl &ctrl) const
Solve the linear system.
void Setup(Reservoir &rs, LinearSystem &myLS, const OCPControl &ctrl)
Setup FIM.
void FinishStep(Reservoir &rs, OCPControl &ctrl) const
Finish a time step.
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
void InitReservoir(Reservoir &rs) const
Init.
bool FinishNR(Reservoir &rs, OCPControl &ctrl)
Finish a Newton-Raphson iteration.
void SolveLinearSystem(LinearSystem &myLS, Reservoir &rs, OCPControl &ctrl) const
Solve the linear system.
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
void InitReservoir(Reservoir &rs) const
Init.
void AssembleMat(LinearSystem &myLS, const Reservoir &rs, const OCP_DBL &dt) const
Assemble Matrix.
void InitReservoir(Reservoir &rs) const
Init.
void Setup(Reservoir &rs, LinearSystem &myLS, const OCPControl &ctrl)
Setup IMPEC.
void SolveLinearSystem(LinearSystem &myLS, Reservoir &rs, OCPControl &ctrl)
Solve the linear system.
void Prepare(Reservoir &rs, OCP_DBL &dt)
Prepare for Assembling matrix.
bool UpdateProperty(Reservoir &rs, OCPControl &ctrl)
Update properties of fluids.
bool FinishNR(const Reservoir &rs)
Determine if NR iteration finishes.
void AssembleMatIMPEC(LinearSystem &myLS, const OCP_DBL &dt) const
Assemble Matrix for IMPEC.
Definition: Reservoir.cpp:232