Merge pull request #4912 from totto82/fix_bccon

fix issue when BCPROP is not set initially
This commit is contained in:
Tor Harald Sandve 2023-11-22 13:41:19 +01:00 committed by GitHub
commit 5a6af752e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1202,7 +1202,7 @@ public:
values.setThermalFlow(context, spaceIdx, timeIdx, boundaryFluidState(globalDofIdx, indexInInside));
else if (type == BCType::FREE || type == BCType::DIRICHLET)
values.setFreeFlow(context, spaceIdx, timeIdx, boundaryFluidState(globalDofIdx, indexInInside));
else
else if (type == BCType::RATE)
values.setMassRate(massrate, pvtRegionIdx);
}
}
@ -1470,9 +1470,16 @@ public:
const InitialFluidState boundaryFluidState(unsigned globalDofIdx, const int directionId) const
{
OPM_TIMEBLOCK_LOCAL(boundaryFluidState);
const auto& bcprop = this->simulator().vanguard().schedule()[this->episodeIndex()].bcprop;
if (bcprop.size() > 0) {
FaceDir::DirEnum dir = FaceDir::FromIntersectionIndex(directionId);
assert(bcindex_(dir)[globalDofIdx] > 0);
const auto& bc = this->simulator().vanguard().schedule()[this->episodeIndex()].bcprop[bcindex_(dir)[globalDofIdx]];
// index == 0: no boundary conditions for this
// global cell and direction
if (bcindex_(dir)[globalDofIdx] == 0)
return initialFluidStates_[globalDofIdx];
const auto& bc = bcprop[bcindex_(dir)[globalDofIdx]];
if (bc.bctype == BCType::DIRICHLET )
{
InitialFluidState fluidState;
@ -1568,6 +1575,7 @@ public:
fluidState.checkDefined();
return fluidState;
}
}
return initialFluidStates_[globalDofIdx];
}