{ "cells": [ { "cell_type": "markdown", "id": "4997d777", "metadata": { "papermill": { "duration": 0.014579, "end_time": "2026-03-13T20:49:56.631152", "exception": false, "start_time": "2026-03-13T20:49:56.616573", "status": "completed" }, "tags": [] }, "source": [ "(field_stress_example)=\n", "# Field Stress Script Examples" ] }, { "cell_type": "markdown", "id": "652c41de", "metadata": { "papermill": { "duration": 0.015081, "end_time": "2026-03-13T20:49:56.664432", "exception": false, "start_time": "2026-03-13T20:49:56.649351", "status": "completed" }, "tags": [] }, "source": [ "Download the [blankModel.rs3v3](https://github.com/Rocscience/rs3-scripting/tree/main/docs/example_code/example_models/blankModel.rs3v3) for this example." ] }, { "cell_type": "code", "execution_count": 1, "id": "f3288b4a", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:49:56.696915Z", "iopub.status.busy": "2026-03-13T20:49:56.696355Z", "iopub.status.idle": "2026-03-13T20:49:57.087319Z", "shell.execute_reply": "2026-03-13T20:49:57.082966Z" }, "papermill": { "duration": 0.410059, "end_time": "2026-03-13T20:49:57.089620", "exception": false, "start_time": "2026-03-13T20:49:56.679561", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "from rs3.RS3Modeler import RS3Modeler\n", "from rs3.loadings.LoadingEnums import *\n", "from rs3.CommonEnums import *\n", "import os\n", "import shutil" ] }, { "cell_type": "markdown", "id": "bdd2f737", "metadata": { "papermill": { "duration": 0.008492, "end_time": "2026-03-13T20:49:57.109632", "exception": false, "start_time": "2026-03-13T20:49:57.101140", "status": "completed" }, "tags": [] }, "source": [ "Get the current folder directory." ] }, { "cell_type": "code", "execution_count": 2, "id": "5fceeae1", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:49:57.130915Z", "iopub.status.busy": "2026-03-13T20:49:57.130474Z", "iopub.status.idle": "2026-03-13T20:49:57.135398Z", "shell.execute_reply": "2026-03-13T20:49:57.133984Z" }, "papermill": { "duration": 0.01973, "end_time": "2026-03-13T20:49:57.137465", "exception": false, "start_time": "2026-03-13T20:49:57.117735", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "current_dir = os.path.dirname(os.path.abspath(\"\"))" ] }, { "cell_type": "markdown", "id": "561e8648", "metadata": { "papermill": { "duration": 0.008623, "end_time": "2026-03-13T20:49:57.157279", "exception": false, "start_time": "2026-03-13T20:49:57.148656", "status": "completed" }, "tags": [] }, "source": [ "Specify a port number that is not in use and start the RS3 program." ] }, { "cell_type": "code", "execution_count": 3, "id": "83f9433b", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:49:57.176752Z", "iopub.status.busy": "2026-03-13T20:49:57.176332Z", "iopub.status.idle": "2026-03-13T20:50:28.597035Z", "shell.execute_reply": "2026-03-13T20:50:28.594841Z" }, "papermill": { "duration": 31.433736, "end_time": "2026-03-13T20:50:28.599135", "exception": false, "start_time": "2026-03-13T20:49:57.165399", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "2026-03-13 16:49:57,182 - Rocscience.RS3 - INFO - Attempting to start the application at C:\\Program Files\\Rocscience\\RS3\\RS3 and binding server to port 60105...\n" ] } ], "source": [ "port = 60105\n", "RS3Modeler.startApplication(port)" ] }, { "cell_type": "markdown", "id": "f02c506e", "metadata": { "papermill": { "duration": 0.010174, "end_time": "2026-03-13T20:50:28.617999", "exception": false, "start_time": "2026-03-13T20:50:28.607825", "status": "completed" }, "tags": [] }, "source": [ "Connect with the RS3 Modeler." ] }, { "cell_type": "code", "execution_count": 4, "id": "c82c27f4", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:50:28.639821Z", "iopub.status.busy": "2026-03-13T20:50:28.639294Z", "iopub.status.idle": "2026-03-13T20:50:28.653303Z", "shell.execute_reply": "2026-03-13T20:50:28.651333Z" }, "papermill": { "duration": 0.028633, "end_time": "2026-03-13T20:50:28.655064", "exception": false, "start_time": "2026-03-13T20:50:28.626431", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "modeler = RS3Modeler(port)" ] }, { "cell_type": "markdown", "id": "558842a6", "metadata": { "papermill": { "duration": 0.011529, "end_time": "2026-03-13T20:50:28.676239", "exception": false, "start_time": "2026-03-13T20:50:28.664710", "status": "completed" }, "tags": [] }, "source": [ "For the demonstration purposes only, the model is copied for reuse. You may change the model path to your own model path." ] }, { "cell_type": "code", "execution_count": 5, "id": "8e5cba89", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:50:28.695876Z", "iopub.status.busy": "2026-03-13T20:50:28.694907Z", "iopub.status.idle": "2026-03-13T20:50:28.727610Z", "shell.execute_reply": "2026-03-13T20:50:28.725856Z" }, "papermill": { "duration": 0.044286, "end_time": "2026-03-13T20:50:28.729171", "exception": false, "start_time": "2026-03-13T20:50:28.684885", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "blankModelPath = rf\"{current_dir}\\example_models\\blankModel.rs3v3\"\n", "copiedModelPath = rf\"{current_dir}\\example_models\\copiedModel.rs3v3\"\n", "_ = shutil.copy(blankModelPath, copiedModelPath)" ] }, { "cell_type": "markdown", "id": "b6e405e2", "metadata": { "papermill": { "duration": 0.009748, "end_time": "2026-03-13T20:50:28.749307", "exception": false, "start_time": "2026-03-13T20:50:28.739559", "status": "completed" }, "tags": [] }, "source": [ "Open the copied model file." ] }, { "cell_type": "code", "execution_count": 6, "id": "12597746", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:50:28.772776Z", "iopub.status.busy": "2026-03-13T20:50:28.772358Z", "iopub.status.idle": "2026-03-13T20:50:46.722188Z", "shell.execute_reply": "2026-03-13T20:50:46.720771Z" }, "papermill": { "duration": 17.963798, "end_time": "2026-03-13T20:50:46.723169", "exception": false, "start_time": "2026-03-13T20:50:28.759371", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "model = modeler.openFile(copiedModelPath)" ] }, { "cell_type": "markdown", "id": "1915e04e", "metadata": { "papermill": { "duration": 0.006284, "end_time": "2026-03-13T20:50:46.736111", "exception": false, "start_time": "2026-03-13T20:50:46.729827", "status": "completed" }, "tags": [] }, "source": [ "## 1. Constant Field Stress" ] }, { "cell_type": "markdown", "id": "66718133", "metadata": { "papermill": { "duration": 0.007655, "end_time": "2026-03-13T20:50:46.750457", "exception": false, "start_time": "2026-03-13T20:50:46.742802", "status": "completed" }, "tags": [] }, "source": [ "Field stress type needs to be set to CONSTANT. Otherwise, script cannot make changes to constant field stress properties." ] }, { "cell_type": "code", "execution_count": 7, "id": "0536532e", "metadata": { "execution": { "iopub.execute_input": "2026-03-13T20:50:46.768296Z", "iopub.status.busy": "2026-03-13T20:50:46.767878Z", "iopub.status.idle": "2026-03-13T20:50:46.961366Z", "shell.execute_reply": "2026-03-13T20:50:46.959620Z" }, "papermill": { "duration": 0.205666, "end_time": "2026-03-13T20:50:46.963419", "exception": false, "start_time": "2026-03-13T20:50:46.757753", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "model.Loadings.FieldStress.setType(FieldStressType.CONSTANT)" ] }, { "cell_type": "markdown", "id": "a830d6b2", "metadata": { "papermill": { "duration": 0.008448, "end_time": "2026-03-13T20:50:46.981483", "exception": false, "start_time": "2026-03-13T20:50:46.973035", "status": "completed" }, "tags": [] }, "source": [ "