2020-09-04 03:23:19 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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 <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
#include "RifStimPlanModelGeologicalFrkExporter.h"
|
2020-09-04 03:23:19 -05:00
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
#include "RimStimPlanModel.h"
|
|
|
|
#include "RimStimPlanModelCalculator.h"
|
2020-09-04 03:23:19 -05:00
|
|
|
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTextStream>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-11-04 06:46:17 -06:00
|
|
|
bool RifStimPlanModelGeologicalFrkExporter::writeToFile( RimStimPlanModel* stimPlanModel,
|
2020-10-16 04:27:46 -05:00
|
|
|
bool useDetailedLoss,
|
|
|
|
const QString& filepath )
|
2020-09-04 03:23:19 -05:00
|
|
|
{
|
|
|
|
std::vector<QString> labels;
|
|
|
|
// TVD depth of top of zone (ft)
|
|
|
|
labels.push_back( "dpthlyr" );
|
|
|
|
|
|
|
|
// Stress at top of zone (psi)
|
|
|
|
labels.push_back( "strs" );
|
|
|
|
|
|
|
|
// Stress gradient (psi/ft)
|
|
|
|
labels.push_back( "strsg" );
|
|
|
|
|
|
|
|
// Young's modulus (MMpsi)
|
|
|
|
labels.push_back( "elyr" );
|
|
|
|
|
|
|
|
// Poisson's Ratio
|
|
|
|
labels.push_back( "poissonr" );
|
|
|
|
|
|
|
|
// K-Ic (psi*sqrt(in)
|
|
|
|
labels.push_back( "tuflyr" );
|
|
|
|
|
|
|
|
// Fluid Loss Coefficient
|
|
|
|
labels.push_back( "clyrc" );
|
|
|
|
|
|
|
|
// Spurt loss (gal/100f^2)
|
|
|
|
labels.push_back( "clyrs" );
|
|
|
|
|
|
|
|
// Proppand Embedmeent (lb/ft^2)
|
|
|
|
labels.push_back( "pembed" );
|
|
|
|
|
|
|
|
if ( useDetailedLoss )
|
|
|
|
{
|
|
|
|
// B2 Detailed Loss
|
|
|
|
// Reservoir Pressure (psi)
|
|
|
|
labels.push_back( "zoneResPres" );
|
|
|
|
|
|
|
|
// Immobile Fluid Saturation (fraction)
|
|
|
|
labels.push_back( "zoneWaterSat" );
|
|
|
|
|
|
|
|
// Porosity (fraction)
|
|
|
|
labels.push_back( "zonePorosity" );
|
|
|
|
|
|
|
|
// Horizontal Perm (md)
|
|
|
|
labels.push_back( "zoneHorizPerm" );
|
|
|
|
|
|
|
|
// Vertical Perm (md)
|
|
|
|
labels.push_back( "zoneVertPerm" );
|
|
|
|
|
|
|
|
// Temperature (F)
|
|
|
|
labels.push_back( "zoneTemp" );
|
|
|
|
|
|
|
|
// Relative permeability
|
|
|
|
labels.push_back( "zoneRelPerm" );
|
|
|
|
|
|
|
|
// Poro-Elastic constant
|
|
|
|
labels.push_back( "zonePoroElas" );
|
|
|
|
|
|
|
|
// Thermal Epansion Coefficient (1/F)
|
|
|
|
labels.push_back( "zoneThermalExp" );
|
|
|
|
}
|
|
|
|
|
|
|
|
std::map<QString, std::vector<double>> values;
|
2020-11-04 06:46:17 -06:00
|
|
|
values["dpthlyr"] = stimPlanModel->calculator()->calculateTrueVerticalDepth();
|
|
|
|
values["strs"] = stimPlanModel->calculator()->calculateStress();
|
|
|
|
values["strsg"] = stimPlanModel->calculator()->calculateStressGradient();
|
|
|
|
values["elyr"] = stimPlanModel->calculator()->calculateYoungsModulus();
|
|
|
|
values["poissonr"] = stimPlanModel->calculator()->calculatePoissonsRatio();
|
|
|
|
values["tuflyr"] = stimPlanModel->calculator()->calculateKIc();
|
|
|
|
values["clyrc"] = stimPlanModel->calculator()->calculateFluidLossCoefficient();
|
|
|
|
values["clyrs"] = stimPlanModel->calculator()->calculateSpurtLoss();
|
|
|
|
values["pembed"] = stimPlanModel->calculator()->calculateProppandEmbedment();
|
|
|
|
values["zoneResPres"] = stimPlanModel->calculator()->calculateReservoirPressure();
|
|
|
|
values["zoneWaterSat"] = stimPlanModel->calculator()->calculateImmobileFluidSaturation();
|
|
|
|
values["zonePorosity"] = stimPlanModel->calculator()->calculatePorosity();
|
|
|
|
values["zoneHorizPerm"] = stimPlanModel->calculator()->calculateHorizontalPermeability();
|
|
|
|
values["zoneVertPerm"] = stimPlanModel->calculator()->calculateVerticalPermeability();
|
|
|
|
values["zoneTemp"] = stimPlanModel->calculator()->calculateTemperature();
|
|
|
|
values["zoneRelPerm"] = stimPlanModel->calculator()->calculateRelativePermeabilityFactor();
|
|
|
|
values["zonePoroElas"] = stimPlanModel->calculator()->calculatePoroElasticConstant();
|
|
|
|
values["zoneThermalExp"] = stimPlanModel->calculator()->calculateThermalExpansionCoefficient();
|
2020-09-04 03:23:19 -05:00
|
|
|
|
|
|
|
QFile data( filepath );
|
|
|
|
if ( !data.open( QFile::WriteOnly | QFile::Truncate ) )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextStream stream( &data );
|
|
|
|
appendHeaderToStream( stream );
|
|
|
|
|
|
|
|
for ( QString label : labels )
|
|
|
|
{
|
|
|
|
appendToStream( stream, label, values[label] );
|
|
|
|
}
|
|
|
|
|
|
|
|
appendFooterToStream( stream );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
void RifStimPlanModelGeologicalFrkExporter::appendHeaderToStream( QTextStream& stream )
|
2020-09-04 03:23:19 -05:00
|
|
|
{
|
|
|
|
stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl << "<geologic>" << endl;
|
|
|
|
}
|
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
void RifStimPlanModelGeologicalFrkExporter::appendToStream( QTextStream& stream,
|
2020-09-04 03:23:19 -05:00
|
|
|
const QString& label,
|
|
|
|
const std::vector<double>& values )
|
|
|
|
{
|
|
|
|
stream << "<cNamedSet>" << endl
|
|
|
|
<< "<name>" << endl
|
|
|
|
<< label << endl
|
|
|
|
<< "</name>" << endl
|
|
|
|
<< "<dimCount>" << endl
|
|
|
|
<< 1 << endl
|
|
|
|
<< "</dimCount>" << endl
|
|
|
|
<< "<sizes>" << endl
|
|
|
|
<< values.size() << endl
|
|
|
|
<< "</sizes>" << endl
|
|
|
|
<< "<data>" << endl;
|
|
|
|
for ( auto val : values )
|
|
|
|
{
|
|
|
|
stream << val << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
stream << "</data>" << endl << "</cNamedSet>" << endl;
|
|
|
|
}
|
|
|
|
|
2020-11-04 06:46:17 -06:00
|
|
|
void RifStimPlanModelGeologicalFrkExporter::appendFooterToStream( QTextStream& stream )
|
2020-09-04 03:23:19 -05:00
|
|
|
{
|
|
|
|
stream << "</geologic>" << endl;
|
|
|
|
}
|