Note
Click here to download the full example code
Manage model results¶
Manage model results using several result managers.
from __future__ import annotations
import logging
import mlflow
from gemseo.datasets.dataset import Dataset
from gemseo.post.dataset.bars import BarPlot
from mlflow import delete_run
from numpy import atleast_1d
from pandas import DataFrame
from pandas import concat
from vimseo import EXAMPLE_RUNS_DIR
from vimseo.api import activate_logger
from vimseo.api import create_model
from vimseo.core.model_result import ModelResult
from vimseo.core.model_settings import IntegratedModelSettings
from vimseo.storage_management.base_storage_manager import PersistencyPolicy
from vimseo.utilities.plotting_utils import superpose_curves
activate_logger(level=logging.INFO)
Properly storing model results when running hundreds of simulations with possibly several users and several studies at the same time is a key aspect, especially if model credibility demonstration is targeted. Our strategy is to separate the following concepts: - scratch results: these are specific to models relying on external solvers. A scratch directory contains the data read or written by the solver. - archive results: these are the data we want to keep after the simulation. They comprise the input and output data, metadata and files generated in the scratch directory that we want to conserve. - a cache: while a cache could be seen as a way of archiving results, we prefer to separate cache and archiving. However, a bridge is available between both: a cache can be generated from an archive or part of an archive.
An archive manager can be chosen among DirectoryArchive or MlflowArchive.
In the first case, an arborescence of directories is generated under a directory default_archive
created in the current working directory.
In the second case, an MLflow database is created.
By default the database is file-based and is created under a directory mlflow_archive
in the current working directory.
The root directory of the archive can be specified with argument directory_archive_root
passed to the constructor of the model or to create_model().
The scratch results are stored in an arborescence of directories similarly to a DirectoryArchive.
The persistency policy of the scratch and the archive can be specified independently.
For a DirectoryArchive, the path of a result is built from two independent segments:
.. code-block:: text
{directory_archive_root} / {experiment name} / {job name or auto-numbered}
The experiment name is the intermediate segment, which groups the runs. It
defaults to {model_name}/{load_case_name} and is changed with
archive_manager.set_experiment(). It is also the key used to query the archive
back, through the experiment_names argument.
The job name replaces the leaf segment. Without it, a new numbered directory is created at each execution, so that no run ever overwrites another one. With it, the leaf is fixed, hence a second execution targets the very same directory:
.. list-table:: :header-rows: 1 :widths: 40 30 30
-
- settings
- first execution
- second execution
-
- default
MockModelPersistent/LC1/1MockModelPersistent/LC1/2
-
set_experiment("my_experiment")my_experiment/1my_experiment/2
-
job_name="my_job"MockModelPersistent/LC1/my_jobFileExistsError
-
job_name="my_job"and overwrite acceptedMockModelPersistent/LC1/my_jobMockModelPersistent/LC1/my_job
-
- both
my_experiment/my_job- same as the two rows above
The last column explains why _accept_overwrite_job_dir only matters together with
job_name: it feeds the exist_ok argument of the directory creation, and a fixed
leaf is the only case where that directory can already exist. It defaults to False
for an archive, which is meant to be preserved, and to True for a scratch, which is
disposable.
Here, a model is created with the default DirectoryArchive manager, and a specific job directory is used to
store the archive result. Since the example is meant to be run repeatedly, the
_accept_overwrite_job_dir attribute is explicitly set to True.
The MockModelPersistent model has the specificity of requiring to store some generated files to the archive.
The archive manager automatically handles the copy of these files from the scratch to the archive.
Here, the scratch directories are kept such that the user can look into them:
model_name = "MockModelPersistent"
load_case = "LC1"
model = create_model(
model_name,
load_case,
IntegratedModelSettings(
directory_scratch_persistency=PersistencyPolicy.DELETE_NEVER,
directory_archive_root=EXAMPLE_RUNS_DIR / "archive/visualize_model_result",
directory_scratch_root=EXAMPLE_RUNS_DIR / "scratch/visualize_model_result",
cache_file_path=EXAMPLE_RUNS_DIR
/ f"caches/visualize_model_result/{model_name}_{load_case}_cache.hdf",
job_name="my_experiment",
),
)
model.archive_manager._accept_overwrite_job_dir = True
model.cache = None
An execution is then performed. A JSON file is written in the archive job directory.
It contains the input data, output data and metadata.
Two files identified at model-level as being persistent have also been copied from the scratch to the archive.
model.execute({"x1": atleast_1d(2.0), "x2": atleast_1d(-2.0)})
Out:
INFO - 09:43:59: Current scratch directory is C:\Users\sebastien.bocquet\Dev\vd017\docs\runnable_examples\model_runs\scratch\visualize_model_result\MockModelPersistent\LC1\my_experiment.
INFO - 09:43:59: Current archive directory is C:\Users\sebastien.bocquet\Dev\vd017\docs\runnable_examples\model_runs\archive\visualize_model_result\MockModelPersistent\LC1\my_experiment.
{'x1': array([2.]), 'x2': array([-2.]), 'x3': array([1., 2., 3.]), 'y1': np.float64(0.0), 'y2': array([1, 2, 3, 4, 5]), 'y3': array(['mock_string'], dtype='<U11'), 'y4': array([6.]), 'y5': array([ 6., 36., 216.]), 'error_code': array([0]), 'model': array(['MockModelPersistent'], dtype='<U19'), 'load_case': array(['LC1'], dtype='<U3'), 'description': array([''], dtype='<U1'), 'job_name': array(['my_experiment'], dtype='<U13'), 'persistent_result_files': array(['green_ellipse.png', 'blue_line.png'], dtype='<U17'), 'n_cpus': array([1]), 'date': array(['2026-10-28 09:43:59.566639'], dtype='<U26'), 'cpu_time': array([0.00880718]), '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\\visualize_model_result'],
dtype='<U101'), 'directory_archive_job': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\archive\\visualize_model_result\\MockModelPersistent\\LC1\\my_experiment'],
dtype='<U139'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result'],
dtype='<U101'), 'directory_scratch_job': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result\\MockModelPersistent\\LC1\\my_experiment'],
dtype='<U139')}
It often occurs that a cache becomes unusable due to:
- a change of VIMSEO version, altering the input, output or metadata of a model,
- a mix of successful and failed simulations (by fail, we mean that models may be fault tolerant and
outputs NaNs in the output data in case of errors). In general, we want to filter out failed runs.
- a large number of results, and for part of them, we have no traceability about and we do not trust the
results.
Then, a useful feature is to generate a cache file from an archive.
create_cache_from_archive() generates a cache file with same name as the current cache suffixed by '_from_archive'.
For a DirectoryArchive, the whole archive is considered (no filtering possible):
cache_from_archive = model.create_cache_from_archive()
print(cache_from_archive)
Out:
Name: node
Type: HDF5Cache
Tolerance: 1e-10
Input names: ['x1', 'x2', 'x3']
Output names: ['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', 'y2', 'y3', 'y4', 'y5']
Length: 1
HDF file path: C:\Users\sebastien.bocquet\Dev\vd017\docs\runnable_examples\model_runs\caches\visualize_model_result\MockModelPersistent_LC1_from_archive.hdf
HDF node path: node
An archive storage based on MLflow is also available.
MLflow stores the runs by so-called 'Experiments'.
The default experiment name is {model_name}_{load_case}.
Again, we create a model instance:
model_name = "BendingTestAnalytical"
load_case = "Cantilever"
model = create_model(
model_name,
load_case,
model_options=IntegratedModelSettings(
directory_archive_root=EXAMPLE_RUNS_DIR
/ "mlflow_archive/visualize_model_result",
directory_scratch_root=EXAMPLE_RUNS_DIR / "scratch/visualize_model_result",
cache_file_path=EXAMPLE_RUNS_DIR
/ f"caches/visualize_model_result/{model_name}_{load_case}_cache.hdf",
archive_manager="MlflowArchive",
),
)
model.cache = None
Out:
2026/10/28 09:43:59 INFO mlflow.tracking.fluent: Experiment with name 'BendingTestAnalytical_Cantilever' does not exist. Creating a new experiment.
C:\Users\sebastien.bocquet\Dev\vd017\.tox\doc\Lib\site-packages\genson\schema\strategies\base.py:42: UserWarning:
Schema incompatible. Keyword 'description' has conflicting values ('Value of the reaction forces at the imposed displacement location' vs. ''). Using 'Value of the reaction forces at the imposed displacement location'
All runs for the default and specific (specified below as my_experiment) experiment name
are first deleted:
runs = mlflow.search_runs(
experiment_names=["BendingTestAnalytical_Cantilever", "my_experiment"]
)
for id in runs["run_id"]:
delete_run(id)
# A first execution is done. Its result is stored under the default experiment name,
# which is ``{model_name}_{load_case}``:
model.execute({"height": atleast_1d(40.0)})
Out:
2026/10/28 09:43:59 WARNING mlflow.tracking.fluent: Cannot retrieve experiment by name my_experiment
INFO - 09:43:59: Current archive directory is .
{'length': array([600.]), 'width': array([30.]), 'height': array([40.]), 'imposed_dplt': array([-5.]), 'relative_dplt_location': array([1.]), 'young_modulus': array([210000.]), 'nu_p': array([0.3]), 'reaction_forces': array([-2333.33333333]), 'moment': array([1400000., 0.]), 'moment_grid': array([ 0., 600.]), 'dplt': array([ 0.00000000e+00, -7.62651513e-04, -3.04029995e-03, -6.81748616e-03,
-1.20787510e-02, -1.88086353e-02, -2.69916799e-02, -3.66124257e-02,
-4.76554134e-02, -6.01051841e-02, -7.39462784e-02, -8.91632373e-02,
-1.05740602e-01, -1.23662912e-01, -1.42914710e-01, -1.63480535e-01,
-1.85344930e-01, -2.08492434e-01, -2.32907588e-01, -2.58574934e-01,
-2.85479012e-01, -3.13604363e-01, -3.42935528e-01, -3.73457048e-01,
-4.05153463e-01, -4.38009315e-01, -4.72009144e-01, -5.07137491e-01,
-5.43378897e-01, -5.80717902e-01, -6.19139049e-01, -6.58626877e-01,
-6.99165927e-01, -7.40740741e-01, -7.83335858e-01, -8.26935821e-01,
-8.71525169e-01, -9.17088444e-01, -9.63610186e-01, -1.01107494e+00,
-1.05946724e+00, -1.10877163e+00, -1.15897265e+00, -1.21005484e+00,
-1.26200274e+00, -1.31480090e+00, -1.36843385e+00, -1.42288614e+00,
-1.47814230e+00, -1.53418688e+00, -1.59100442e+00, -1.64857946e+00,
-1.70689653e+00, -1.76594019e+00, -1.82569497e+00, -1.88614540e+00,
-1.94727605e+00, -2.00907143e+00, -2.07151610e+00, -2.13459459e+00,
-2.19829145e+00, -2.26259122e+00, -2.32747844e+00, -2.39293764e+00,
-2.45895337e+00, -2.52551018e+00, -2.59259259e+00, -2.66018516e+00,
-2.72827242e+00, -2.79683891e+00, -2.86586918e+00, -2.93534776e+00,
-3.00525920e+00, -3.07558804e+00, -3.14631882e+00, -3.21743607e+00,
-3.28892434e+00, -3.36076818e+00, -3.43295211e+00, -3.50546069e+00,
-3.57827845e+00, -3.65138993e+00, -3.72477968e+00, -3.79843224e+00,
-3.87233214e+00, -3.94646393e+00, -4.02081214e+00, -4.09536133e+00,
-4.17009602e+00, -4.24500077e+00, -4.32006011e+00, -4.39525857e+00,
-4.47058072e+00, -4.54601107e+00, -4.62153419e+00, -4.69713459e+00,
-4.77279684e+00, -4.84850546e+00, -4.92424500e+00, -5.00000000e+00]), 'dplt_grid': array([ 0. , 6.06060606, 12.12121212, 18.18181818,
24.24242424, 30.3030303 , 36.36363636, 42.42424242,
48.48484848, 54.54545455, 60.60606061, 66.66666667,
72.72727273, 78.78787879, 84.84848485, 90.90909091,
96.96969697, 103.03030303, 109.09090909, 115.15151515,
121.21212121, 127.27272727, 133.33333333, 139.39393939,
145.45454545, 151.51515152, 157.57575758, 163.63636364,
169.6969697 , 175.75757576, 181.81818182, 187.87878788,
193.93939394, 200. , 206.06060606, 212.12121212,
218.18181818, 224.24242424, 230.3030303 , 236.36363636,
242.42424242, 248.48484848, 254.54545455, 260.60606061,
266.66666667, 272.72727273, 278.78787879, 284.84848485,
290.90909091, 296.96969697, 303.03030303, 309.09090909,
315.15151515, 321.21212121, 327.27272727, 333.33333333,
339.39393939, 345.45454545, 351.51515152, 357.57575758,
363.63636364, 369.6969697 , 375.75757576, 381.81818182,
387.87878788, 393.93939394, 400. , 406.06060606,
412.12121212, 418.18181818, 424.24242424, 430.3030303 ,
436.36363636, 442.42424242, 448.48484848, 454.54545455,
460.60606061, 466.66666667, 472.72727273, 478.78787879,
484.84848485, 490.90909091, 496.96969697, 503.03030303,
509.09090909, 515.15151515, 521.21212121, 527.27272727,
533.33333333, 539.39393939, 545.45454545, 551.51515152,
557.57575758, 563.63636364, 569.6969697 , 575.75757576,
581.81818182, 587.87878788, 593.93939394, 600. ]), 'dplt_at_force_location': array([-5.]), 'maximum_dplt': array([-5.]), 'location_max_dplt': array([600.]), 'model': array(['BendingTestAnalytical'], dtype='<U21'), 'load_case': array(['Cantilever'], dtype='<U10'), '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:59.718439'], dtype='<U26'), 'cpu_time': array([0.03173804]), '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\\mlflow_archive\\visualize_model_result'],
dtype='<U108'), 'directory_archive_job': array([''], dtype='<U1'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result'],
dtype='<U101'), 'directory_scratch_job': array([''], dtype='<U1')}
Then, another experiment is defined. It can be useful to group runs for a given study. The model is then executed for two different beam height:
model.archive_manager.set_experiment("my_experiment")
model.execute({"height": atleast_1d(50.0)})
model.execute({"height": atleast_1d(60.0)})
Out:
2026/10/28 09:44:00 INFO mlflow.tracking.fluent: Experiment with name 'my_experiment' does not exist. Creating a new experiment.
INFO - 09:44:00: Current archive directory is .
INFO - 09:44:01: Current archive directory is .
{'length': array([600.]), 'width': array([30.]), 'height': array([60.]), 'imposed_dplt': array([-5.]), 'relative_dplt_location': array([1.]), 'young_modulus': array([210000.]), 'nu_p': array([0.3]), 'reaction_forces': array([-7875.]), 'moment': array([4725000., 0.]), 'moment_grid': array([ 0., 600.]), 'dplt': array([ 0.00000000e+00, -7.62651513e-04, -3.04029995e-03, -6.81748616e-03,
-1.20787510e-02, -1.88086353e-02, -2.69916799e-02, -3.66124257e-02,
-4.76554134e-02, -6.01051841e-02, -7.39462784e-02, -8.91632373e-02,
-1.05740602e-01, -1.23662912e-01, -1.42914710e-01, -1.63480535e-01,
-1.85344930e-01, -2.08492434e-01, -2.32907588e-01, -2.58574934e-01,
-2.85479012e-01, -3.13604363e-01, -3.42935528e-01, -3.73457048e-01,
-4.05153463e-01, -4.38009315e-01, -4.72009144e-01, -5.07137491e-01,
-5.43378897e-01, -5.80717902e-01, -6.19139049e-01, -6.58626877e-01,
-6.99165927e-01, -7.40740741e-01, -7.83335858e-01, -8.26935821e-01,
-8.71525169e-01, -9.17088444e-01, -9.63610186e-01, -1.01107494e+00,
-1.05946724e+00, -1.10877163e+00, -1.15897265e+00, -1.21005484e+00,
-1.26200274e+00, -1.31480090e+00, -1.36843385e+00, -1.42288614e+00,
-1.47814230e+00, -1.53418688e+00, -1.59100442e+00, -1.64857946e+00,
-1.70689653e+00, -1.76594019e+00, -1.82569497e+00, -1.88614540e+00,
-1.94727605e+00, -2.00907143e+00, -2.07151610e+00, -2.13459459e+00,
-2.19829145e+00, -2.26259122e+00, -2.32747844e+00, -2.39293764e+00,
-2.45895337e+00, -2.52551018e+00, -2.59259259e+00, -2.66018516e+00,
-2.72827242e+00, -2.79683891e+00, -2.86586918e+00, -2.93534776e+00,
-3.00525920e+00, -3.07558804e+00, -3.14631882e+00, -3.21743607e+00,
-3.28892434e+00, -3.36076818e+00, -3.43295211e+00, -3.50546069e+00,
-3.57827845e+00, -3.65138993e+00, -3.72477968e+00, -3.79843224e+00,
-3.87233214e+00, -3.94646393e+00, -4.02081214e+00, -4.09536133e+00,
-4.17009602e+00, -4.24500077e+00, -4.32006011e+00, -4.39525857e+00,
-4.47058072e+00, -4.54601107e+00, -4.62153419e+00, -4.69713459e+00,
-4.77279684e+00, -4.84850546e+00, -4.92424500e+00, -5.00000000e+00]), 'dplt_grid': array([ 0. , 6.06060606, 12.12121212, 18.18181818,
24.24242424, 30.3030303 , 36.36363636, 42.42424242,
48.48484848, 54.54545455, 60.60606061, 66.66666667,
72.72727273, 78.78787879, 84.84848485, 90.90909091,
96.96969697, 103.03030303, 109.09090909, 115.15151515,
121.21212121, 127.27272727, 133.33333333, 139.39393939,
145.45454545, 151.51515152, 157.57575758, 163.63636364,
169.6969697 , 175.75757576, 181.81818182, 187.87878788,
193.93939394, 200. , 206.06060606, 212.12121212,
218.18181818, 224.24242424, 230.3030303 , 236.36363636,
242.42424242, 248.48484848, 254.54545455, 260.60606061,
266.66666667, 272.72727273, 278.78787879, 284.84848485,
290.90909091, 296.96969697, 303.03030303, 309.09090909,
315.15151515, 321.21212121, 327.27272727, 333.33333333,
339.39393939, 345.45454545, 351.51515152, 357.57575758,
363.63636364, 369.6969697 , 375.75757576, 381.81818182,
387.87878788, 393.93939394, 400. , 406.06060606,
412.12121212, 418.18181818, 424.24242424, 430.3030303 ,
436.36363636, 442.42424242, 448.48484848, 454.54545455,
460.60606061, 466.66666667, 472.72727273, 478.78787879,
484.84848485, 490.90909091, 496.96969697, 503.03030303,
509.09090909, 515.15151515, 521.21212121, 527.27272727,
533.33333333, 539.39393939, 545.45454545, 551.51515152,
557.57575758, 563.63636364, 569.6969697 , 575.75757576,
581.81818182, 587.87878788, 593.93939394, 600. ]), 'dplt_at_force_location': array([-5.]), 'maximum_dplt': array([-5.]), 'location_max_dplt': array([600.]), 'model': array(['BendingTestAnalytical'], dtype='<U21'), 'load_case': array(['Cantilever'], dtype='<U10'), '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:44:01.671912'], dtype='<U26'), 'cpu_time': array([0.00253916]), '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\\mlflow_archive\\visualize_model_result'],
dtype='<U108'), 'directory_archive_job': array([''], dtype='<U1'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result'],
dtype='<U101'), 'directory_scratch_job': array([''], dtype='<U1')}
The archive results can be visualized through the MLflow User Interface.
The uri of the MLflow database must be specified to the UI:
- For exemple, Under Windows:
mlflow ui --backend-store-uri file:\\\\\\C:\\Users\\sebastien.bocquet\\PycharmProjects\\vimseo\\tests\\storage_management\\my_experiment
- Or under Linux:
mlflow ui --backend-store-uri file:////home/sebastien.bocquet/PycharmProjects/vims_only/doc_src/_examples/02-integrated_models/mlflow_archive
The uri can be retrieved with model._storage_manager.uri.
The mapping from model raw results (input, output, metadata) and MLflow result tracking framework is done as follows:
- all numbers among the input and output data (including arrays of size one, from which the number is extracted),
are stored as MLflow metrics. Inputs are distinguished by prefixing their name by inputs.,
- all other type of data among the input and output data are considered as MLflow params. They are jsonified
and stored as strings,
- the metadata are stored as MLflow tags.
The UI segregates the runs by experiment, and provides a
searching functionality.
MLflow is compatible with several databases (remote PostgreSql, Amazon S3 etc...),
allowing the archive storage to scale (company level or project level).
Runs can also be searched programmatically, here by experiment and for a given input range.
runs = mlflow.search_runs(
experiment_names=["my_experiment"],
filter_string="metrics.inputs.height > 50.0",
)
assert len(runs) == 1
runs
Metadata could also be used in the query, for instance tags.user = "a_user".
Note that the result returned by get_result() has the following format:
{"inputs": input_data, "output": output_data}.
archive_result = model.archive_manager.get_result(runs["run_id"][0])
archive_result
Out:
{'inputs': {'height': array([60.]), 'imposed_dplt': array([-5.]), 'length': array([600.]), 'nu_p': array([0.3]), 'relative_dplt_location': array([1.]), 'width': array([30.]), 'young_modulus': array([210000.])}, 'outputs': {'cpu_time': array([0.00253916]), 'dplt': array([ 0.00000000e+00, -7.62651513e-04, -3.04029995e-03, -6.81748616e-03,
-1.20787510e-02, -1.88086353e-02, -2.69916799e-02, -3.66124257e-02,
-4.76554134e-02, -6.01051841e-02, -7.39462784e-02, -8.91632373e-02,
-1.05740602e-01, -1.23662912e-01, -1.42914710e-01, -1.63480535e-01,
-1.85344930e-01, -2.08492434e-01, -2.32907588e-01, -2.58574934e-01,
-2.85479012e-01, -3.13604363e-01, -3.42935528e-01, -3.73457048e-01,
-4.05153463e-01, -4.38009315e-01, -4.72009144e-01, -5.07137491e-01,
-5.43378897e-01, -5.80717902e-01, -6.19139049e-01, -6.58626877e-01,
-6.99165927e-01, -7.40740741e-01, -7.83335858e-01, -8.26935821e-01,
-8.71525169e-01, -9.17088444e-01, -9.63610186e-01, -1.01107494e+00,
-1.05946724e+00, -1.10877163e+00, -1.15897265e+00, -1.21005484e+00,
-1.26200274e+00, -1.31480090e+00, -1.36843385e+00, -1.42288614e+00,
-1.47814230e+00, -1.53418688e+00, -1.59100442e+00, -1.64857946e+00,
-1.70689653e+00, -1.76594019e+00, -1.82569497e+00, -1.88614540e+00,
-1.94727605e+00, -2.00907143e+00, -2.07151610e+00, -2.13459459e+00,
-2.19829145e+00, -2.26259122e+00, -2.32747844e+00, -2.39293764e+00,
-2.45895337e+00, -2.52551018e+00, -2.59259259e+00, -2.66018516e+00,
-2.72827242e+00, -2.79683891e+00, -2.86586918e+00, -2.93534776e+00,
-3.00525920e+00, -3.07558804e+00, -3.14631882e+00, -3.21743607e+00,
-3.28892434e+00, -3.36076818e+00, -3.43295211e+00, -3.50546069e+00,
-3.57827845e+00, -3.65138993e+00, -3.72477968e+00, -3.79843224e+00,
-3.87233214e+00, -3.94646393e+00, -4.02081214e+00, -4.09536133e+00,
-4.17009602e+00, -4.24500077e+00, -4.32006011e+00, -4.39525857e+00,
-4.47058072e+00, -4.54601107e+00, -4.62153419e+00, -4.69713459e+00,
-4.77279684e+00, -4.84850546e+00, -4.92424500e+00, -5.00000000e+00]), 'dplt_at_force_location': array([-5.]), 'dplt_grid': array([ 0. , 6.06060606, 12.12121212, 18.18181818,
24.24242424, 30.3030303 , 36.36363636, 42.42424242,
48.48484848, 54.54545455, 60.60606061, 66.66666667,
72.72727273, 78.78787879, 84.84848485, 90.90909091,
96.96969697, 103.03030303, 109.09090909, 115.15151515,
121.21212121, 127.27272727, 133.33333333, 139.39393939,
145.45454545, 151.51515152, 157.57575758, 163.63636364,
169.6969697 , 175.75757576, 181.81818182, 187.87878788,
193.93939394, 200. , 206.06060606, 212.12121212,
218.18181818, 224.24242424, 230.3030303 , 236.36363636,
242.42424242, 248.48484848, 254.54545455, 260.60606061,
266.66666667, 272.72727273, 278.78787879, 284.84848485,
290.90909091, 296.96969697, 303.03030303, 309.09090909,
315.15151515, 321.21212121, 327.27272727, 333.33333333,
339.39393939, 345.45454545, 351.51515152, 357.57575758,
363.63636364, 369.6969697 , 375.75757576, 381.81818182,
387.87878788, 393.93939394, 400. , 406.06060606,
412.12121212, 418.18181818, 424.24242424, 430.3030303 ,
436.36363636, 442.42424242, 448.48484848, 454.54545455,
460.60606061, 466.66666667, 472.72727273, 478.78787879,
484.84848485, 490.90909091, 496.96969697, 503.03030303,
509.09090909, 515.15151515, 521.21212121, 527.27272727,
533.33333333, 539.39393939, 545.45454545, 551.51515152,
557.57575758, 563.63636364, 569.6969697 , 575.75757576,
581.81818182, 587.87878788, 593.93939394, 600. ]), 'location_max_dplt': array([600.]), 'maximum_dplt': array([-5.]), 'moment': array([4725000., 0.]), 'moment_grid': array([ 0., 600.]), 'reaction_forces': array([-7875.]), 'date': array(['2026-10-28 09:44:01.671912'], dtype='<U26'), 'description': array([''], dtype='<U1'), 'directory_archive_job': array(['\\C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\mlflow_archive\\visualize_model_result\\819577676784029977\\08e196a070094cecb2cf174c558f7a8f\\artifacts'],
dtype='<U171'), 'directory_archive_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\mlflow_archive\\visualize_model_result'],
dtype='<U108'), 'directory_scratch_job': array([''], dtype='<U1'), 'directory_scratch_root': array(['C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result'],
dtype='<U101'), 'error_code': array([-1]), 'job_name': array([''], dtype='<U1'), 'load_case': array(['Cantilever'], dtype='<U10'), 'machine': array(['PCBM20250036'], dtype='<U12'), 'model': array(['BendingTestAnalytical'], dtype='<U21'), 'n_cpus': array([0]), 'user': array(['sebastien.bocquet'], dtype='<U17'), 'vims_git_version': array(['5ba602a7e3571a2fc5a0a3604673c7e5410711b0'], dtype='<U40'), <MetaDataNames.persistent_result_files: 'persistent_result_files'>: array([''], dtype='<U1')}}
It can be converted to a user-friendly result format ModelResult that can be easily visualized and compared:
result = ModelResult.from_data(archive_result)
result
Out:
C:\Users\sebastien.bocquet\Dev\vd017\.tox\doc\Lib\site-packages\genson\schema\strategies\base.py:42: UserWarning:
Schema incompatible. Keyword 'description' has conflicting values ('Value of the reaction forces at the imposed displacement location' vs. ''). Using 'Value of the reaction forces at the imposed displacement location'
ModelResult(metadata=ToolResultMetadata(generic={'datetime': '28-10-2026_09-44-02', 'version': '0.1.8.dev0+g5ba602a7e.d20261028'}, misc={}, settings={}, report={<MetaDataNames.model: 'model'>: np.str_('BendingTestAnalytical'), <MetaDataNames.load_case: 'load_case'>: np.str_('Cantilever'), <MetaDataNames.error_code: 'error_code'>: np.int64(-1), <MetaDataNames.description: 'description'>: np.str_(''), <MetaDataNames.job_name: 'job_name'>: np.str_(''), <MetaDataNames.persistent_result_files: 'persistent_result_files'>: np.str_(''), <MetaDataNames.n_cpus: 'n_cpus'>: np.int64(0), <MetaDataNames.date: 'date'>: np.str_('2026-10-28 09:44:01.671912'), <MetaDataNames.cpu_time: 'cpu_time'>: np.float64(0.0025391578674316406), <MetaDataNames.user: 'user'>: np.str_('sebastien.bocquet'), <MetaDataNames.machine: 'machine'>: np.str_('PCBM20250036'), <MetaDataNames.vims_git_version: 'vims_git_version'>: np.str_('5ba602a7e3571a2fc5a0a3604673c7e5410711b0'), <MetaDataNames.directory_archive_root: 'directory_archive_root'>: np.str_('C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\mlflow_archive\\visualize_model_result'), <MetaDataNames.directory_archive_job: 'directory_archive_job'>: np.str_('\\C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\mlflow_archive\\visualize_model_result\\819577676784029977\\08e196a070094cecb2cf174c558f7a8f\\artifacts'), <MetaDataNames.directory_scratch_root: 'directory_scratch_root'>: np.str_('C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result'), <MetaDataNames.directory_scratch_job: 'directory_scratch_job'>: np.str_('')}, model=ModelDescription(name='BendingTestAnalytical', summary=' An analytical model for the bending of a parallelepipedic beam', load_case=Beam_Cantilever(name=np.str_('Cantilever'), domain='Beam', summary='A cantilever load case.', bc_variable_names=['imposed_dplt', 'relative_dplt_location'], load=Load(direction='', sign='', type='')), dataflow={'model_inputs': ['length', 'width', 'height', 'imposed_dplt', 'relative_dplt_location', 'young_modulus', 'nu_p'], 'model_outputs': ['reaction_forces', 'moment', 'moment_grid', 'dplt', 'dplt_grid', 'maximum_dplt', 'location_max_dplt', 'dplt_at_force_location', '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'], 'PreBendingTestAnalytical_Cantilever': {'inputs': ['length', 'width', 'height', 'imposed_dplt', 'relative_dplt_location', 'young_modulus', 'nu_p'], 'outputs': ['imposed_dplt_location', 'quadratic_moment', 'reaction_forces', 'moment', 'moment_grid', 'solver', 'boundary']}, 'RunBendingTestAnalytical': {'inputs': ['solver', 'boundary', 'moment', 'moment_grid', 'young_modulus', 'quadratic_moment', 'nu_p'], 'outputs': ['dplt', 'dplt_grid']}, 'PostBendingTestAnalytical_Cantilever': {'inputs': ['dplt', 'dplt_grid', 'moment', 'moment_grid', 'imposed_dplt_location', 'reaction_forces'], 'outputs': ['reaction_forces', 'maximum_dplt', 'dplt_grid', 'location_max_dplt', 'dplt', 'moment', 'moment_grid', 'dplt_at_force_location']}, 'subroutine_names': []}, default_inputs={<InputGroupNames.NUMERICAL_VARS: 'numerical variables'>: {}, <InputGroupNames.BC_VARS: 'boundary conditions variables'>: {'imposed_dplt': [-5.0], 'relative_dplt_location': [1.0]}, <InputGroupNames.GEOMETRICAL_VARS: 'geometrical variables'>: {'length': [600.0], 'width': [30.0], 'height': [40.0]}, <InputGroupNames.MATERIAL_VARS: 'material variables'>: {'young_modulus': [210000.0], 'nu_p': [0.3]}}, verbose=False)), scalars={'height': np.float64(60.0), 'imposed_dplt': np.float64(-5.0), 'length': np.float64(600.0), 'nu_p': np.float64(0.3), 'relative_dplt_location': np.float64(1.0), 'width': np.float64(30.0), 'young_modulus': np.float64(210000.0), 'dplt_at_force_location': np.float64(-4.999999999999994), 'location_max_dplt': np.float64(600.0), 'maximum_dplt': np.float64(-4.999999999999994), 'reaction_forces': np.float64(-7875.0)}, vectors={}, curves=[<vimseo.utilities.curves.Curve object at 0x000001506ADF0AA0>, <vimseo.utilities.curves.Curve object at 0x000001506ADF1CA0>], plots=[<vimseo.utilities.curves.CurveSet object at 0x000001506ADF34D0>, <vimseo.utilities.curves.CurveSet object at 0x000001506ADF3C20>], fields={}, snapshots=[])
We perform another query to retrieve the second run:
runs = mlflow.search_runs(
experiment_names=["my_experiment"],
filter_string="metrics.inputs.height <= 51.0 AND metrics.inputs.height >= 49.0",
)
assert len(runs) == 1
archive_result_1 = model.archive_manager.get_result(runs["run_id"][0])
result_1 = ModelResult.from_data(archive_result_1)
result_1
Out:
C:\Users\sebastien.bocquet\Dev\vd017\.tox\doc\Lib\site-packages\genson\schema\strategies\base.py:42: UserWarning:
Schema incompatible. Keyword 'description' has conflicting values ('Value of the reaction forces at the imposed displacement location' vs. ''). Using 'Value of the reaction forces at the imposed displacement location'
ModelResult(metadata=ToolResultMetadata(generic={'datetime': '28-10-2026_09-44-02', 'version': '0.1.8.dev0+g5ba602a7e.d20261028'}, misc={}, settings={}, report={<MetaDataNames.model: 'model'>: np.str_('BendingTestAnalytical'), <MetaDataNames.load_case: 'load_case'>: np.str_('Cantilever'), <MetaDataNames.error_code: 'error_code'>: np.int64(-1), <MetaDataNames.description: 'description'>: np.str_(''), <MetaDataNames.job_name: 'job_name'>: np.str_(''), <MetaDataNames.persistent_result_files: 'persistent_result_files'>: np.str_(''), <MetaDataNames.n_cpus: 'n_cpus'>: np.int64(0), <MetaDataNames.date: 'date'>: np.str_('2026-10-28 09:44:00.983385'), <MetaDataNames.cpu_time: 'cpu_time'>: np.float64(0.005079507827758789), <MetaDataNames.user: 'user'>: np.str_('sebastien.bocquet'), <MetaDataNames.machine: 'machine'>: np.str_('PCBM20250036'), <MetaDataNames.vims_git_version: 'vims_git_version'>: np.str_('5ba602a7e3571a2fc5a0a3604673c7e5410711b0'), <MetaDataNames.directory_archive_root: 'directory_archive_root'>: np.str_('C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\mlflow_archive\\visualize_model_result'), <MetaDataNames.directory_archive_job: 'directory_archive_job'>: np.str_('\\C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\mlflow_archive\\visualize_model_result\\819577676784029977\\7c3c09328ece406ca8b48e982e178657\\artifacts'), <MetaDataNames.directory_scratch_root: 'directory_scratch_root'>: np.str_('C:\\Users\\sebastien.bocquet\\Dev\\vd017\\docs\\runnable_examples\\model_runs\\scratch\\visualize_model_result'), <MetaDataNames.directory_scratch_job: 'directory_scratch_job'>: np.str_('')}, model=ModelDescription(name='BendingTestAnalytical', summary=' An analytical model for the bending of a parallelepipedic beam', load_case=Beam_Cantilever(name=np.str_('Cantilever'), domain='Beam', summary='A cantilever load case.', bc_variable_names=['imposed_dplt', 'relative_dplt_location'], load=Load(direction='', sign='', type='')), dataflow={'model_inputs': ['length', 'width', 'height', 'imposed_dplt', 'relative_dplt_location', 'young_modulus', 'nu_p'], 'model_outputs': ['reaction_forces', 'moment', 'moment_grid', 'dplt', 'dplt_grid', 'maximum_dplt', 'location_max_dplt', 'dplt_at_force_location', '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'], 'PreBendingTestAnalytical_Cantilever': {'inputs': ['length', 'width', 'height', 'imposed_dplt', 'relative_dplt_location', 'young_modulus', 'nu_p'], 'outputs': ['imposed_dplt_location', 'quadratic_moment', 'reaction_forces', 'moment', 'moment_grid', 'solver', 'boundary']}, 'RunBendingTestAnalytical': {'inputs': ['solver', 'boundary', 'moment', 'moment_grid', 'young_modulus', 'quadratic_moment', 'nu_p'], 'outputs': ['dplt', 'dplt_grid']}, 'PostBendingTestAnalytical_Cantilever': {'inputs': ['dplt', 'dplt_grid', 'moment', 'moment_grid', 'imposed_dplt_location', 'reaction_forces'], 'outputs': ['reaction_forces', 'maximum_dplt', 'dplt_grid', 'location_max_dplt', 'dplt', 'moment', 'moment_grid', 'dplt_at_force_location']}, 'subroutine_names': []}, default_inputs={<InputGroupNames.NUMERICAL_VARS: 'numerical variables'>: {}, <InputGroupNames.BC_VARS: 'boundary conditions variables'>: {'imposed_dplt': [-5.0], 'relative_dplt_location': [1.0]}, <InputGroupNames.GEOMETRICAL_VARS: 'geometrical variables'>: {'length': [600.0], 'width': [30.0], 'height': [40.0]}, <InputGroupNames.MATERIAL_VARS: 'material variables'>: {'young_modulus': [210000.0], 'nu_p': [0.3]}}, verbose=False)), scalars={'height': np.float64(50.0), 'imposed_dplt': np.float64(-5.0), 'length': np.float64(600.0), 'nu_p': np.float64(0.3), 'relative_dplt_location': np.float64(1.0), 'width': np.float64(30.0), 'young_modulus': np.float64(210000.0), 'dplt_at_force_location': np.float64(-4.999999999999995), 'location_max_dplt': np.float64(600.0), 'maximum_dplt': np.float64(-4.999999999999995), 'reaction_forces': np.float64(-4557.291666666667)}, vectors={}, curves=[<vimseo.utilities.curves.Curve object at 0x000001506AE0A570>, <vimseo.utilities.curves.Curve object at 0x000001506AE09AF0>], plots=[<vimseo.utilities.curves.CurveSet object at 0x000001506AE0BEC0>, <vimseo.utilities.curves.CurveSet object at 0x000001506AE0BF50>], fields={}, snapshots=[])
It is possible to create a cache file from the archive. By default, the runs of the current experiment are considered. Since experiment "my_experiment" has two runs, we expect the created cache to have two entries:
cache_from_archive = model.create_cache_from_archive()
print(cache_from_archive)
Out:
Name: node
Type: HDF5Cache
Tolerance: 1e-10
Input names: ['height', 'imposed_dplt', 'length', 'nu_p', 'relative_dplt_location', 'width', 'young_modulus']
Output names: ['cpu_time', 'date', 'description', 'directory_archive_job', 'directory_archive_root', 'directory_scratch_job', 'directory_scratch_root', 'dplt', 'dplt_at_force_location', 'dplt_grid', 'error_code', 'job_name', 'load_case', 'location_max_dplt', 'machine', 'maximum_dplt', 'model', 'moment', 'moment_grid', 'n_cpus', 'persistent_result_files', 'reaction_forces', 'user', 'vims_git_version']
Length: 2
HDF file path: C:\Users\sebastien.bocquet\Dev\vd017\docs\runnable_examples\model_runs\caches\visualize_model_result\BendingTestAnalytical_Cantilever_from_archive.hdf
HDF node path: node
The displacement curves of both results can be compared.They are identical for this displacement-imposed loading:
superpose_curves(
[
result.get_curve(("dplt_grid", "dplt")),
result_1.get_curve(("dplt_grid", "dplt")),
],
labels=["result", "result 1"],
save=False,
show=True,
)
Out:
{'text/html': '<div> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG"></script><script type="text/javascript">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}</script> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: \'local\'};</script>\n <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.35.0.min.js"></script> <div id="1a710067-54a4-4640-bacb-871832aa48bb" class="plotly-graph-div" style="height:525px; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("1a710067-54a4-4640-bacb-871832aa48bb")) { Plotly.newPlot( "1a710067-54a4-4640-bacb-871832aa48bb", [{"line":{"color":"blue","dash":"solid"},"marker":{"color":"blue"},"mode":"lines","name":"result - dplt","x":[0.0,6.0606060606060606,12.121212121212121,18.18181818181818,24.242424242424242,30.303030303030305,36.36363636363636,42.42424242424242,48.484848484848484,54.54545454545455,60.60606060606061,66.66666666666667,72.72727272727272,78.78787878787878,84.84848484848484,90.9090909090909,96.96969696969697,103.03030303030303,109.0909090909091,115.15151515151516,121.21212121212122,127.27272727272727,133.33333333333334,139.3939393939394,145.45454545454544,151.5151515151515,157.57575757575756,163.63636363636363,169.6969696969697,175.75757575757575,181.8181818181818,187.87878787878788,193.93939393939394,200.0,206.06060606060606,212.12121212121212,218.1818181818182,224.24242424242425,230.3030303030303,236.36363636363637,242.42424242424244,248.48484848484847,254.54545454545453,260.6060606060606,266.6666666666667,272.72727272727275,278.7878787878788,284.8484848484849,290.9090909090909,296.96969696969694,303.030303030303,309.09090909090907,315.1515151515151,321.2121212121212,327.27272727272725,333.3333333333333,339.3939393939394,345.45454545454544,351.5151515151515,357.57575757575756,363.6363636363636,369.6969696969697,375.75757575757575,381.8181818181818,387.8787878787879,393.93939393939394,400.0,406.06060606060606,412.1212121212121,418.1818181818182,424.24242424242425,430.3030303030303,436.3636363636364,442.42424242424244,448.4848484848485,454.54545454545456,460.6060606060606,466.6666666666667,472.72727272727275,478.7878787878788,484.8484848484849,490.9090909090909,496.96969696969694,503.030303030303,509.09090909090907,515.1515151515151,521.2121212121212,527.2727272727273,533.3333333333334,539.3939393939394,545.4545454545455,551.5151515151515,557.5757575757576,563.6363636363636,569.6969696969697,575.7575757575758,581.8181818181818,587.8787878787879,593.9393939393939,600.0],"y":[0.0,-0.0007626515125749894,-0.003040299948778676,-0.006817486156329138,-0.012078750982944456,-0.018808635276342696,-0.026991679884241917,-0.03661242565436022,-0.047655413434415664,-0.060105184072126304,-0.07394627841521023,-0.08916323731138555,-0.10574060160837027,-0.12366291215388255,-0.14291470979564044,-0.16348053538136195,-0.18534492975876524,-0.20849243377556842,-0.23290758827948943,-0.2585749341182458,-0.28547901213955673,-0.31360436319113977,-0.34293552812071315,-0.37345704777599475,-0.40515346300470256,-0.4380093146545549,-0.47200914357326973,-0.5071374906085652,-0.5433788966081592,-0.5807179024197698,-0.6191390488911155,-0.658626876869914,-0.6991659272038832,-0.7407407407407417,-0.783335858328207,-0.8269358208139974,-0.8715251690458314,-0.9170884438714264,-0.9636101861385009,-1.0110749366947729,-1.0594672363879603,-1.1087716260657814,-1.1589726465759538,-1.2100548387661965,-1.262002743484227,-1.3148009015777629,-1.368433853894523,-1.4228861412822251,-1.478142304588587,-1.5341868846613278,-1.591004422348164,-1.6485794584968154,-1.7068965339549989,-1.765940189570433,-1.8256949661908353,-1.8861454046639246,-1.9472760458374183,-2.0090714305590347,-2.0715160996764928,-2.134594594037509,-2.198291454489803,-2.262591221881091,-2.327478437059093,-2.392937640871525,-2.4589533741661085,-2.5255101777905575,-2.5925925925925926,-2.6601851594199313,-2.728272419120292,-2.796838912541391,-2.8658691805309493,-2.9353477639366825,-3.00525920360631,-3.075588040387549,-3.1463188151281196,-3.217436068675736,-3.28892434187812,-3.360768175582987,-3.4329521106380585,-3.5054606878910493,-3.578278448189679,-3.6513899323816634,-3.724779681314724,-3.7984322358365783,-3.8723321367949417,-3.946463925037535,-4.020812141412076,-4.095361326766279,-4.170096021947868,-4.245000767804557,-4.320060105184067,-4.395258574934111,-4.470580717902414,-4.546011074936687,-4.621534186884655,-4.69713459459403,-4.772796838912534,-4.848505460687884,-4.9242450007677965,-4.999999999999994],"type":"scatter"},{"line":{"color":"red","dash":"solid"},"marker":{"color":"red"},"mode":"lines","name":"result 1 - dplt","x":[0.0,6.0606060606060606,12.121212121212121,18.18181818181818,24.242424242424242,30.303030303030305,36.36363636363636,42.42424242424242,48.484848484848484,54.54545454545455,60.60606060606061,66.66666666666667,72.72727272727272,78.78787878787878,84.84848484848484,90.9090909090909,96.96969696969697,103.03030303030303,109.0909090909091,115.15151515151516,121.21212121212122,127.27272727272727,133.33333333333334,139.3939393939394,145.45454545454544,151.5151515151515,157.57575757575756,163.63636363636363,169.6969696969697,175.75757575757575,181.8181818181818,187.87878787878788,193.93939393939394,200.0,206.06060606060606,212.12121212121212,218.1818181818182,224.24242424242425,230.3030303030303,236.36363636363637,242.42424242424244,248.48484848484847,254.54545454545453,260.6060606060606,266.6666666666667,272.72727272727275,278.7878787878788,284.8484848484849,290.9090909090909,296.96969696969694,303.030303030303,309.09090909090907,315.1515151515151,321.2121212121212,327.27272727272725,333.3333333333333,339.3939393939394,345.45454545454544,351.5151515151515,357.57575757575756,363.6363636363636,369.6969696969697,375.75757575757575,381.8181818181818,387.8787878787879,393.93939393939394,400.0,406.06060606060606,412.1212121212121,418.1818181818182,424.24242424242425,430.3030303030303,436.3636363636364,442.42424242424244,448.4848484848485,454.54545454545456,460.6060606060606,466.6666666666667,472.72727272727275,478.7878787878788,484.8484848484849,490.9090909090909,496.96969696969694,503.030303030303,509.09090909090907,515.1515151515151,521.2121212121212,527.2727272727273,533.3333333333334,539.3939393939394,545.4545454545455,551.5151515151515,557.5757575757576,563.6363636363636,569.6969696969697,575.7575757575758,581.8181818181818,587.8787878787879,593.9393939393939,600.0],"y":[0.0,-0.0007626515125749899,-0.0030402999487786748,-0.006817486156329137,-0.012078750982944454,-0.018808635276342692,-0.02699167988424191,-0.0366124256543602,-0.04765541343441563,-0.06010518407212626,-0.07394627841521016,-0.08916323731138544,-0.10574060160837012,-0.12366291215388232,-0.14291470979564014,-0.16348053538136154,-0.18534492975876474,-0.20849243377556778,-0.23290758827948865,-0.2585749341182458,-0.28547901213955673,-0.31360436319113977,-0.3429355281207131,-0.37345704777599464,-0.40515346300470234,-0.43800931465455467,-0.4720091435732694,-0.5071374906085648,-0.5433788966081587,-0.5807179024197694,-0.6191390488911149,-0.6586268768699133,-0.6991659272038825,-0.7407407407407408,-0.7833358583282061,-0.8269358208139965,-0.8715251690458304,-0.9170884438714255,-0.9636101861384998,-1.0110749366947718,-1.059467236387959,-1.1087716260657798,-1.1589726465759524,-1.210054838766195,-1.2620027434842251,-1.3148009015777613,-1.3684338538945215,-1.4228861412822236,-1.4781423045885853,-1.5341868846613258,-1.5910044223481625,-1.6485794584968139,-1.7068965339549973,-1.7659401895704312,-1.825694966190834,-1.8861454046639226,-1.947276045837417,-2.009071430559034,-2.071516099676491,-2.1345945940375075,-2.198291454489801,-2.26259122188109,-2.327478437059092,-2.3929376408715237,-2.458953374166107,-2.5255101777905566,-2.5925925925925917,-2.6601851594199304,-2.728272419120292,-2.7968389125413906,-2.865869180530949,-2.935347763936682,-3.00525920360631,-3.0755880403875495,-3.1463188151281196,-3.217436068675736,-3.2889243418781207,-3.3607681755829875,-3.4329521106380594,-3.50546068789105,-3.5782784481896797,-3.6513899323816648,-3.724779681314725,-3.798432235836579,-3.872332136794942,-3.946463925037537,-4.020812141412076,-4.095361326766281,-4.17009602194787,-4.245000767804558,-4.320060105184068,-4.395258574934114,-4.470580717902416,-4.54601107493669,-4.621534186884656,-4.697134594594031,-4.772796838912535,-4.8485054606878855,-4.924245000767797,-4.999999999999995],"type":"scatter"}], {"template":{"data":{"candlestick":[{"decreasing":{"line":{"color":"#000033"}},"increasing":{"line":{"color":"#000032"}},"type":"candlestick"}],"contourcarpet":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"contourcarpet"}],"contour":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"contour"}],"heatmap":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"heatmap"}],"histogram2d":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"histogram2d"}],"icicle":[{"textfont":{"color":"white"},"type":"icicle"}],"sankey":[{"textfont":{"color":"#000036"},"type":"sankey"}],"scatter":[{"marker":{"line":{"width":0}},"type":"scatter"}],"table":[{"cells":{"fill":{"color":"#000038"},"font":{"color":"#000037"},"line":{"color":"#000039"}},"header":{"fill":{"color":"#000040"},"font":{"color":"#000036"},"line":{"color":"#000039"}},"type":"table"}],"waterfall":[{"connector":{"line":{"color":"#000036","width":2}},"decreasing":{"marker":{"color":"#000033"}},"increasing":{"marker":{"color":"#000032"}},"totals":{"marker":{"color":"#000034"}},"type":"waterfall"}]},"layout":{"coloraxis":{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]]},"colorscale":{"diverging":[[0.0,"#000021"],[0.1,"#000022"],[0.2,"#000023"],[0.3,"#000024"],[0.4,"#000025"],[0.5,"#000026"],[0.6,"#000027"],[0.7,"#000028"],[0.8,"#000029"],[0.9,"#000030"],[1.0,"#000031"]],"sequential":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"sequentialminus":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]]},"colorway":["#000001","#000002","#000003","#000004","#000005","#000006","#000007","#000008","#000009","#000010"]}},"xaxis":{"title":{"text":"dplt_grid"}},"yaxis":{"title":{"font":{"color":"black"},"text":"dplt"},"tickfont":{"color":"black"}}}, {"responsive": true} ) }; </script> </div>'}
However the resistance force at beam end are different:
variable_names = ["height", "reaction_forces"]
df = concat(
[
DataFrame([result.get_numeric_scalars(variable_names=variable_names)]),
DataFrame([result_1.get_numeric_scalars(variable_names=variable_names)]),
],
ignore_index=True,
)
plot = BarPlot(Dataset.from_dataframe(df))
plot.title = "Comparison of model result with data"
plot.font_size = 20
plot.labels = ["height 50mm", "height 60mm"]
fig = plot.execute(save=False, show=True, file_format="html")[0]
fig
Out:
{'text/html': '<div> <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG"></script><script type="text/javascript">if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}</script> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: \'local\'};</script>\n <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.35.0.min.js"></script> <div id="372d1e63-78a3-49d2-9c1f-150a0202864e" class="plotly-graph-div" style="height:525px; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("372d1e63-78a3-49d2-9c1f-150a0202864e")) { Plotly.newPlot( "372d1e63-78a3-49d2-9c1f-150a0202864e", [{"marker":{"color":"rgba(127,0,255,1.0)"},"name":"0","text":["60.0","-7875.0"],"width":0.375,"x":[0.1875,1.1875],"y":[60.0,-7875.0],"type":"bar","textangle":0.0,"textposition":"outside"},{"marker":{"color":"rgba(255,0,0,1.0)"},"name":"1","text":["50.0","-4557.291666666667"],"width":0.375,"x":[0.5625,1.5625],"y":[50.0,-4557.291666666667],"type":"bar","textangle":0.0,"textposition":"outside"}], {"template":{"data":{"candlestick":[{"decreasing":{"line":{"color":"#000033"}},"increasing":{"line":{"color":"#000032"}},"type":"candlestick"}],"contourcarpet":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"contourcarpet"}],"contour":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"contour"}],"heatmap":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"heatmap"}],"histogram2d":[{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"type":"histogram2d"}],"icicle":[{"textfont":{"color":"white"},"type":"icicle"}],"sankey":[{"textfont":{"color":"#000036"},"type":"sankey"}],"scatter":[{"marker":{"line":{"width":0}},"type":"scatter"}],"table":[{"cells":{"fill":{"color":"#000038"},"font":{"color":"#000037"},"line":{"color":"#000039"}},"header":{"fill":{"color":"#000040"},"font":{"color":"#000036"},"line":{"color":"#000039"}},"type":"table"}],"waterfall":[{"connector":{"line":{"color":"#000036","width":2}},"decreasing":{"marker":{"color":"#000033"}},"increasing":{"marker":{"color":"#000032"}},"totals":{"marker":{"color":"#000034"}},"type":"waterfall"}]},"layout":{"coloraxis":{"colorscale":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]]},"colorscale":{"diverging":[[0.0,"#000021"],[0.1,"#000022"],[0.2,"#000023"],[0.3,"#000024"],[0.4,"#000025"],[0.5,"#000026"],[0.6,"#000027"],[0.7,"#000028"],[0.8,"#000029"],[0.9,"#000030"],[1.0,"#000031"]],"sequential":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]],"sequentialminus":[[0.0,"#000011"],[0.1111111111111111,"#000012"],[0.2222222222222222,"#000013"],[0.3333333333333333,"#000014"],[0.4444444444444444,"#000015"],[0.5555555555555556,"#000016"],[0.6666666666666666,"#000017"],[0.7777777777777778,"#000018"],[0.8888888888888888,"#000019"],[1.0,"#000020"]]},"colorway":["#000001","#000002","#000003","#000004","#000005","#000006","#000007","#000008","#000009","#000010"]}},"font":{"size":20},"title":{"font":{"size":24.0},"text":"Comparison of model result with data"},"xaxis":{"title":{"text":""},"showgrid":true,"tickvals":[0.375,1.375],"ticktext":["height","reaction_forces"],"tickangle":0.0},"yaxis":{"title":{"text":""},"showgrid":true}}, {"responsive": true} ) }; </script> </div>'}
Total running time of the script: ( 0 minutes 3.595 seconds)
Download Python source code: plot_03_model_result_management.py
Download Jupyter notebook: plot_03_model_result_management.ipynb