Skip to content

Note

Click here to download the full example code

Overview of the MockModel for load case LC1

A toy model implementing an unphysical analytical law; used for testing purpose

from __future__ import annotations

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

Out:

2026-09-03 23:52:16.704 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
2026-09-03 23:52:16.708 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
C:\Users\sebastien.bocquet\Dev\vimseo\.tox\doc\Lib\site-packages\pydantic\_internal\_config.py:291: PydanticDeprecatedSince20: Support for class-based `config` is deprecated, use ConfigDict instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.9/migration/
  warnings.warn(DEPRECATION_MESSAGE, DeprecationWarning)
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
C:\Users\sebastien.bocquet\Dev\vimseo\.tox\doc\Lib\site-packages\pydantic\_internal\_utils.py:312: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
  if not obj and obj_type in BUILTIN_COLLECTIONS:

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

model_name = "MockModel"
load_case = "LC1"
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",
    ),
)

Out:

2026-09-03 23:52:23.878 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
2026-09-03 23:52:23.878 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
    INFO - 23:52:25: Found 1 entries in the cache file : C:\Users\sebastien.bocquet\Dev\vimseo\docs\runnable_examples\model_runs\caches\model_gallery\MockModel_LC1_cache.hdf node : node

The model description can be accessed like this:

print(model.description)

Out:

Model MockModel:  A toy model implementing an unphysical analytical law; used for testing purpose

Load case:
   Load case LC1: A first mock load case.

   Boundary condition variables:
   []

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

Default values:

   Default geometrical variables:
   {"x1": [0.1], "x1_maximum_only": [0.1], "x1_minimum_only": [0.1], "x1_no_bounds": [0.1]}

   Default numerical variables:
   {}

   Default boundary conditions variables:
   {}

   Default material variables:
   {}
model_inputs:
   [
    "x1",
    "x1_maximum_only",
    "x1_minimum_only",
    "x1_no_bounds"
]
model_outputs:
   [
    "y1",
    "model",
    "load_case",
    "error_code",
    "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:

{'x1': array([0.1]), 'x1_maximum_only': array([0.1]), 'x1_minimum_only': array([0.1]), 'x1_no_bounds': array([0.1]), 'cpu_time': array([0.01058388]), 'date': array(['2025-11-05 22:19:44.328216'], dtype='<U26'), 'description': array([''], dtype='<U1'), 'directory_archive_job': array(['..\\model_runs\\archive\\model_gallery\\MockModel\\LC1\\1'],
      dtype='<U51'), 'directory_archive_root': array(['C:\\Users\\sebastien.bocquet\\PycharmProjects\\vims\\docs\\runnable_examples\\model_runs\\archive\\model_gallery'],
      dtype='<U103'), 'directory_scratch_job': array([''], dtype='<U1'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\PycharmProjects\\vims\\docs\\runnable_examples\\model_runs\\scratch\\model_gallery'],
      dtype='<U103'), 'error_code': array([0]), 'job_name': array([''], dtype='<U1'), 'load_case': array(['LC1'], dtype='<U3'), 'machine': array(['B20191729'], dtype='<U9'), 'model': array(['MockModel'], dtype='<U9'), 'n_cpus': array([1]), 'persistent_result_files': array([''], dtype='<U1'), 'user': array(['sebastien.bocquet'], dtype='<U17'), 'vims_git_version': array(['95990fa211debd91a91ffe1d89b2b0b4b855f387'], dtype='<U40'), 'y1': array([5.2])}

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

figures = model.plot_results(show=True)

Out:

    INFO - 23:52:25: Saving plots to C:\Users\sebastien.bocquet\Dev\vimseo\docs\runnable_examples\01_models

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

Download Python source code: plot_MockModel_LC1.py

Download Jupyter notebook: plot_MockModel_LC1.ipynb

Gallery generated by mkdocs-gallery