Fix grid generation.

Add model thickness parameter.
Add support for reloading INP files from recent files
Add working directory field to fault reactivation model and put INP export there.
This commit is contained in:
Jon Jenssen
2023-08-23 18:46:05 +02:00
committed by Kristian Bendiksen
parent 6845c09c0c
commit 3817cea3cf
14 changed files with 96 additions and 27 deletions

View File

@@ -34,6 +34,7 @@ RigFaultReactivationModel::RigFaultReactivationModel()
, m_cellCountVertUpper( 1 )
, m_cellCountVertMiddle( 1 )
, m_cellCountVertLower( 1 )
, m_thickness( 1.0 )
{
for ( auto part : allModelParts() )
@@ -167,6 +168,16 @@ void RigFaultReactivationModel::setCellCounts( int horzPart1, int horzPart2, int
reset();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigFaultReactivationModel::setThickness( double thickness )
{
m_thickness = thickness;
reset();
}
//--------------------------------------------------------------------------------------------------
/// 7
/// 3----------|----------- 11
@@ -289,12 +300,14 @@ void RigFaultReactivationModel::generateGrids( cvf::Vec3dArray points )
m_cellCountHorzPart1,
m_cellCountVertLower,
m_cellCountVertMiddle,
m_cellCountVertUpper );
m_cellCountVertUpper,
m_thickness );
m_3dparts[GridPart::PART2]->generateGeometry( { points[8], points[9], points[10], points[11], points[4], points[5], points[6], points[7] },
m_cellCountHorzPart2,
m_cellCountVertLower,
m_cellCountVertMiddle,
m_cellCountVertUpper );
m_cellCountVertUpper,
m_thickness );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -80,6 +80,7 @@ public:
void setMaxExtentFromAnchor( double maxExtentHorz, double minZ, double maxZ );
void setCellCounts( int horzPart1, int horzPart2, int vertUpper, int vertMiddle, int vertLower );
void setThickness( double thickness );
void updateRects();
@@ -105,6 +106,8 @@ private:
double m_minZ;
double m_maxZ;
double m_thickness;
int m_cellCountHorzPart1;
int m_cellCountHorzPart2;
int m_cellCountVertUpper;

View File

@@ -24,7 +24,6 @@
///
//--------------------------------------------------------------------------------------------------
RigGriddedPart3d::RigGriddedPart3d()
: m_thickness( 10.0 )
{
}
@@ -78,7 +77,12 @@ cvf::Vec3d RigGriddedPart3d::stepVector( cvf::Vec3d start, cvf::Vec3d stop, int
///
///
//--------------------------------------------------------------------------------------------------
void RigGriddedPart3d::generateGeometry( std::vector<cvf::Vec3d> inputPoints, int nHorzCells, int nVertCellsLower, int nVertCellsMiddle, int nVertCellsUpper )
void RigGriddedPart3d::generateGeometry( std::vector<cvf::Vec3d> inputPoints,
int nHorzCells,
int nVertCellsLower,
int nVertCellsMiddle,
int nVertCellsUpper,
double thickness )
{
reset();
@@ -94,12 +98,13 @@ void RigGriddedPart3d::generateGeometry( std::vector<cvf::Vec3d> inputPoints, in
cvf::Vec3d tVec = step0to4 ^ step0to1;
tVec.normalize();
tVec *= m_thickness;
tVec *= thickness;
const std::vector<double> m_thicknessFactors = { -1.0, 0.0, 1.0 };
const int nThicknessCells = 2;
const int nVertCells = nVertCellsLower + nVertCellsMiddle + nVertCellsUpper;
const std::vector<int> vertCells = { nVertCellsLower, nVertCellsMiddle, nVertCellsUpper + 1 };
const std::vector<int> vertLines = { nVertCellsLower, nVertCellsMiddle, nVertCellsUpper + 1 };
const std::vector<cvf::Vec3d> firstSteps = { step0to1, step1to2, step2to3 };
const std::vector<cvf::Vec3d> lastSteps = { step4to5, step5to6, step6to7 };
@@ -107,27 +112,26 @@ void RigGriddedPart3d::generateGeometry( std::vector<cvf::Vec3d> inputPoints, in
m_vertices.reserve( (size_t)( ( nVertCells + 1 ) * ( nHorzCells + 1 ) ) );
cvf::Vec3d p = inputPoints[0];
cvf::Vec3d pLast = inputPoints[4];
cvf::Vec3d pFrom = inputPoints[0];
cvf::Vec3d pTo = inputPoints[4];
for ( int i = 0; i < (int)vertCells.size(); i++ )
for ( int i = 0; i < (int)vertLines.size(); i++ )
{
for ( int v = 0; v < vertCells[i]; v++ )
for ( int v = 0; v < vertLines[i]; v++ )
{
cvf::Vec3d stepHorz = stepVector( p, pLast, nHorzCells );
cvf::Vec3d p2 = p;
cvf::Vec3d stepHorz = stepVector( pFrom, pTo, nHorzCells );
cvf::Vec3d p = pFrom;
for ( int h = 0; h <= nHorzCells; h++ )
{
for ( int t = 0; t < (int)m_thicknessFactors.size(); t++ )
{
m_vertices.push_back( p2 + m_thicknessFactors[t] * tVec );
m_vertices.push_back( p + m_thicknessFactors[t] * tVec );
}
p2 += stepHorz;
pLast = p2;
p += stepHorz;
}
p += firstSteps[i];
pLast += lastSteps[i];
pFrom += firstSteps[i];
pTo += lastSteps[i];
}
}

View File

@@ -44,7 +44,12 @@ public:
void reset();
void generateGeometry( std::vector<cvf::Vec3d> inputPoints, int nHorzCells, int nVertCellsLower, int nVertCellsMiddle, int nVertCellsUpper );
void generateGeometry( std::vector<cvf::Vec3d> inputPoints,
int nHorzCells,
int nVertCellsLower,
int nVertCellsMiddle,
int nVertCellsUpper,
double thickness );
const std::vector<cvf::Vec3d>& vertices() const;
const std::vector<std::vector<unsigned int>>& elementIndices() const;
@@ -60,6 +65,4 @@ private:
std::vector<std::vector<unsigned int>> m_elementIndices;
std::map<BorderSurface, std::vector<unsigned int>> m_borderSurfaceElements;
std::vector<std::vector<cvf::Vec3d>> m_meshLines;
double m_thickness;
};