Refactor: better isnan in assert, and reduce variable lifetime.

This commit is contained in:
Kristian Bendiksen authored and Magne Sjaastad committed 2024-03-15 15:11:53 +01:00
1 parent e014bfd283
commit 515213694c
2 files changed
+5 -9

No files matched your search

@@ -217,7 +217,6 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM
} }
std::vector<std::vector<cvf::Vec3d>> polygonsForStimPlanCellInEclipseCell; std::vector<std::vector<cvf::Vec3d>> polygonsForStimPlanCellInEclipseCell;
cvf::Vec3d areaVector;
std::vector<cvf::Vec3d> stimPlanPolygon = m_stimPlanCell.getPolygon(); std::vector<cvf::Vec3d> stimPlanPolygon = m_stimPlanCell.getPolygon();
for ( const std::vector<cvf::Vec3d>& planeCellPolygon : planeCellPolygons ) for ( const std::vector<cvf::Vec3d>& planeCellPolygon : planeCellPolygons )
@@ -233,7 +232,6 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM
if ( polygonsForStimPlanCellInEclipseCell.empty() ) continue; if ( polygonsForStimPlanCellInEclipseCell.empty() ) continue;
std::vector<double> areaOfFractureParts; std::vector<double> areaOfFractureParts;
double length;
std::vector<double> lengthXareaOfFractureParts; std::vector<double> lengthXareaOfFractureParts;
double Ax = 0.0; double Ax = 0.0;
double Ay = 0.0; double Ay = 0.0;
@@ -241,11 +239,11 @@ void RigEclipseToStimPlanCellTransmissibilityCalculator::calculateStimPlanCellsM
for ( const std::vector<cvf::Vec3d>& fracturePartPolygon : polygonsForStimPlanCellInEclipseCell ) for ( const std::vector<cvf::Vec3d>& fracturePartPolygon : polygonsForStimPlanCellInEclipseCell )
{ {
areaVector = cvf::GeometryTools::polygonAreaNormal3D( fracturePartPolygon ); cvf::Vec3d areaVector = cvf::GeometryTools::polygonAreaNormal3D( fracturePartPolygon );
double area = areaVector.length(); double area = areaVector.length();
areaOfFractureParts.push_back( area ); areaOfFractureParts.push_back( area );
length = RigCellGeometryTools::polygonLengthInLocalXdirWeightedByArea( fracturePartPolygon ); double length = RigCellGeometryTools::polygonLengthInLocalXdirWeightedByArea( fracturePartPolygon );
lengthXareaOfFractureParts.push_back( length * area ); lengthXareaOfFractureParts.push_back( length * area );
cvf::Plane fracturePlane; cvf::Plane fracturePlane;
@@ -132,17 +132,15 @@ double RigFractureTransmissibilityEquations::matrixToFractureTrans( double perm,
double fractureAreaWeightedlength, double fractureAreaWeightedlength,
double cDarcy ) double cDarcy )
{ {
double transmissibility;
double slDivPi = 0.0; double slDivPi = 0.0;
if ( cvf::Math::abs( skinfactor ) > EPSILON ) if ( cvf::Math::abs( skinfactor ) > EPSILON )
{ {
slDivPi = ( skinfactor * fractureAreaWeightedlength ) / cvf::PI_D; slDivPi = ( skinfactor * fractureAreaWeightedlength ) / cvf::PI_D;
} }
transmissibility = 8 * cDarcy * ( perm * NTG ) * A / ( cellSizeLength + slDivPi ); double transmissibility = 8 * cDarcy * ( perm * NTG ) * A / ( cellSizeLength + slDivPi );
CVF_ASSERT( transmissibility == transmissibility ); CVF_ASSERT( !std::isnan( transmissibility ) );
return transmissibility; return transmissibility;
} }