///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2020- 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 // for more details. // ///////////////////////////////////////////////////////////////////////////////// #pragma once #include "RiaStimPlanModelDefines.h" #include "RimStimPlanModelPropertyCalculator.h" #include #include #include class RimStimPlanModel; class RimStimPlanModelCalculator { public: RimStimPlanModelCalculator(); void setStimPlanModel( RimStimPlanModel* stimPlanModel ); RimStimPlanModel* stimPlanModel(); bool extractCurveData( RiaDefines::CurveProperty curveProperty, int timeStep, std::vector& values, std::vector& measuredDepthValues, std::vector& tvDepthValues, double& rkbDiff ) const; std::vector extractValues( RiaDefines::CurveProperty curveProperty, int timeStep ) const; std::vector calculateTrueVerticalDepth() const; std::vector calculatePorosity() const; std::vector calculateVerticalPermeability() const; std::vector calculateHorizontalPermeability() const; std::vector calculateReservoirPressure() const; std::vector calculateStress() const; std::vector calculateInitialStress() const; std::vector calculateStressGradient() const; std::vector calculateYoungsModulus() const; std::vector calculatePoissonsRatio() const; std::vector calculateKIc() const; std::vector calculateFluidLossCoefficient() const; std::vector calculateSpurtLoss() const; std::vector calculateProppandEmbedment() const; std::vector calculateImmobileFluidSaturation() const; std::vector calculateTemperature() const; std::vector calculateRelativePermeabilityFactor() const; std::vector calculatePoroElasticConstant() const; std::vector calculateThermalExpansionCoefficient() const; std::pair, std::vector> calculateFacies() const; std::pair, std::vector> calculateFormation() const; void calculateTemperature( std::vector& temperatures ) const; void clearCache(); protected: std::vector findCurveAndComputeLayeredAverage( RiaDefines::CurveProperty curveProperty ) const; std::vector findCurveXValuesByProperty( RiaDefines::CurveProperty curveProperty ) const; std::vector findCurveAndComputeTopOfLayer( RiaDefines::CurveProperty curveProperty ) const; void calculateLayers( std::vector>& layerBoundaryDepths, std::vector>& layerBoundaryIndexes ) const; bool calculateStressWithGradients( std::vector& stress, std::vector& stressGradients, std::vector& initialStress ) const; static double findValueAtTopOfLayer( const std::vector& values, const std::vector>& layerBoundaryIndexes, size_t layerNo ); static double findValueAtBottomOfLayer( const std::vector& values, const std::vector>& layerBoundaryIndexes, size_t layerNo ); static void computeAverageByLayer( const std::vector>& layerBoundaryIndexes, const std::vector& inputVector, std::vector& result ); static void extractTopOfLayerValues( const std::vector>& layerBoundaryIndexes, const std::vector& inputVector, std::vector& result ); double calculateStressGradientForLayer( size_t i, std::vector> layerBoundaryIndexes, double depthTopOfZone, double depthBottomOfZone, double topSv, const std::vector& initialPressureData, const std::vector& pressureDiffData, double stressDepthRef, double verticalStressRef, double verticalStressGradientRef, double k0 ) const; static double calculateStressDifferenceAtDepth( double depth, double offset, double stressDepthRef, double verticalStressRef, double verticalStressGradientRef ); static double calculateStressAtDepth( double depth, double stressDepthRef, double verticalStressRef, double verticalStressGradientRef ); static bool isValidInputData( const std::vector& values, const QString& propertyName, const std::vector>& layerBoundaryIndexes, const std::vector>& layerBoundaryDepths ); private: RimStimPlanModel* m_stimPlanModel; std::vector> m_resultCalculators; using ResultKey = std::pair; using ResultData = std::tuple, std::vector, std::vector, double>; mutable std::map m_resultCache; };