Skip to content

Commit

Permalink
Update stress source selection
Browse files Browse the repository at this point in the history
Clean up UI a bit
  • Loading branch information
jonjenssen committed Jan 22, 2024
1 parent 3388f60 commit ceaec4a
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream(
bool useGridTemperature = rimModel.useGridTemperature();
bool useGridDensity = rimModel.useGridDensity();
bool useGridElasticProperties = rimModel.useGridElasticProperties();
bool useGridStress = rimModel.useGridStress();

double seaBedDepth = rimModel.seaBedDepth();
double waterDensity = rimModel.waterDensity();
Expand All @@ -115,7 +114,7 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream(
},
[&]() { return printInteractionProperties( stream, frictionValue ); },
[&]() { return printBoundaryConditions( stream, *model, partNames, boundaries ); },
[&]() { return printPredefinedFields( stream, *model, *dataAccess, basePath, partNames, useGridVoidRatio, useGridStress ); },
[&]() { return printPredefinedFields( stream, *model, *dataAccess, basePath, partNames, useGridVoidRatio ); },
[&]() { return printInteractions( stream, partNames, borders ); },
[&]()
{
Expand Down Expand Up @@ -509,8 +508,7 @@ std::pair<bool, std::string>
const RimFaultReactivationDataAccess& dataAccess,
const std::string& exportBasePath,
const std::map<RimFaultReactivation::GridPart, std::string>& partNames,
bool voidRatioFromEclipse,
bool stressFromGrid )
bool voidRatioFromEclipse )
{
// PREDEFINED FIELDS
struct PredefinedField
Expand Down Expand Up @@ -554,7 +552,7 @@ std::pair<bool, std::string>
RifInpExportTools::printHeading( stream, "INCLUDE, input=" + fileName.toStdString() );
}

if ( stressFromGrid )
// stress export
{
// Export the stress to a separate inp file
std::string stressName = "STRESS";
Expand Down Expand Up @@ -851,8 +849,11 @@ std::shared_ptr<RimFaultReactivationDataAccess>
if ( eCase == nullptr ) return nullptr;

// extract data for each timestep
auto dataAccess =
std::make_shared<RimFaultReactivationDataAccess>( rimModel, eCase, rimModel.geoMechCase(), rimModel.selectedTimeStepIndexes() );
auto dataAccess = std::make_shared<RimFaultReactivationDataAccess>( rimModel,
eCase,
rimModel.geoMechCase(),
rimModel.selectedTimeStepIndexes(),
rimModel.stressSource() );
dataAccess->extractModelData( *rimModel.model() );
return dataAccess;
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class RifFaultReactivationModelExporter
const RimFaultReactivationDataAccess& dataAccess,
const std::string& exportDirectory,
const std::map<RimFaultReactivation::GridPart, std::string>& partNames,
bool useGridVoidRatio,
bool useGridStress );
bool useGridVoidRatio );
static std::pair<bool, std::string> printSteps( std::ostream& stream,
const RigFaultReactivationModel& model,
const RimFaultReactivationDataAccess& dataAccess,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationDataAccessorStressGeoMech.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationDataAccessorStressEclipse.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationDataAccessorWellLogExtraction.cpp
${CMAKE_CURRENT_LIST_DIR}/RimFaultReactivationEnums.cpp
)

list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,19 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( const RimFaultReactivationModel& model,
RimEclipseCase* thecase,
RimGeoMechCase* geoMechCase,
const std::vector<size_t>& timeSteps )
RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( const RimFaultReactivationModel& model,
RimEclipseCase* eCase,
RimGeoMechCase* geoMechCase,
const std::vector<size_t>& timeSteps,
RimFaultReactivation::StressSource stressSource )
: m_timeSteps( timeSteps )
{
double porePressureGradient = 1.0;
double topTemperature = model.seabedTemperature();
double seabedDepth = -model.seaBedDepth();
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorPorePressure>( thecase, porePressureGradient, seabedDepth ) );
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorVoidRatio>( thecase, 0.0001 ) );
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorTemperature>( thecase, topTemperature, seabedDepth ) );
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorPorePressure>( eCase, porePressureGradient, seabedDepth ) );
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorVoidRatio>( eCase, 0.0001 ) );
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorTemperature>( eCase, topTemperature, seabedDepth ) );

std::vector<RimFaultReactivation::Property> stressProperties = { RimFaultReactivation::Property::StressTop,
RimFaultReactivation::Property::DepthTop,
Expand All @@ -75,7 +76,10 @@ RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( const RimFaultRe
{
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorGeoMech>( geoMechCase, property ) );
}
}

if ( ( stressSource == RimFaultReactivation::StressSource::StressFromGeoMech ) && ( geoMechCase ) )
{
for ( auto property : stressProperties )
{
m_accessors.push_back(
Expand All @@ -102,13 +106,12 @@ RimFaultReactivationDataAccess::RimFaultReactivationDataAccess( const RimFaultRe
std::map<RimFaultReactivation::ElementSets, double> densities = extractDensities( model );
for ( auto property : stressProperties )
{
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorStressEclipse>( thecase,
m_accessors.push_back( std::make_shared<RimFaultReactivationDataAccessorStressEclipse>( eCase,
property,
porePressureGradient,
seabedDepth,
model.waterDensity(),
model.lateralStressCoefficientX(),
model.lateralStressCoefficientY(),
model.lateralStressCoefficient(),
densities ) );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ class RimFaultReactivationModel;
class RimFaultReactivationDataAccess
{
public:
RimFaultReactivationDataAccess( const RimFaultReactivationModel& model,
RimEclipseCase* eclipseCase,
RimGeoMechCase* geoMechCase,
const std::vector<size_t>& timeSteps );
RimFaultReactivationDataAccess( const RimFaultReactivationModel& model,
RimEclipseCase* eclipseCase,
RimGeoMechCase* geoMechCase,
const std::vector<size_t>& timeSteps,
RimFaultReactivation::StressSource stressSource );
~RimFaultReactivationDataAccess();

void extractModelData( const RigFaultReactivationModel& model );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,14 @@ RimFaultReactivationDataAccessorStressEclipse::RimFaultReactivationDataAccessorS
double gradient,
double seabedDepth,
double waterDensity,
double lateralStressComponentX,
double lateralStressComponentY,
double lateralStressComponent,
const std::map<RimFaultReactivation::ElementSets, double>& densities )
: RimFaultReactivationDataAccessorStress( property, gradient, seabedDepth )
, m_eclipseCase( eclipseCase )
, m_caseData( nullptr )
, m_mainGrid( nullptr )
, m_waterDensity( waterDensity )
, m_lateralStressComponentX( lateralStressComponentX )
, m_lateralStressComponentY( lateralStressComponentY )
, m_lateralStressComponent( lateralStressComponent )
, m_densities( densities )
{
if ( m_eclipseCase )
Expand Down Expand Up @@ -291,7 +289,7 @@ std::pair<bool, RimFaultReactivation::ElementSets> RimFaultReactivationDataAcces
double RimFaultReactivationDataAccessorStressEclipse::lateralStressComponentX( const cvf::Vec3d& position,
RimFaultReactivation::GridPart gridPart ) const
{
return m_lateralStressComponentX;
return m_lateralStressComponent;
}

//--------------------------------------------------------------------------------------------------
Expand All @@ -300,5 +298,5 @@ double RimFaultReactivationDataAccessorStressEclipse::lateralStressComponentX( c
double RimFaultReactivationDataAccessorStressEclipse::lateralStressComponentY( const cvf::Vec3d& position,
RimFaultReactivation::GridPart gridPart ) const
{
return m_lateralStressComponentY;
return m_lateralStressComponent;
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class RimFaultReactivationDataAccessorStressEclipse : public RimFaultReactivatio
double gradient,
double seabedDepth,
double waterDensity,
double lateralStressComponentX,
double lateralStressComponentY,
double lateralStressComponent,
const std::map<RimFaultReactivation::ElementSets, double>& densities );
~RimFaultReactivationDataAccessorStressEclipse() override;

Expand Down Expand Up @@ -91,8 +90,7 @@ class RimFaultReactivationDataAccessorStressEclipse : public RimFaultReactivatio
const RigMainGrid* m_mainGrid;
cvf::ref<RigResultAccessor> m_resultAccessor;
double m_waterDensity;
double m_lateralStressComponentX;
double m_lateralStressComponentY;
double m_lateralStressComponent;

std::map<RimFaultReactivation::GridPart, cvf::ref<RigWellPath>> m_wellPaths;
std::map<RimFaultReactivation::GridPart, cvf::ref<RigEclipseWellLogExtractor>> m_extractors;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2024 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////

#include "RimFaultReactivationEnums.h"

#include "cafAppEnum.h"

namespace caf
{
template <>
void caf::AppEnum<RimFaultReactivation::StressSource>::setUp()
{
addItem( RimFaultReactivation::StressSource::StressFromEclipse, "StressFromEclipse", "Eclipse Model" );
addItem( RimFaultReactivation::StressSource::StressFromGeoMech, "StressFromGeoMech", "Geo-Mech Model" );
setDefault( RimFaultReactivation::StressSource::StressFromEclipse );
}

} // namespace caf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ enum class ElementSets
FaultZone
};

enum class StressSource
{
StressFromEclipse,
StressFromGeoMech
};

enum class Property
{
PorePressure,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,13 @@ RimFaultReactivationModel::RimFaultReactivationModel()
CAF_PDM_InitField( &m_useGridTemperature, "UseGridTemperature", true, "Output Grid Temperature" );
CAF_PDM_InitField( &m_useGridDensity, "UseGridDensity", false, "Output Grid Density" );
CAF_PDM_InitField( &m_useGridElasticProperties, "UseGridElasticProperties", false, "Output Grid Elastic Properties" );
CAF_PDM_InitField( &m_useGridStress, "UseGridStress", false, "Output Grid Stress" );

CAF_PDM_InitField( &m_waterDensity, "WaterDensity", 1030.0, "Water Density [kg/m3]" );
CAF_PDM_InitField( &m_frictionAngleDeg, "FrictionAngle", 20.0, "Friction Angle [degree]" );
CAF_PDM_InitField( &m_frictionAngleDeg, "FrictionAngle", 20.0, "Fault Friction Angle [degree]" );
CAF_PDM_InitField( &m_seabedTemperature, "SeabedTemperature", 5.0, "Seabed Temperature [C]" );
CAF_PDM_InitField( &m_lateralStressCoefficient, "LateralStressCoefficient", 0.5, "Lateral Stress Coefficient" );

CAF_PDM_InitField( &m_lateralStressCoefficientX, "LateralStressCoefficientX", 0.5, "Lateral Stress Coeff. X" );
CAF_PDM_InitField( &m_lateralStressCoefficientY, "LateralStressCoefficientY", 0.5, "Lateral Stress Coeff. Y" );
CAF_PDM_InitFieldNoDefault( &m_stressSource, "StressSource", "Use Stress from" );

CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" );
m_targets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() );
Expand Down Expand Up @@ -223,7 +222,7 @@ std::pair<bool, std::string> RimFaultReactivationModel::validateModel() const

if ( ( m_frictionAngleDeg() <= 0.0 ) || ( m_frictionAngleDeg() >= 90.0 ) )
{
return std::make_pair( false, "Friction angle must be between 0 and 90 degrees" + postStr );
return std::make_pair( false, "Fault Friction Angle must be between 0 and 90 degrees" + postStr );
}

return std::make_pair( true, "" );
Expand Down Expand Up @@ -492,23 +491,35 @@ void RimFaultReactivationModel::defineUiOrdering( QString uiConfigName, caf::Pdm
{
propertiesGrp->add( &m_useGridDensity );
propertiesGrp->add( &m_useGridElasticProperties );
propertiesGrp->add( &m_waterDensity );
propertiesGrp->add( &m_useGridStress );
propertiesGrp->add( &m_seabedTemperature );

bool useTemperatureFromGrid = m_useGridTemperature();
m_seabedTemperature.uiCapability()->setUiReadOnly( !useTemperatureFromGrid );
}

if ( !hasGeoMechCase || !m_useGridStress() )
propertiesGrp->add( &m_stressSource );
if ( hasGeoMechCase )
{
m_stressSource.uiCapability()->setUiReadOnly( false );
}
else
{
propertiesGrp->add( &m_lateralStressCoefficientX );
propertiesGrp->add( &m_lateralStressCoefficientY );
m_stressSource = RimFaultReactivation::StressSource::StressFromEclipse;
m_stressSource.uiCapability()->setUiReadOnly( true );
}

propertiesGrp->add( &m_frictionAngleDeg );
auto parmGrp = propertiesGrp->addNewGroup( "Parameters" );

uiOrdering.add( &m_targets );
parmGrp->add( &m_frictionAngleDeg );
if ( m_stressSource() == RimFaultReactivation::StressSource::StressFromEclipse )
{
parmGrp->add( &m_lateralStressCoefficient );
}

if ( hasGeoMechCase )
{
parmGrp->add( &m_waterDensity );
parmGrp->add( &m_seabedTemperature );
}

uiOrdering.skipRemainingFields();
}
Expand Down Expand Up @@ -798,9 +809,9 @@ bool RimFaultReactivationModel::useGridElasticProperties() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimFaultReactivationModel::useGridStress() const
RimFaultReactivation::StressSource RimFaultReactivationModel::stressSource() const
{
return m_useGridStress();
return m_stressSource();
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -838,15 +849,7 @@ double RimFaultReactivationModel::seabedTemperature() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFaultReactivationModel::lateralStressCoefficientX() const
{
return m_lateralStressCoefficientX;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
double RimFaultReactivationModel::lateralStressCoefficientY() const
double RimFaultReactivationModel::lateralStressCoefficient() const
{
return m_lateralStressCoefficientY;
return m_lateralStressCoefficient;
}
Loading

0 comments on commit ceaec4a

Please sign in to comment.