Commit fb08e150 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[mpfa] fix some bugs for 2d grids in 3d

The function to make the indices unique in the local sub-control entity seeds
was buggy and led to wrong outside scv faces in the assembly of the local matrices.

Furthermore, calling scvfTouchesBranchingPoint() for grids with dim = dimWorld would have led
to a segmentation fault.

Also, in the interaction volume, when getting the transmissibilities, we always have to compute them
again when coming from the outside face, as the normal vector of the outside face can always be different to
that of the inside face, even when not on a branching point.
parent b14f02f9
......@@ -117,7 +117,12 @@ public:
//! Returns whether or not an scvf touches a branching point (for dim < dimWorld)
bool scvfTouchesBranchingPoint(const SubControlVolumeFace& scvf) const
{ return branchingVertices_[scvf.vertexIndex()]; }
{
if (dim == dimWorld)
return false;
else
return branchingVertices_[scvf.vertexIndex()];
}
//! update all fvElementGeometries (do this again after grid adaption)
void update(const Problem& problem)
......
......@@ -472,34 +472,40 @@ private:
}
else if (!insideScvfExists && outsideScvfExists)
{
// pass info on outside to the inside scvf seed
scvfSeeds[outsideLocalScvfIdx].addOutsideData(actualScvf.index(), static_cast<LocalIndexType>(scvSeeds.size()));
// set the local scvfIndex of the outside face
actualScvSeed.setLocalScvfIndex(coordDir, outsideLocalScvfIdx);
// pass info on inside to the outside scvf seed
scvfSeeds[outsideLocalScvfIdx].addOutsideData(actualScvf.index(), actualLocalScvIdx);
}
// make outside scv by recursion
fillEntitySeeds_(scvSeeds, scvfSeeds, problem, outsideElement, outsideFvGeometry, outsideScvfVector, vIdxGlobal);
}
// outside scv exists, but no corresponding local scv face yet. Make it from inside.
else if (outsideScvExists && !outsideScvfExists && !insideScvfExists)
else
{
// set the local scvfIndex of the face that is about to created
actualScvSeed.setLocalScvfIndex(coordDir, scvfSeeds.size());
// outside scv exists, but no corresponding local scv face yet. Make it from inside.
if (!outsideScvfExists && !insideScvfExists)
{
// set the local scvfIndex of the face that is about to created
actualScvSeed.setLocalScvfIndex(coordDir, scvfSeeds.size());
// create scvf seed
scvfSeeds.emplace_back(actualScvf,
actualLocalScvIdx,
Implementation::getMpfaFaceType(problem, element, actualScvf));
// create scvf seed
scvfSeeds.emplace_back(actualScvf,
actualLocalScvIdx,
Implementation::getMpfaFaceType(problem, element, actualScvf));
// pass the actual outside indices to the new scvf seed
scvfSeeds.back().addOutsideData(outsideScvfIdx, outsideLocalScvIdx);
}
else if (outsideScvExists && !insideScvfExists && outsideScvfExists)
{
// set the local scvfIndex of the found outside local scv face seed
actualScvSeed.setLocalScvfIndex(coordDir, outsideLocalScvfIdx);
// pass the actual outside indices to the new scvf seed
scvfSeeds.back().addOutsideData(outsideScvfIdx, outsideLocalScvIdx);
}
else if (!insideScvfExists && outsideScvfExists)
{
// set the local scvfIndex of the found outside local scv face seed
actualScvSeed.setLocalScvfIndex(coordDir, outsideLocalScvfIdx);
// pass info on outside to the inside found local scvf seed
scvfSeeds[outsideLocalScvfIdx].addOutsideData(actualScvf.index(), actualLocalScvIdx);
// pass info on inside to the outside found local scvf seed
scvfSeeds[outsideLocalScvfIdx].addOutsideData(actualScvf.index(), actualLocalScvIdx);
}
}
}
}
......
......@@ -308,15 +308,6 @@ public:
typename std::enable_if< (d < dw), DynamicVector >::type
getTransmissibilities(const LocalFaceData& localFaceData) const
{
// if we are not on a branching point, do the usual
if (localScvf_(localFaceData.localScvfIndex).outsideLocalScvIndices().size() == 1)
{
auto tij = T_[localFaceData.localScvfIndex];
if (localFaceData.isOutside)
tij *= -1.0;
return tij;
}
// This means we are on a branching point. If we come from the inside, simply return tij
if (!localFaceData.isOutside)
return T_[localFaceData.localScvfIndex];
......
......@@ -165,19 +165,31 @@ public:
// should correspond to the j-th outside local scv.Therefore we apply the same operations on both containers
void makeOutsideDataUnique()
{
for (auto scvIt = outsideLocalScvIndices_.begin(); scvIt != outsideLocalScvIndices_.end(); ++scvIt)
auto scvIt = outsideLocalScvIndices_.begin();
while(scvIt != outsideLocalScvIndices_.end())
{
auto scvfIt = outsideGlobalScvfIndices_.begin();
auto distance = std::distance(outsideLocalScvIndices_.begin(), scvIt);
auto scvfIt = outsideGlobalScvfIndices_.begin()+distance;
bool proceed = true;
for (auto scvIt2 = scvIt+1; scvIt2 != outsideLocalScvIndices_.end(); ++scvIt2)
{
// increment face iterator to be at the same position as the scvIt2 iterator
++scvfIt;
// if an identical index is found, delete it
if (*scvIt2 == *scvIt)
{
outsideLocalScvIndices_.erase(scvIt2);
outsideGlobalScvfIndices_.erase(scvfIt);
proceed = false;
break;
}
++scvfIt;
}
if (proceed)
++scvIt;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment