.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/south_model/2_computing_south.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_south_model_2_computing_south.py: Model 2 - Computing Model ========================= This tutorial covers the steps required to compute a geological model using GemPy, including setup, computation, and visualization. .. GENERATED FROM PYTHON SOURCE LINES 9-12 **Step 1: Import Necessary Libraries** Importing the required libraries for environmental variable management, model generation, and visualization. .. GENERATED FROM PYTHON SOURCE LINES 12-18 .. code-block:: default import dotenv from gempy_geotop.example_models import generate_south_model_base import gempy as gp import gempy_viewer as gpv .. GENERATED FROM PYTHON SOURCE LINES 19-22 **Step 2: Load Environment Variables** Loading environment variables which may include paths or configurations necessary for the model generation. .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: default dotenv.load_dotenv() .. rst-class:: sphx-glr-script-out .. code-block:: none True .. GENERATED FROM PYTHON SOURCE LINES 26-30 **Step 3: Generate Base Geological Model** We start by generating a base geological model using predefined settings. This function might configure basic layers, fault systems, and other geological parameters based on the southern region model. .. GENERATED FROM PYTHON SOURCE LINES 30-33 .. code-block:: default geo_model = generate_south_model_base(group_slicer=slice(0, 10)) .. rst-class:: sphx-glr-script-out .. code-block:: none [120071, 209998, 370060, 419970, -901.5, 48.68] Could not find element 'KR' in any group. Could not find element 'KW' in any group. Could not find element 'WB' in any group. Could not find element 'EE' in any group. Could not find element 'KROE' in any group. Could not find element 'DR' in any group. Could not find element 'DT' in any group. Could not find element 'DN' in any group. Could not find element 'URTY' in any group. Could not find element 'PE' in any group. Could not find element 'UR' in any group. Could not find element 'AP' in any group. Could not find element 'IE' in any group. Could not find element 'VE' in any group. Could not find element 'RU' in any group. Could not find element 'TO' in any group. Could not find element 'DO' in any group. Could not find element 'LA' in any group. Could not find element 'HT' in any group. Could not find element 'HO' in any group. Could not find element 'MT' in any group. Could not find element 'GU' in any group. Could not find element 'VA' in any group. Could not find element 'AK' in any group. Active grids: ['sections'] .. GENERATED FROM PYTHON SOURCE LINES 34-38 **Step 4: Configure Interpolation Options** Setting the cache mode to `CACHE` to optimize interpolation calculations during model computation. This improves performance especially for complex models. .. GENERATED FROM PYTHON SOURCE LINES 38-41 .. code-block:: default geo_model.interpolation_options.cache_mode = gp.data.InterpolationOptions.CacheMode.CACHE .. GENERATED FROM PYTHON SOURCE LINES 42-46 **Step 5: Compute the Geological Model** Computing the geological model using NumPy backend. We also enable GPU acceleration to further enhance the computation speed. The data type used is `float64` for high precision. .. GENERATED FROM PYTHON SOURCE LINES 46-56 .. code-block:: default gp.compute_model( gempy_model=geo_model, engine_config=gp.data.GemPyEngineConfig( backend=gp.data.AvailableBackends.numpy, use_gpu=True, dtype='float64' ) ) .. rst-class:: sphx-glr-script-out .. code-block:: none Setting Backend To: AvailableBackends.numpy A size: (1907, 1907) CG iterations: 461 A size: (1692, 1692) CG iterations: 420 A size: (1365, 1365) CG iterations: 338 A size: (1269, 1269) CG iterations: 397 A size: (1087, 1087) CG iterations: 286 A size: (1040, 1040) CG iterations: 343 A size: (614, 614) CG iterations: 282 A size: (489, 489) CG iterations: 232 A size: (22, 22) CG iterations: 45 .. raw:: html
Solutions: 4 Octree Levels, 10 DualContouringMeshes


.. GENERATED FROM PYTHON SOURCE LINES 57-61 **Step 6: Visualize the Model in 3D** Creating a 3D visualization of the geological model using GemPy Viewer. We customize the view to show certain data elements and adjust aesthetics like opacity and labels visibility. .. GENERATED FROM PYTHON SOURCE LINES 61-78 .. code-block:: default ve = 100 # Vertical exaggeration for better depth perception gempy_plot3d = gpv.plot_3d( model=geo_model, show_data=True, show_lith=False, ve=ve, image=False, kwargs_pyvista_bounds={ 'show_xlabels': False, 'show_ylabels': False, 'show_zlabels': False, }, kwargs_plot_data={'arrow_size': 100}, kwargs_plot_structured_grid={'opacity': .8} ) .. image-sg:: /examples/south_model/images/sphx_glr_2_computing_south_001.png :alt: 2 computing south :srcset: /examples/south_model/images/sphx_glr_2_computing_south_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 79-84 **Step 7: Create 2D Cross-Sections** In addition to 3D visualization, we generate 2D cross-sections of the model. This includes multiple sections to provide detailed views at different angles. Vertical exaggeration and projection distances are configured to enhance the visual output. .. GENERATED FROM PYTHON SOURCE LINES 84-94 .. code-block:: default # sphinx_gallery_thumbnail_number = 2 gpv.plot_2d( model=geo_model, section_names=['section1', 'section2', 'section3'], show_data=True, show_boundaries=False, ve=ve, projection_distance=100 ) .. image-sg:: /examples/south_model/images/sphx_glr_2_computing_south_002.png :alt: section1, section2, section3 :srcset: /examples/south_model/images/sphx_glr_2_computing_south_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 1 minutes 23.108 seconds) .. _sphx_glr_download_examples_south_model_2_computing_south.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 2_computing_south.py <2_computing_south.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 2_computing_south.ipynb <2_computing_south.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_