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-10-28 09:43:45.491 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
2026-10-28 09:43:45.491 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
C:\Users\sebastien.bocquet\Dev\vd017\.tox\doc\Lib\site-packages\pydantic\_internal\_config.py:323: 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.11/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
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyPacked has no __module__ attribute
<frozen importlib._bootstrap>:488: DeprecationWarning: builtin type SwigPyObject has no __module__ attribute
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-10-28 09:43:50.378 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
2026-10-28 09:43:50.378 WARNING streamlit.runtime.caching.cache_data_api: No runtime found, using MemoryCacheStorageManager
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.
Default values:
Default geometrical variables:
x1 = [0.1]
x1_maximum_only = [0.1]
x1_minimum_only = [0.1]
x1_no_bounds = [0.1]
Model inputs: x1, x1_maximum_only, x1_minimum_only, x1_no_bounds
Model outputs: cpu_time, date, description, directory_archive_job, directory_archive_root, directory_scratch_job, directory_scratch_root, error_code, job_name, load_case, machine, model, n_cpus, persistent_result_files, user, vims_git_version, y1
An illustration of the load case:
model.show_image()
The model is executed with its default input values:
model.execute()
Out:
INFO - 09:43:51: Current archive directory is C:\Users\sebastien.bocquet\Dev\vd017\docs\runnable_examples\model_runs\archive\model_gallery\MockModel\LC1\2.
{'x1': array([0.1]), 'x1_maximum_only': array([0.1]), 'x1_minimum_only': array([0.1]), 'x1_no_bounds': array([0.1]), 'y1': array([5.2]), 'model': array(['MockModel'], dtype='<U9'), 'load_case': array(['LC1'], dtype='<U3'), 'error_code': array([-1]), 'description': array([''], dtype='<U1'), 'job_name': array([''], dtype='<U1'), 'persistent_result_files': array([''], dtype='<U1'), 'n_cpus': array([0]), 'date': array(['2026-10-28 09:43:51.205315'], dtype='<U26'), 'cpu_time': array([0.00855827]), 'user': array(['sebastien.bocquet'], dtype='<U17'), 'machine': array(['PCBM20250036'], dtype='<U12'), 'vims_git_version': array(['5ba602a7e3571a2fc5a0a3604673c7e5410711b0'], dtype='<U40'), 'directory_archive_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\archive\\model_gallery'],
dtype='<U92'), 'directory_archive_job': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\archive\\model_gallery\\MockModel\\LC1\\2'],
dtype='<U108'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\model_gallery'],
dtype='<U92'), 'directory_scratch_job': array([''], dtype='<U1')}
And the results are visualised with the pre-defined plots:
figures = model.plot_results(show=True)
Out:
INFO - 09:43:51: Saving plots to C:\Users\sebastien.bocquet\Dev\vd017\docs\runnable_examples\model_runs\archive\model_gallery\MockModel\LC1\2
Total running time of the script: ( 0 minutes 11.241 seconds)
Download Python source code: plot_MockModel_LC1.py