mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#513) Use element type to distinguish when to use the POR values
This commit is contained in:
parent
5097082f09
commit
da893744a5
@ -276,23 +276,38 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in
|
|||||||
int frameCount = srcDataFrames->frameCount();
|
int frameCount = srcDataFrames->frameCount();
|
||||||
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
for (int fIdx = 0; fIdx < frameCount; ++fIdx)
|
||||||
{
|
{
|
||||||
const std::vector<float>& srcFrameData = srcDataFrames->frameData(fIdx);
|
const std::vector<float>& srcSFrameData = srcDataFrames->frameData(fIdx);
|
||||||
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
std::vector<float>& dstFrameData = dstDataFrames->frameData(fIdx);
|
||||||
size_t valCount = srcFrameData.size();
|
size_t valCount = srcSFrameData.size();
|
||||||
dstFrameData.resize(valCount);
|
dstFrameData.resize(valCount);
|
||||||
|
|
||||||
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData(fIdx);
|
const std::vector<float>& srcPORFrameData = srcPORDataFrames->frameData(fIdx);
|
||||||
|
|
||||||
int nodeIdx = 0;
|
int elementCount = femPart->elementCount();
|
||||||
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
||||||
{
|
{
|
||||||
nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(vIdx);
|
RigElementType elmType = femPart->elementType(elmIdx);
|
||||||
float por = srcPORFrameData[nodeIdx];
|
|
||||||
|
|
||||||
if (por == inf)
|
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
||||||
dstFrameData[vIdx] = inf;
|
|
||||||
else
|
if (elmType == HEX8P)
|
||||||
dstFrameData[vIdx] = -srcFrameData[vIdx];
|
{
|
||||||
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
||||||
|
{
|
||||||
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
||||||
|
// Todo: Verify that we do not need to check for POR == inf when we have a HEX8P elm
|
||||||
|
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
||||||
|
{
|
||||||
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
||||||
|
|
||||||
|
dstFrameData[elmNodResIdx] = inf;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,36 +387,29 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in
|
|||||||
|
|
||||||
size_t valCount = srcSFrameData.size();
|
size_t valCount = srcSFrameData.size();
|
||||||
dstFrameData.resize(valCount);
|
dstFrameData.resize(valCount);
|
||||||
int nodeIdx = 0;
|
|
||||||
|
|
||||||
int elementCount = femPart->elementCount();
|
int elementCount = femPart->elementCount();
|
||||||
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
||||||
{
|
{
|
||||||
|
RigElementType elmType = femPart->elementType(elmIdx);
|
||||||
|
|
||||||
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
||||||
bool hasInfPor = false;
|
|
||||||
bool hasPor = false;
|
|
||||||
|
|
||||||
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
if (elmType == HEX8P)
|
||||||
{
|
{
|
||||||
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
||||||
nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(elmNodResIdx);
|
{
|
||||||
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
||||||
|
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(elmNodResIdx);
|
||||||
|
|
||||||
float por = srcPORFrameData[nodeIdx];
|
float por = srcPORFrameData[nodeIdx];
|
||||||
if (por == inf)
|
if (por == inf) por = 0.0f;
|
||||||
{
|
|
||||||
por = 0.0f;
|
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx] + por;
|
||||||
hasInfPor = true;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
hasPor = true;
|
|
||||||
}
|
|
||||||
dstFrameData[elmNodResIdx] = -srcSFrameData[elmNodResIdx] + por;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (hasPor && hasInfPor)
|
{
|
||||||
{ // We have both nodes with and without POR defined in element
|
|
||||||
// Recalculate element results as if no POR was present
|
|
||||||
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
||||||
{
|
{
|
||||||
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
||||||
@ -487,16 +495,37 @@ RigFemScalarResultFrames* RigFemPartResultsCollection::calculateDerivedResult(in
|
|||||||
|
|
||||||
size_t valCount = srcSTFrameData.size();
|
size_t valCount = srcSTFrameData.size();
|
||||||
dstFrameData.resize(valCount);
|
dstFrameData.resize(valCount);
|
||||||
int nodeIdx = 0;
|
|
||||||
for (size_t vIdx = 0; vIdx < valCount; ++vIdx)
|
|
||||||
{
|
|
||||||
nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(vIdx);
|
|
||||||
float por = srcPORFrameData[nodeIdx];
|
|
||||||
|
|
||||||
if (por == inf || abs(por) < 0.01e6)
|
int elementCount = femPart->elementCount();
|
||||||
dstFrameData[vIdx] = inf;
|
for (int elmIdx = 0; elmIdx < elementCount; ++elmIdx)
|
||||||
|
{
|
||||||
|
RigElementType elmType = femPart->elementType(elmIdx);
|
||||||
|
|
||||||
|
int elmNodeCount = RigFemTypes::elmentNodeCount(femPart->elementType(elmIdx));
|
||||||
|
|
||||||
|
if (elmType == HEX8P)
|
||||||
|
{
|
||||||
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
||||||
|
{
|
||||||
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
||||||
|
int nodeIdx = femPart->nodeIdxFromElementNodeResultIdx(elmNodResIdx);
|
||||||
|
|
||||||
|
float por = srcPORFrameData[nodeIdx];
|
||||||
|
|
||||||
|
if (por == inf || abs(por) < 0.01e6)
|
||||||
|
dstFrameData[elmNodResIdx] = inf;
|
||||||
|
else
|
||||||
|
dstFrameData[elmNodResIdx] = srcSTFrameData[elmNodResIdx]/por;
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
dstFrameData[vIdx] = srcSTFrameData[vIdx]/por;
|
{
|
||||||
|
for (int elmNodIdx = 0; elmNodIdx < elmNodeCount; ++elmNodIdx)
|
||||||
|
{
|
||||||
|
size_t elmNodResIdx = femPart->elementNodeResultIdx(elmIdx, elmNodIdx);
|
||||||
|
dstFrameData[elmNodResIdx] = inf;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dstDataFrames;
|
return dstDataFrames;
|
||||||
|
Loading…
Reference in New Issue
Block a user