OpenCAEPoro  v0.5.0
A simulator for multicomponent porous media flow
BulkConn.hpp
Go to the documentation of this file.
1 
12 #ifndef __BULKCONN_HEADER__
13 #define __BULKCONN_HEADER__
14 
15 // Standard header files
16 #include <vector>
17 
18 // OpenCAEPoro header files
19 #include "Bulk.hpp"
20 #include "DenseMat.hpp"
21 #include "Grid.hpp"
22 #include "LinearSystem.hpp"
23 #include "OCPStructure.hpp"
24 
25 using namespace std;
26 
28 // Note: Bulks are the active grid cells.
29 class BulkPair
30 {
31  friend class BulkConn;
32 
33 public:
35  BulkPair() = default;
36 
38  BulkPair(const OCP_USI& BId,
39  const OCP_USI& EId,
40  const USI& direct,
41  const OCP_DBL& AreaB,
42  const OCP_DBL& AreaE)
43  : bId(BId)
44  , eId(EId)
45  , direction(direct)
46  , areaB(AreaB)
47  , areaE(AreaE){};
48 
49  OCP_USI BId() const { return bId; }
50  OCP_USI EId() const { return eId; }
51  OCP_DBL Area() const { return area; }
52  OCP_DBL AreaB() const { return areaB; }
53  OCP_DBL AreaE() const { return areaE; }
54  USI Direction() const { return direction; }
55 
56 protected:
63 };
64 
66 // Note: BulkConn is a core component of reservoir, it contains all properties and
67 // operations on connections between bulks (active grids). You can traverse all the
68 // connections through an effective iterator. Flow calculations between active
69 // bulks and matrix assembling with contributions from bulks only are included.
70 class BulkConn
71 {
72  friend class Reservoir;
73  // temp
74  friend class MyMetisTest;
75  friend class Out4VTK;
76  friend class IsoT_FIM;
77  friend class IsoT_IMPEC;
78  friend class IsoT_AIMc;
79  friend class IsoT_FIMn;
80  friend class T_FIM;
81 
82 public:
84  // General
86 
87 public:
89  void PrintConnectionInfo(const Grid& myGrid) const;
90  void PrintConnectionInfoCoor(const Grid& myGrid) const;
91 
93  // General Variables
95 
96 public:
98  void SetupIsoT(const Grid& myGrid, const Bulk& myBulk);
99  void Setup(const Grid& myGrid);
101  void CalAkd(const Bulk& myBulk);
103  OCP_USI GetBulkNum() const { return numBulk; }
104  const auto& GetNeighborNum() const { return neighborNum; }
105 
106 protected:
109 
111  // Note: The i-th entry stores the i-th bulk's neighbors, which is sorted in an
112  // increasing order.
113  vector<vector<OCP_USI>> neighbor;
114 
116  vector<USI> selfPtr;
117 
119  vector<USI> neighborNum;
120 
122  // Note: In each pair, the index of first bulk is greater than the second. The data
123  // in iteratorConn is generated from neighbor.
124  vector<BulkPair> iteratorConn;
125 
127  // Physical Variables
129 
130 protected:
131  // Note: Upblock is identified by difference of pressure between phases.
132  vector<OCP_USI>
134  vector<OCP_DBL>
136  vector<OCP_DBL>
138  vector<OCP_DBL> upblock_Velocity;
140  vector<OCP_DBL> Adkt;
141 
142  // Last time step
143  vector<OCP_USI> lupblock;
144  vector<OCP_DBL> lupblock_Rho;
145  vector<OCP_DBL> lupblock_Trans;
146  vector<OCP_DBL> lupblock_Velocity;
147  vector<OCP_DBL> lAdkt;
148 
149  // Derivatives
150  vector<OCP_DBL> AdktP;
151  vector<OCP_DBL> AdktT;
152  vector<OCP_DBL>
154 
155  // Last time step
156  vector<OCP_DBL> lAdktP;
157  vector<OCP_DBL> lAdktT;
158  vector<OCP_DBL> lAdktS;
159 
160 public:
162  void CalFluxFIMS(const Grid& myGrid, const Bulk& myBulk);
163  void CalResFIMS(vector<OCP_DBL>& res, const Bulk& myBulk, const OCP_DBL& dt);
164 };
165 
166 #endif
167 
168 /*----------------------------------------------------------------------------*/
169 /* Brief Change History of This File */
170 /*----------------------------------------------------------------------------*/
171 /* Author Date Actions */
172 /*----------------------------------------------------------------------------*/
173 /* Shizhe Li Oct/01/2021 Create file */
174 /* Chensong Zhang Oct/15/2021 Format file */
175 /* Chensong Zhang Jan/17/2022 Update Doxygen */
176 /*----------------------------------------------------------------------------*/
Bulk class declaration.
Operations about small dense mat.
Grid class declaration.
Linear solver class declaration.
unsigned int USI
Generic unsigned integer.
Definition: OCPConst.hpp:23
double OCP_DBL
Double precision.
Definition: OCPConst.hpp:27
unsigned int OCP_USI
Long unsigned integer.
Definition: OCPConst.hpp:25
Some Structure in OpenCAEPoro.
Properties and operations on connections between bulks (active grids).
Definition: BulkConn.hpp:71
OCP_USI numConn
Number of connections between bulks.
Definition: BulkConn.hpp:108
OCP_USI GetBulkNum() const
Return number of bulks.
Definition: BulkConn.hpp:103
vector< OCP_USI > upblock
Index of upwinding bulk of connections : numConn * numPhase.
Definition: BulkConn.hpp:133
vector< OCP_DBL > upblock_Rho
Mass density of phase from upblock: numConn * numPhase.
Definition: BulkConn.hpp:135
OCP_USI numBulk
Number of bulks (active grid cells).
Definition: BulkConn.hpp:107
vector< OCP_DBL > AdktP
d Adkt / d P, order: connections -> bId.P -> eId.P
Definition: BulkConn.hpp:150
vector< OCP_DBL > lAdkt
last Adkt
Definition: BulkConn.hpp:147
vector< OCP_DBL > lupblock_Velocity
last upblock_Velocity
Definition: BulkConn.hpp:146
vector< OCP_DBL > upblock_Trans
Transmissibility of phase from upblock: numConn * numPhase.
Definition: BulkConn.hpp:137
vector< OCP_DBL > AdktS
d Adkt / d S, order: connections -> bId.phase -> eId.phase
Definition: BulkConn.hpp:153
vector< OCP_DBL > lupblock_Rho
last upblock_Rho
Definition: BulkConn.hpp:144
vector< OCP_DBL > upblock_Velocity
Definition: BulkConn.hpp:138
vector< OCP_DBL > AdktT
d Adkt / d T, order: connections -> bId.T -> eId.T
Definition: BulkConn.hpp:151
vector< USI > selfPtr
Self-pointer, the indices of the i-th bulk in neighbor[i]: numBulk.
Definition: BulkConn.hpp:116
vector< vector< OCP_USI > > neighbor
Neighboring information of each bulk: activeGridNum.
Definition: BulkConn.hpp:113
vector< OCP_DBL > lAdktS
last AdktS
Definition: BulkConn.hpp:158
vector< OCP_DBL > Adkt
Thermal conductivity between neighbors.
Definition: BulkConn.hpp:140
vector< OCP_DBL > lupblock_Trans
last upblock_Trans
Definition: BulkConn.hpp:145
vector< BulkPair > iteratorConn
All connections (pair of indices) between bulks: numConn.
Definition: BulkConn.hpp:124
vector< USI > neighborNum
Number of neighbors of the i-th bulk: numBulk, self-included.
Definition: BulkConn.hpp:119
vector< OCP_DBL > lAdktP
last AdktP
Definition: BulkConn.hpp:156
vector< OCP_USI > lupblock
last upblock
Definition: BulkConn.hpp:143
vector< OCP_DBL > lAdktT
last AdktT
Definition: BulkConn.hpp:157
Connection between two bulks (bId, eId); usually, indices bId > eId.
Definition: BulkConn.hpp:30
OCP_USI BId() const
Return beginning index.
Definition: BulkConn.hpp:49
OCP_USI EId() const
Return ending index.
Definition: BulkConn.hpp:50
OCP_DBL areaB
Area of intersecting faces from Begin grid.
Definition: BulkConn.hpp:61
OCP_DBL area
Effective area.
Definition: BulkConn.hpp:59
BulkPair(const OCP_USI &BId, const OCP_USI &EId, const USI &direct, const OCP_DBL &AreaB, const OCP_DBL &AreaE)
Setup BulkPair with bId and eId.
Definition: BulkConn.hpp:38
OCP_DBL areaE
Area of intersecting faces from End grid.
Definition: BulkConn.hpp:62
BulkPair()=default
Default constructor.
OCP_DBL Area() const
Return effective area.
Definition: BulkConn.hpp:51
USI direction
1-x, 2-y, 3-z
Definition: BulkConn.hpp:60
OCP_USI eId
Ending index of a pair.
Definition: BulkConn.hpp:58
OCP_USI bId
Beginning index of a pair.
Definition: BulkConn.hpp:57
Physical information of each active reservoir bulk.
Definition: Bulk.hpp:104
Definition: Grid.hpp:89
IsoT_FIM is FIM (Fully Implicit Method).
IsoT_IMPEC is IMPEC (implicit pressure explict saturation) method.