#1091 - pre-proto - Starting calculation of projected areas, resulting values not checked to be correct yet.

This commit is contained in:
astridkbjorke
2017-01-26 11:40:50 +01:00
parent f732c1ea24
commit 0364782d32
2 changed files with 40 additions and 4 deletions

View File

@@ -304,10 +304,10 @@ void RimFracture::computeTransmissibility()
cvf::Vec3d areaVector;
for (auto planeCellPolygon : planeCellPolygons)
for (std::vector<cvf::Vec3d> planeCellPolygon : planeCellPolygons)
{
std::vector<std::vector<cvf::Vec3d> >clippedPolygons = RigCellGeometryTools::clipPolygons(planeCellPolygon, fracPolygonDouble);
for (auto clippedPolygon : clippedPolygons)
for (std::vector<cvf::Vec3d> clippedPolygon : clippedPolygons)
{
polygonsDescribingFractureInCell.push_back(clippedPolygon);
}
@@ -319,13 +319,28 @@ void RimFracture::computeTransmissibility()
double length;
std::vector<double> lengthXareaOfFractureParts;
for (auto fracturePartPolygon : polygonsDescribingFractureInCell)
for (std::vector<cvf::Vec3d> fracturePartPolygon : polygonsDescribingFractureInCell)
{
areaVector = cvf::GeometryTools::polygonAreaNormal3D(fracturePartPolygon);
area = areaVector.length();
areaOfFractureParts.push_back(area);
length = RigCellGeometryTools::polygonAreaWeightedLength(directionOfLength, fracturePartPolygon);
lengthXareaOfFractureParts.push_back(length * area);
double AreaX = calculateProjectedArea(fracturePartPolygon, localX);
//Calculating area in x, y and z direction
cvf::Vec3d planeNormal = cvf::Vec3d::ZERO;
planeNormal.cross(localX, -localZ);
double Ax = calculateProjectedArea(fracturePartPolygon, planeNormal);
planeNormal.cross(localY, localZ);
double Ay = calculateProjectedArea(fracturePartPolygon, planeNormal);
planeNormal.cross(localX, localY);
double Az = calculateProjectedArea(fracturePartPolygon, planeNormal);
}
double totalArea = 0.0;
@@ -336,6 +351,8 @@ void RimFracture::computeTransmissibility()
double fractureAreaWeightedlength = totalAreaXLength / totalArea;
//TODO: FInd direction for length calculation (normal to z, in fracture plane)
@@ -421,6 +438,24 @@ bool RimFracture::planeCellIntersectionPolygons(size_t cellindex, std::vector<st
return isCellIntersected;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFracture::calculateProjectedArea(std::vector<cvf::Vec3d> polygon, cvf::Vec3d planeNormal)
{
//Set up plane
cvf::Plane plane;
plane.setFromPointAndNormal(polygon[0], planeNormal);
//Project points
for (cvf::Vec3d v : polygon) plane.projectPoint(v);
//calculate Area
cvf::Vec3d areaVector = cvf::GeometryTools::polygonAreaNormal3D(polygon);
double AreaInPlane = areaVector.length();
return AreaInPlane;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -93,7 +93,8 @@ private:
//Functions for area calculations - should these be in separate class
bool planeCellIntersectionPolygons(size_t cellindex, std::vector<std::vector<cvf::Vec3d> > & polygons, cvf::Vec3d & localX, cvf::Vec3d & localY, cvf::Vec3d & localZ);
double calculateProjectedArea(std::vector<cvf::Vec3d> fracturePartPolygon, cvf::Vec3d localX);
protected:
caf::PdmPtrField<RimEllipseFractureTemplate*> m_fractureTemplate;