From 87c1041fd397662c294d671a5aa0969e55e14edc Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 20 Sep 2023 15:37:15 +0200 Subject: [PATCH] Fault Reactivation Model: include local coord rotation in INP export. --- .../RicExportInpFileFeature.cpp | 2 +- .../RicRunFaultReactModelingFeature.cpp | 2 +- .../RicShowFaultReactModelFeature.cpp | 2 +- .../RifFaultReactivationModelExporter.cpp | 26 ++++++++++++------- .../RifFaultReactivationModelExporter.h | 18 ++++++------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportInpFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportInpFileFeature.cpp index b22493301b..378d678283 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportInpFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportInpFileFeature.cpp @@ -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 ); } } diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp index 596d8d1a6c..0fc6266860 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicRunFaultReactModelingFeature.cpp @@ -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 ) { diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp index 57a93614bb..294d7581c3 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicShowFaultReactModelFeature.cpp @@ -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 = diff --git a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp index 230a0cd3fe..9c92aba14f 100644 --- a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.cpp @@ -32,7 +32,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::pair RifFaultReactivationModelExporter::exportToStream( std::ostream& stream, const RigFaultReactivationModel& model ) +std::pair RifFaultReactivationModelExporter::exportToStream( std::ostream& stream, const RimFaultReactivationModel& rimModel ) { std::string applicationNameAndVersion = std::string( RI_APPLICATION_NAME ) + " " + std::string( STRPRODUCTVER ); @@ -64,12 +64,14 @@ std::pair 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 ); @@ -82,7 +84,7 @@ std::pair RifFaultReactivationModelExporter::exportToStream( /// //-------------------------------------------------------------------------------------------------- std::pair RifFaultReactivationModelExporter::exportToFile( const std::string& filePath, - const RigFaultReactivationModel& model ) + const RimFaultReactivationModel& model ) { std::ofstream stream( filePath ); return exportToStream( stream, model ); @@ -112,9 +114,8 @@ std::pair RifFaultReactivationModelExporter::printParts( const std::map& partNames, const std::vector>& borders, const std::map, int>& faces, - const std::map& boundaries - -) + const std::map& boundaries, + const std::pair& orientation ) { RifInpExportTools::printSectionComment( stream, "PARTS" ); @@ -171,8 +172,15 @@ std::pair 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" ); diff --git a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h index 8493b2a496..12ccc7c338 100644 --- a/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h +++ b/ApplicationLibCode/FileInterface/RifFaultReactivationModelExporter.h @@ -19,24 +19,23 @@ #pragma once #include "RigFaultReactivationModel.h" - #include "RigGriddedPart3d.h" +#include "RimFaultReactivationModel.h" + #include #include #include #include -class RigFaultReactivationModel; - //================================================================================================== /// //================================================================================================== class RifFaultReactivationModelExporter { public: - static std::pair exportToStream( std::ostream& stream, const RigFaultReactivationModel& model ); - static std::pair exportToFile( const std::string& filePath, const RigFaultReactivationModel& model ); + static std::pair exportToStream( std::ostream& stream, const RimFaultReactivationModel& model ); + static std::pair exportToFile( const std::string& filePath, const RimFaultReactivationModel& model ); private: static std::pair printHeading( std::ostream& stream, const std::string& applicationNameAndVersion ); @@ -46,7 +45,8 @@ class RifFaultReactivationModelExporter const std::map& partNames, const std::vector>& borders, const std::map, int>& faces, - const std::map& boundaries ); + const std::map& boundaries, + const std::pair& orientation ); static std::pair printAssembly( std::ostream& stream, const RigFaultReactivationModel& model, @@ -55,11 +55,11 @@ class RifFaultReactivationModelExporter static std::pair printMaterials( std::ostream& stream ); static std::pair printInteractionProperties( std::ostream& stream, double faultFriction ); - static std::pair printBoundaryConditions( std::ostream& stream, - const RigFaultReactivationModel& model, + static std::pair printBoundaryConditions( std::ostream& stream, + const RigFaultReactivationModel& model, const std::map& partNames, const std::map& boundaries ); - static std::pair printPredefinedFields( std::ostream& stream, + static std::pair printPredefinedFields( std::ostream& stream, const std::map& partNames ); static std::pair printSteps( std::ostream& stream, const std::map& partNames );