ishovkun / msh2gprs

Preprocessor for AD-GPRS
2 stars 4 forks source link

Recover SDA output in develop #4

Open ishovkun opened 4 years ago

ishovkun commented 4 years ago

As the title says, we need to recover SDA output in develop branch.

ishovkun commented 4 years ago

@jaewooan , let me know how it's working.

jaewooan commented 4 years ago

Thank you. I will check if it works and make a comment on this

jaewooan commented 4 years ago

Igor, after I make a little modification on MSH2GPRS and AD-GPRS, it works very well. The modification on MSH2GPRS is mainly related to update_formula. I will push the modified one to you. Please check my modification and let me know your opinion.

The reason why I also need to modify AD-GPRS is the order of element number for matrix and EDFM Fracture. As you know, the element numbers are allocated for fractures(DFM and EDFM) first and then for matrices in MSH2GPRS. For example, in one geomechanics cell, the id of the EDFM flow cell is smaller than the id of the matrix. But in ADGPRS, the functions for EDFM are designed to consider the smaller id as matrix and the larger one as fracture (because the previous version of msh2gprs allocates the larger id for fracture).

So, I can fix this issue by switching the order of the id in the vector vvGcell2RcelPath in SImDataGeomech in ADGPRS.

//line 2659 in handleMechanicalFlowMapping() for (itConnection = sGeomechMap.setpairRcellMcell.begin(); itConnection != sGeomechMap.setpairRcellMcell.end(); ++itConnection) { // reservoir cell (itConnection).first // mechanics cell (itConnection).second sGeomechMap.vvGcell2RcellPath[(itConnection).second].push_back((itConnection).first); // START OF ADDED PART if (sGeomechMap.vvGcell2RcellPath[(itConnection).second].size() > 1) { // containing EDFM vFracGcell.insert((itConnection).second);_ // END OF ADDED PART. }

// START OF ADDED PART // add additional lines to reorder the id in vvGcell2RcellPath: move the matrix id to the first index of the vvGcell2RcellPath vector. for(int iG:vFracGcell){ std::vector vecVolume = {}; for(std::size_t ib:sGeomechMap.vvGcell2RcellPath[iG]) vecVolume.push_back(SimData::reference().gridParam.volume[ib]); std::vector::iterator iterVolMax = std::max_element(vecVolume.begin(), vecVolume.end()); std::vector::iterator iter_ibVolMax = sGeomechMap.vvGcell2RcellPath[iG].begin()+std::distance(vecVolume.begin(), iterVolMax); std::size_t ibVolMax = *iter_ibVolMax; sGeomechMap.vvGcell2RcellPath[iG].erase(iter_ibVolMax); sGeomechMap.vvGcell2RcellPath[iG].insert(sGeomechMap.vvGcell2RcellPath[iG].begin(), ibVolMax); } // END OF ADDED PART At first, please check my modification on MSH2GPRS and I will explain again about the ADGPRS on the next meeting.

ishovkun commented 4 years ago

Ok, make a pull request then.

On Sat, Jun 6, 2020, 9:05 PM jaewooan notifications@github.com wrote:

Igor, after I make a little modification on MSH2GPRS and AD-GPRS, it works very well. The modification on MSH2GPRS is mainly related to update_formula. I will push the modified one to you. Please check my modification and let me know your opinion.

The reason why I also need to modify AD-GPRS is the order of element number for matrix and EDFM Fracture. As you know, the element numbers are allocated for fractures(DFM and EDFM) first and then for matrices in MSH2GPRS. For example, in one geomechanics cell, the id of the EDFM flow cell is smaller than the id of the matrix. But in ADGPRS, the functions for EDFM are designed to consider the smaller id as matrix and the larger one as fracture (because the previous version of msh2gprs allocates the larger id for fracture).

So, I can fix this issue by switching the order of the id in the vector vvGcell2RcelPath in SImDataGeomech in ADGPRS.

//line 2659 in handleMechanicalFlowMapping() for (itConnection = sGeomechMap.setpairRcellMcell.begin(); itConnection != sGeomechMap.setpairRcellMcell.end(); ++itConnection) { // reservoir cell (itConnection).first // mechanics cell (itConnection).second

sGeomechMap.vvGcell2RcellPath[(itConnection).second].push_back((itConnection).first); // START OF ADDED PART if (sGeomechMap.vvGcell2RcellPath[(itConnection).second].size() > 1) { // containing EDFM vFracGcell.insert((itConnection).second);_ // END OF ADDED PART. }

// START OF ADDED PART // add additional lines to reorder the id in vvGcell2RcellPath: move the matrix id to the first index of the vvGcell2RcellPath vector. for(int iG:vFracGcell){ std::vector vecVolume = {}; for(std::size_t ib:sGeomechMap.vvGcell2RcellPath[iG]) vecVolume.push_back(SimData::reference().gridParam.volume[ib]); std::vector::iterator iterVolMax = std::max_element(vecVolume.begin(), vecVolume.end()); std::vector::iterator iter_ibVolMax = sGeomechMap.vvGcell2RcellPath[iG].begin()+std::distance(vecVolume.begin(), iterVolMax); std::size_t ibVolMax = *iter_ibVolMax; sGeomechMap.vvGcell2RcellPath[iG].erase(iter_ibVolMax); sGeomechMap.vvGcell2RcellPath[iG].insert(sGeomechMap.vvGcell2RcellPath[iG].begin(), ibVolMax); } // END OF ADDED PART At first, please check my modification on MSH2GPRS and I will explain again about the ADGPRS on the next meeting.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ishovkun/msh2gprs/issues/4#issuecomment-640153697, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVDG7ZZIJ43T65R7H25BVTRVMGZLANCNFSM4NSCLVQQ .

ishovkun commented 4 years ago

@jaewooan FYI, both DFM and EDFM regions are now supported and have relevant user entries.