Skip to content

Note

Click here to download the full example code

Overview of the MockCurves for load case Dummy

from __future__ import annotations

from vimseo import EXAMPLE_RUNS_DIR
from vimseo.api import create_model
from vimseo.core.model_settings import IntegratedModelSettings

First, let's instantiate the model for a given load case:

model_name = "MockCurves"
load_case = "Dummy"
model = create_model(
    model_name,
    load_case,
    check_subprocess=True,
    model_options=IntegratedModelSettings(
        directory_archive_root=EXAMPLE_RUNS_DIR / "archive/model_gallery",
        directory_scratch_root=EXAMPLE_RUNS_DIR / "scratch/model_gallery",
        cache_file_path=EXAMPLE_RUNS_DIR
        / f"caches/model_gallery/{model_name}_{load_case}_cache.hdf",
    ),
)

The model description can be accessed like this:

print(model.description)

Out:

Model MockCurves: 

Load case:
   Load case Dummy: A dummy load case.

   Boundary condition variables:
   []

   Plot parameters:
   {
    "curves": []
}
   Load:
   Load(direction='', sign='', type='')

Default values:

   Default geometrical variables:
   {"x": [1.0], "x_1": [1.0]}

   Default numerical variables:
   {}

   Default boundary conditions variables:
   {}

   Default material variables:
   {}
model_inputs:
   [
    "x",
    "x_1"
]
model_outputs:
   [
    "y",
    "y_axis",
    "error_code",
    "model",
    "load_case",
    "description",
    "job_name",
    "persistent_result_files",
    "n_cpus",
    "date",
    "cpu_time",
    "user",
    "machine",
    "vims_git_version",
    "directory_archive_root",
    "directory_archive_job",
    "directory_scratch_root",
    "directory_scratch_job"
]

An illustration of the load case:

model.show_image()

The model is executed with its default input values:

model.execute()

Out:

{'x': array([1.]), 'x_1': array([1.]), 'cpu_time': array([0.00390196]), 'date': array(['2026-03-26 14:54:08.128997'], dtype='<U26'), 'description': array([''], dtype='<U1'), 'directory_archive_job': array(['/home/sebastien.bocquet/PycharmProjects/vimseo/docs/runnable_examples/model_runs/archive/model_gallery/MockCurves/Dummy/2'],
      dtype='<U121'), 'directory_archive_root': array(['/home/sebastien.bocquet/PycharmProjects/vimseo/docs/runnable_examples/model_runs/archive/model_gallery'],
      dtype='<U102'), 'directory_scratch_job': array([''], dtype='<U1'), 'directory_scratch_root': array(['/home/sebastien.bocquet/PycharmProjects/vimseo/docs/runnable_examples/model_runs/scratch/model_gallery'],
      dtype='<U102'), 'error_code': array([0]), 'job_name': array([''], dtype='<U1'), 'load_case': array(['Dummy'], dtype='<U5'), 'machine': array(['IPF7101'], dtype='<U7'), 'model': array(['MockCurves'], dtype='<U10'), 'n_cpus': array([1]), 'persistent_result_files': array([''], dtype='<U1'), 'user': array(['sebastien.bocquet'], dtype='<U17'), 'vims_git_version': array(['d0050d8de498c8354552cdde540fb3e524454871'], dtype='<U40'), 'y': array([1.        , 1.01010101, 1.02020202, 1.03030303, 1.04040404,
       1.05050505, 1.06060606, 1.07070707, 1.08080808, 1.09090909,
       1.1010101 , 1.11111111, 1.12121212, 1.13131313, 1.14141414,
       1.15151515, 1.16161616, 1.17171717, 1.18181818, 1.19191919,
       1.2020202 , 1.21212121, 1.22222222, 1.23232323, 1.24242424,
       1.25252525, 1.26262626, 1.27272727, 1.28282828, 1.29292929,
       1.3030303 , 1.31313131, 1.32323232, 1.33333333, 1.34343434,
       1.35353535, 1.36363636, 1.37373737, 1.38383838, 1.39393939,
       1.4040404 , 1.41414141, 1.42424242, 1.43434343, 1.44444444,
       1.45454545, 1.46464646, 1.47474747, 1.48484848, 1.49494949,
       1.50505051, 1.51515152, 1.52525253, 1.53535354, 1.54545455,
       1.55555556, 1.56565657, 1.57575758, 1.58585859, 1.5959596 ,
       1.60606061, 1.61616162, 1.62626263, 1.63636364, 1.64646465,
       1.65656566, 1.66666667, 1.67676768, 1.68686869, 1.6969697 ,
       1.70707071, 1.71717172, 1.72727273, 1.73737374, 1.74747475,
       1.75757576, 1.76767677, 1.77777778, 1.78787879, 1.7979798 ,
       1.80808081, 1.81818182, 1.82828283, 1.83838384, 1.84848485,
       1.85858586, 1.86868687, 1.87878788, 1.88888889, 1.8989899 ,
       1.90909091, 1.91919192, 1.92929293, 1.93939394, 1.94949495,
       1.95959596, 1.96969697, 1.97979798, 1.98989899, 2.        ]), 'y_axis': array([0.        , 0.01010101, 0.02020202, 0.03030303, 0.04040404,
       0.05050505, 0.06060606, 0.07070707, 0.08080808, 0.09090909,
       0.1010101 , 0.11111111, 0.12121212, 0.13131313, 0.14141414,
       0.15151515, 0.16161616, 0.17171717, 0.18181818, 0.19191919,
       0.2020202 , 0.21212121, 0.22222222, 0.23232323, 0.24242424,
       0.25252525, 0.26262626, 0.27272727, 0.28282828, 0.29292929,
       0.3030303 , 0.31313131, 0.32323232, 0.33333333, 0.34343434,
       0.35353535, 0.36363636, 0.37373737, 0.38383838, 0.39393939,
       0.4040404 , 0.41414141, 0.42424242, 0.43434343, 0.44444444,
       0.45454545, 0.46464646, 0.47474747, 0.48484848, 0.49494949,
       0.50505051, 0.51515152, 0.52525253, 0.53535354, 0.54545455,
       0.55555556, 0.56565657, 0.57575758, 0.58585859, 0.5959596 ,
       0.60606061, 0.61616162, 0.62626263, 0.63636364, 0.64646465,
       0.65656566, 0.66666667, 0.67676768, 0.68686869, 0.6969697 ,
       0.70707071, 0.71717172, 0.72727273, 0.73737374, 0.74747475,
       0.75757576, 0.76767677, 0.77777778, 0.78787879, 0.7979798 ,
       0.80808081, 0.81818182, 0.82828283, 0.83838384, 0.84848485,
       0.85858586, 0.86868687, 0.87878788, 0.88888889, 0.8989899 ,
       0.90909091, 0.91919192, 0.92929293, 0.93939394, 0.94949495,
       0.95959596, 0.96969697, 0.97979798, 0.98989899, 1.        ])}

And the results are visualised with the pre-defined plots:

figures = model.plot_results(show=True)

Plot of y_vs_y_axis

figures["y_vs_y_axis"]

Total running time of the script: ( 0 minutes 6.750 seconds)

Download Python source code: plot_MockCurves_Dummy.py

Download Jupyter notebook: plot_MockCurves_Dummy.ipynb

Gallery generated by mkdocs-gallery