fix issue when bcpip is not set initially

This commit is contained in:
Tor Harald Sandve 2023-10-06 09:42:47 +02:00
parent e33d27ca90
commit 37197f7b48

View File

@ -1195,7 +1195,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);
}
}
@ -1459,9 +1459,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;
@ -1557,6 +1564,7 @@ public:
fluidState.checkDefined();
return fluidState;
}
}
return initialFluidStates_[globalDofIdx];
}