Skip to content

Commit

Permalink
Fault Reactivation Model: include local coord rotation in INP export.
Browse files Browse the repository at this point in the history
  • Loading branch information
kriben committed Sep 20, 2023
1 parent 70681cb commit 87c1041
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void RicExportInpFileFeature::onActionTriggered( bool isChecked )
if ( faultReactivationModel )
{
QString exportFile = faultReactivationModel->baseDir() + "/faultreactivation.inp";
RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *faultReactivationModel->model() );
RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *faultReactivationModel );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void RicRunFaultReactModelingFeature::onActionTriggered( bool isChecked )
}

QString exportFile = model->inputFilename();
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *model->model() );
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *model );

if ( !result )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void RicShowFaultReactModelFeature::onActionTriggered( bool isChecked )
const QString frmTitle( "Fault Reactivation Modeling" );
const QString exportFile = model->inputFilename();

auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *model->model() );
auto [result, errText] = RifFaultReactivationModelExporter::exportToFile( exportFile.toStdString(), *model );
if ( !result )
{
QString outErrorText =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream( std::ostream& stream, const RigFaultReactivationModel& model )
std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream( std::ostream& stream, const RimFaultReactivationModel& rimModel )
{
std::string applicationNameAndVersion = std::string( RI_APPLICATION_NAME ) + " " + std::string( STRPRODUCTVER );

Expand Down Expand Up @@ -64,12 +64,14 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream(

double faultFriction = 0.0;

auto model = rimModel.model();
CAF_ASSERT( !model.isNull() );
printHeading( stream, applicationNameAndVersion );
printParts( stream, model, partNames, borders, faces, boundaries );
printAssembly( stream, model, partNames );
printParts( stream, *model, partNames, borders, faces, boundaries, rimModel.localCoordSysNormalsXY() );
printAssembly( stream, *model, partNames );
printMaterials( stream );
printInteractionProperties( stream, faultFriction );
printBoundaryConditions( stream, model, partNames, boundaries );
printBoundaryConditions( stream, *model, partNames, boundaries );
printPredefinedFields( stream, partNames );
printInteractions( stream, partNames, borders );
printSteps( stream, partNames );
Expand All @@ -82,7 +84,7 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToStream(
///
//--------------------------------------------------------------------------------------------------
std::pair<bool, std::string> RifFaultReactivationModelExporter::exportToFile( const std::string& filePath,
const RigFaultReactivationModel& model )
const RimFaultReactivationModel& model )
{
std::ofstream stream( filePath );
return exportToStream( stream, model );
Expand Down Expand Up @@ -112,9 +114,8 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::printParts(
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames,
const std::vector<std::pair<RigGriddedPart3d::BorderSurface, std::string>>& borders,
const std::map<std::pair<RigFaultReactivationModel::GridPart, RigGriddedPart3d::BorderSurface>, int>& faces,
const std::map<RigGriddedPart3d::Boundary, std::string>& boundaries

)
const std::map<RigGriddedPart3d::Boundary, std::string>& boundaries,
const std::pair<cvf::Vec3d, cvf::Vec3d>& orientation )
{
RifInpExportTools::printSectionComment( stream, "PARTS" );

Expand Down Expand Up @@ -171,8 +172,15 @@ std::pair<bool, std::string> RifFaultReactivationModelExporter::printParts(
}
}

// Print local orientation
std::string orientationName = "ori";
RifInpExportTools::printHeading( stream, "Orientation, name=" + orientationName );
auto [dir1, dir2] = orientation;
RifInpExportTools::printNumbers( stream, { dir1.x(), dir1.y(), dir1.z(), dir2.x(), dir2.y(), dir2.z() } );
RifInpExportTools::printLine( stream, "3, 0.0" );

RifInpExportTools::printComment( stream, "Section: sand" );
RifInpExportTools::printHeading( stream, "Solid Section, elset=" + partName + ", material=sand" );
RifInpExportTools::printHeading( stream, "Solid Section, elset=" + partName + ", orientation=" + orientationName + ", material=sand" );

RifInpExportTools::printLine( stream, "," );
RifInpExportTools::printHeading( stream, "End Part" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,23 @@
#pragma once

#include "RigFaultReactivationModel.h"

#include "RigGriddedPart3d.h"

#include "RimFaultReactivationModel.h"

#include <map>
#include <ostream>
#include <string>
#include <vector>

class RigFaultReactivationModel;

//==================================================================================================
///
//==================================================================================================
class RifFaultReactivationModelExporter
{
public:
static std::pair<bool, std::string> exportToStream( std::ostream& stream, const RigFaultReactivationModel& model );
static std::pair<bool, std::string> exportToFile( const std::string& filePath, const RigFaultReactivationModel& model );
static std::pair<bool, std::string> exportToStream( std::ostream& stream, const RimFaultReactivationModel& model );
static std::pair<bool, std::string> exportToFile( const std::string& filePath, const RimFaultReactivationModel& model );

private:
static std::pair<bool, std::string> printHeading( std::ostream& stream, const std::string& applicationNameAndVersion );
Expand All @@ -46,7 +45,8 @@ class RifFaultReactivationModelExporter
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames,
const std::vector<std::pair<RigGriddedPart3d::BorderSurface, std::string>>& borders,
const std::map<std::pair<RigFaultReactivationModel::GridPart, RigGriddedPart3d::BorderSurface>, int>& faces,
const std::map<RigGriddedPart3d::Boundary, std::string>& boundaries );
const std::map<RigGriddedPart3d::Boundary, std::string>& boundaries,
const std::pair<cvf::Vec3d, cvf::Vec3d>& orientation );

static std::pair<bool, std::string> printAssembly( std::ostream& stream,
const RigFaultReactivationModel& model,
Expand All @@ -55,11 +55,11 @@ class RifFaultReactivationModelExporter
static std::pair<bool, std::string> printMaterials( std::ostream& stream );

static std::pair<bool, std::string> printInteractionProperties( std::ostream& stream, double faultFriction );
static std::pair<bool, std::string> printBoundaryConditions( std::ostream& stream,
const RigFaultReactivationModel& model,
static std::pair<bool, std::string> printBoundaryConditions( std::ostream& stream,
const RigFaultReactivationModel& model,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames,
const std::map<RigGriddedPart3d::Boundary, std::string>& boundaries );
static std::pair<bool, std::string> printPredefinedFields( std::ostream& stream,
static std::pair<bool, std::string> printPredefinedFields( std::ostream& stream,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames );
static std::pair<bool, std::string> printSteps( std::ostream& stream,
const std::map<RigFaultReactivationModel::GridPart, std::string>& partNames );
Expand Down

0 comments on commit 87c1041

Please sign in to comment.