tried to make openmp work

This commit is contained in:
hnil 2022-06-21 09:15:39 +02:00 committed by Atgeirr Flø Rasmussen
parent 0c03e72782
commit 6d3b0a7c1f
3 changed files with 41 additions and 39 deletions

View File

@ -487,13 +487,13 @@ public:
continue;
}
IntensiveQuantities up;
unsigned globalIndex;
//unsigned globalIndex;
if(upIdx[phaseIdx] == interiorDofIdx){
up = intQuantsIn;
globalIndex = globalIndexIn;
// globalIndex = globalIndexIn;
}else{
up = intQuantsEx;
globalIndex = globalIndexEx;
//globalIndex = globalIndexEx;
}
// TODO: should the rock compaction transmissibility multiplier be upstreamed
// or averaged? all fluids should see the same compaction?!

View File

@ -1544,14 +1544,14 @@ public:
Scalar rockCompressibility(unsigned globalSpaceIdx, unsigned timeIdx) const
{
// if (this->rockParams_.empty())
// return 0.0;
if (this->rockParams_.empty())
return 0.0;
// unsigned tableIdx = 0;
// if (!this->rockTableIdx_.empty()) {
// tableIdx = this->rockTableIdx_[globalSpaceIdx];
// }
unsigned tableIdx = 0;
if (!this->rockTableIdx_.empty()) {
tableIdx = this->rockTableIdx_[globalSpaceIdx];
}
//unsigned tableIdx = 0;// faster but not genneral
return this->rockParams_[tableIdx].compressibility;
}
@ -1574,14 +1574,14 @@ public:
Scalar rockReferencePressure(unsigned globalSpaceIdx, unsigned timeIdx) const
{
// if (this->rockParams_.empty())
// return 1e5;
if (this->rockParams_.empty())
return 1e5;
// unsigned tableIdx = 0;
// if (!this->rockTableIdx_.empty()) {
// tableIdx = this->rockTableIdx_[globalSpaceIdx];
// }
unsigned tableIdx = 0;//this->rockTableIdx_[globalSpaceIdx];
unsigned tableIdx = 0;
if (!this->rockTableIdx_.empty()) {
tableIdx = this->rockTableIdx_[globalSpaceIdx];
}
//unsigned tableIdx = 0;//faster but not genneral this->rockTableIdx_[globalSpaceIdx];
return this->rockParams_[tableIdx].referencePressure;
}
/*!
@ -2154,35 +2154,34 @@ public:
template <class LhsEval>
LhsEval rockCompTransMultiplier(const IntensiveQuantities& intQuants, unsigned elementIdx) const
{
return 1.0;
// if (this->rockCompTransMult_.empty() && this->rockCompTransMultWc_.empty())
// return 1.0;
if (this->rockCompTransMult_.empty() && this->rockCompTransMultWc_.empty())
return 1.0;
// unsigned tableIdx = 0;
// if (!this->rockTableIdx_.empty())
// tableIdx = this->rockTableIdx_[elementIdx];
unsigned tableIdx = 0;
if (!this->rockTableIdx_.empty())
tableIdx = this->rockTableIdx_[elementIdx];
// const auto& fs = intQuants.fluidState();
// LhsEval effectiveOilPressure = decay<LhsEval>(fs.pressure(oilPhaseIdx));
const auto& fs = intQuants.fluidState();
LhsEval effectiveOilPressure = decay<LhsEval>(fs.pressure(oilPhaseIdx));
// if (!this->minOilPressure_.empty())
// // The pore space change is irreversible
// effectiveOilPressure =
// min(decay<LhsEval>(fs.pressure(oilPhaseIdx)),
// this->minOilPressure_[elementIdx]);
if (!this->minOilPressure_.empty())
// The pore space change is irreversible
effectiveOilPressure =
min(decay<LhsEval>(fs.pressure(oilPhaseIdx)),
this->minOilPressure_[elementIdx]);
// if (!this->overburdenPressure_.empty())
// effectiveOilPressure -= this->overburdenPressure_[elementIdx];
if (!this->overburdenPressure_.empty())
effectiveOilPressure -= this->overburdenPressure_[elementIdx];
// if (!this->rockCompTransMult_.empty())
// return this->rockCompTransMult_[tableIdx].eval(effectiveOilPressure, /*extrapolation=*/true);
if (!this->rockCompTransMult_.empty())
return this->rockCompTransMult_[tableIdx].eval(effectiveOilPressure, /*extrapolation=*/true);
// // water compaction
// assert(!this->rockCompTransMultWc_.empty());
// LhsEval SwMax = max(decay<LhsEval>(fs.saturation(waterPhaseIdx)), this->maxWaterSaturation_[elementIdx]);
// LhsEval SwDeltaMax = SwMax - initialFluidStates_[elementIdx].saturation(waterPhaseIdx);
// water compaction
assert(!this->rockCompTransMultWc_.empty());
LhsEval SwMax = max(decay<LhsEval>(fs.saturation(waterPhaseIdx)), this->maxWaterSaturation_[elementIdx]);
LhsEval SwDeltaMax = SwMax - initialFluidStates_[elementIdx].saturation(waterPhaseIdx);
// return this->rockCompTransMultWc_[tableIdx].eval(effectiveOilPressure, SwDeltaMax, /*extrapolation=*/true);
return this->rockCompTransMultWc_[tableIdx].eval(effectiveOilPressure, SwDeltaMax, /*extrapolation=*/true);
}
private:

View File

@ -276,9 +276,12 @@ namespace Opm {
void addReseroirSourceTerms(GlobalEqVector& residual,
SparseMatrixAdapter& jacobian) const
{
#ifdef _OPENMP
#pragma omp parallel
#endif
for ( const auto& well: well_container_ ) {
if(!well->isOperableAndSolvable() && !well->wellIsStopped())
return;
continue;
const auto& cells = well->cells();
const auto& rates = well->connectionRates();