{ "cells": [ { "cell_type": "markdown", "id": "aececd27", "metadata": { "papermill": { "duration": 0.002488, "end_time": "2026-03-19T15:08:22.916721", "exception": false, "start_time": "2026-03-19T15:08:22.914233", "status": "completed" }, "tags": [] }, "source": [ "(hydraulic property static groundwater example)=\n", "# Static Groundwater Script Examples" ] }, { "cell_type": "markdown", "id": "8f03602b", "metadata": { "papermill": { "duration": 0.001418, "end_time": "2026-03-19T15:08:22.920818", "exception": false, "start_time": "2026-03-19T15:08:22.919400", "status": "completed" }, "tags": [] }, "source": [ "Download the [StaticGroundwater.fez](https://github.com/Rocscience/rs2-scripting/blob/main/docs/example_code/example_models/StaticGroundwater.fez) for this example." ] }, { "cell_type": "code", "execution_count": 1, "id": "efd68734", "metadata": { "execution": { "iopub.execute_input": "2026-03-19T15:08:22.926057Z", "iopub.status.busy": "2026-03-19T15:08:22.925679Z", "iopub.status.idle": "2026-03-19T15:08:37.442375Z", "shell.execute_reply": "2026-03-19T15:08:37.440965Z" }, "papermill": { "duration": 14.521709, "end_time": "2026-03-19T15:08:37.443761", "exception": false, "start_time": "2026-03-19T15:08:22.922052", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Static Pore Water Pressure = 5.0\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Ru Value = 5.0\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Hu Value = 5.0\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "StaticGroundwater Factor Grid To Use = Default Grid, Static Groundwater Piezo To Use = None\n" ] } ], "source": [ "from rs2.modeler.RS2Modeler import RS2Modeler\n", "from rs2.modeler.properties.PropertyEnums import *\n", "import os\n", "\n", "current_dir = os.path.dirname(os.path.abspath(\"\")) \n", "RS2Modeler.startApplication(port=60067)\n", "modeler = RS2Modeler(port=60067)\n", "model = modeler.openFile(rf\"{current_dir}\\example_models\\StaticGroundwater.fez\")\n", "\n", "material = model.getAllMaterialProperties()[0]\n", "\n", "material.Hydraulic.setMaterialBehaviour(MaterialBehaviours.DRAINED)\n", "material.Hydraulic.setFluidBulkModulus(5)\n", "material.Hydraulic.setBiotsCoefficientCalculationMethod(eBiotCoefficients.BIOT_COEFFICIENT_AUTO)\n", "\n", "staticGroundwater = material.Hydraulic.StaticGroundwater\n", "staticGroundwater.setStaticWaterMode(StaticWaterModes.PORE_WATER_PRESSURE)\n", "staticGroundwater.setStaticPoreWaterPressure(5)\n", "poreWaterPressure = staticGroundwater.getStaticPoreWaterPressure()\n", "print(f\"Static Pore Water Pressure = {poreWaterPressure}\")\n", "\n", "staticGroundwater.setStaticWaterMode(StaticWaterModes.RU)\n", "staticGroundwater.setRuValue(5)\n", "ruValue = staticGroundwater.getRuValue()\n", "print(f\"Ru Value = {ruValue}\")\n", "\n", "staticGroundwater.setStaticWaterMode(StaticWaterModes.PIEZO)\n", "staticGroundwater.setPiezoToUse(\"1\")\n", "staticGroundwater.setHuType(HuTypes.CUSTOM)\n", "staticGroundwater.setHuValue(5)\n", "huValue = staticGroundwater.getHuValue()\n", "print(f\"Hu Value = {huValue}\")\n", "\n", "staticGroundwater.setStaticWaterMode(StaticWaterModes.GRID)\n", "staticGroundwater.setGridToUse(\"Default Grid\")\n", "\n", "# Manipulation of StaticGroundwater Stage Factor Properties for stage 2\n", "# Make sure to stage Hydraulic Stage Factor option before manipulating any factor properties\n", "material.StageFactors.setStageHydraulicStageFactor(True)\n", "definedStageFactors = material.StageFactors.getDefinedStageFactors()\n", "newStageFactor = material.StageFactors.createStageFactor(2)\n", "definedStageFactors[2] = newStageFactor\n", "material.StageFactors.setDefinedStageFactors(definedStageFactors)\n", "staticGroundwaterStageFactor = material.Hydraulic.StaticGroundwater.stageFactorInterface.getDefinedStageFactors()[2]\n", "\n", "staticGroundwaterStageFactor.setGridToUse(\"Default Grid\")\n", "staticGroundwaterStageFactor.setPiezoToUse(\"None\")\n", "\n", "print(f\"StaticGroundwater Factor Grid To Use = {staticGroundwaterStageFactor.getGridToUse()}, Static Groundwater Piezo To Use = {staticGroundwaterStageFactor.getPiezoToUse()}\")\n", "\n", "model.close()\n", "\n", "modeler.closeProgram()" ] } ], "metadata": { "kernelspec": { "display_name": "myenv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.0" }, "papermill": { "default_parameters": {}, "duration": 19.248438, "end_time": "2026-03-19T15:08:40.857710", "environment_variables": {}, "exception": null, "input_path": "C:\\Users\\GraceHu\\source\\repos\\RS2_Python_Client_Library\\docs\\example_code\\hydraulic\\static_groundwater_script_examples.ipynb", "output_path": "C:\\Users\\GraceHu\\source\\repos\\RS2_Python_Client_Library\\docs\\example_code\\hydraulic\\static_groundwater_script_examples.ipynb", "parameters": {}, "start_time": "2026-03-19T15:08:21.609272", "version": "2.6.0" } }, "nbformat": 4, "nbformat_minor": 5 }