tried to get openmp work

This commit is contained in:
hnil 2022-06-21 09:16:26 +02:00 committed by Atgeirr Flø Rasmussen
parent df32014109
commit 08c0848e0d
3 changed files with 9 additions and 3 deletions

View File

@ -133,8 +133,8 @@ public:
void update(const Problem& problem,const PrimaryVariables& primaryVars,unsigned globalSpaceIdx, unsigned timeIdx) void update(const Problem& problem,const PrimaryVariables& primaryVars,unsigned globalSpaceIdx, unsigned timeIdx)
{ {
//ParentType::update(elemCtx, dofIdx, timeIdx);//only used for extrusion factor //ParentType::update(elemCtx, dofIdx, timeIdx);//only used for extrusion factor
//const auto& materialParams = problem.materialLawParams(globalSpaceIdx); const auto& materialParams = problem.materialLawParams(globalSpaceIdx);
const auto& materialParams = problem.materialLawParams(0); //const auto& materialParams = problem.materialLawParams(0);//NB improve speed
Scalar RvMax; Scalar RvMax;
if (FluidSystem::enableVaporizedOil()) { if (FluidSystem::enableVaporizedOil()) {
RvMax = problem.maxOilVaporizationFactor(timeIdx, globalSpaceIdx); RvMax = problem.maxOilVaporizationFactor(timeIdx, globalSpaceIdx);

View File

@ -801,11 +801,15 @@ public:
{ {
//invalidateIntensiveQuantitiesCache(timeIdx); //invalidateIntensiveQuantitiesCache(timeIdx);
size_t numGridDof = primaryVars.size(); size_t numGridDof = primaryVars.size();
#ifdef _OPENMP
#pragma omp parallel
#endif
for (unsigned dofIdx = 0; dofIdx < numGridDof; ++dofIdx) { for (unsigned dofIdx = 0; dofIdx < numGridDof; ++dofIdx) {
const auto& primaryVar = primaryVars[dofIdx]; const auto& primaryVar = primaryVars[dofIdx];
auto& intquant = intensiveQuantityCache_[timeIdx][dofIdx]; auto& intquant = intensiveQuantityCache_[timeIdx][dofIdx];
intquant.update(problem, primaryVar, dofIdx, timeIdx); intquant.update(problem, primaryVar, dofIdx, timeIdx);
} }
std::fill(intensiveQuantityCacheUpToDate_[timeIdx].begin(), std::fill(intensiveQuantityCacheUpToDate_[timeIdx].begin(),
intensiveQuantityCacheUpToDate_[timeIdx].end(), intensiveQuantityCacheUpToDate_[timeIdx].end(),
/*value=*/true); /*value=*/true);

View File

@ -453,6 +453,9 @@ private:
const bool well_local = false; const bool well_local = false;
resetSystem_(); resetSystem_();
unsigned numCells = model_().numTotalDof(); unsigned numCells = model_().numTotalDof();
#ifdef _OPENMP
#pragma omp parallel
#endif
for(unsigned globI = 0; globI < numCells; globI++){ for(unsigned globI = 0; globI < numCells; globI++){
const auto& neighbours = neighbours_[globI];// this is a set but should maybe be changed const auto& neighbours = neighbours_[globI];// this is a set but should maybe be changed
// accumulation term // accumulation term
@ -507,7 +510,6 @@ private:
setResAndJacobi(res, bMat, adres); setResAndJacobi(res, bMat, adres);
residual_[globI] += res; residual_[globI] += res;
jacobian_->addToBlock(globI, globI, bMat); jacobian_->addToBlock(globI, globI, bMat);
//residual_[globJ] += res;
bMat *= -1.0; bMat *= -1.0;
jacobian_->addToBlock(globJ, globI, bMat); jacobian_->addToBlock(globJ, globI, bMat);
} }