Bending test analytical
bending_test_analytical
¶
Classes¶
BendingTestAnalytical
¶
BendingTestAnalytical(
load_case_name: str,
material: str | Path | Material | None = None,
**options
)
Bases: PreRunPostModel
This model represents a straight beam subjected to different bending load cases and boundary conditions. It is based on Bernouilli hypothesis.
Possible load cases are: - Cantilever: clamped at one end, and displacement applied on the beam according to the relative_dplt_location attribute. - ThreePoints: displacement applied on the beam according to the relative_dplt_location attribute and support location according to the relative_support_location attribute.
Input parameters are geometry of the section, Young's modulus, length of the beam, the relative displacement location, the relative support location (for the ThreePoints load case) and the load case name.
Output parameters are the maximum displacement in the direction of the loading, the location of this maximum displacement, the maximum reaction forces, the displacement and the moment fields and the displacement at the maximum reaction forces.
We suppose that positive force is upwards. The imposed displacement is downwards.
Notes
Since an IntegratedModel extends a
GEMSEO <https://gemseo.readthedocs.io/en/stable/index.html>
:class:~.gemseo.core.discipline.MDODiscipline, it can be used as |gemseo|
discipline <https://gemseo.readthedocs.io/en/6.0.0/examples/api
/plot_discipline.html#discipline>.
Also, |gemseo| capabilities (MLearning, Optimisation) can be used on the model.
Examples:
>>> # Run a model with default values, each execution being stored in a unique
>>> # directory. The archive and scratch persistency is customized.
>>> # The manager for archiving the results is set to MLFlow.
>>> from vimseo.api import create_model
>>> from vimseo.core.model_settings import IntegratedModelSettings
>>> model = create_model("BendingTestAnalytical", "Cantilever",
>>> model_options=IntegratedModelSettings(
>>> directory_archive_root=f"my_model_result",
>>> directory_scratch_root=f"my_scratch",
>>> directory_scratch_persistency=PersistencyPolicy.DELETE_ALWAYS,
>>> directory_archive_persistency=PersistencyPolicy.DELETE_IF_FAULTY,
>>> archive_manager="MlflowArchive",
>>> ),
>>> )
>>> model.execute()
Initialize self. See help(type(self)) for accurate signature.
Parameters:
-
load_case_name(str) –The description is missing.
-
material(str | Path | Material | None, default:None) –The description is missing.
-
**options–The description is missing.
Source code in src\vimseo\core\pre_run_post_model.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
Attributes¶
MATERIAL_FILE
class-attribute
instance-attribute
¶
MATERIAL_FILE = MATERIAL_LIB_DIR / 'Ta6v.json'
The path to the json file defining the material values.
NUMERICAL_VARIABLE_NAMES
class-attribute
¶
NUMERICAL_VARIABLE_NAMES: Sequence[str] = []
The input variable names which are numerical parameters.
N_CPUS
class-attribute
instance-attribute
¶
N_CPUS = 1
The default number of cpus used to run the model.
PLOTS
class-attribute
¶
PLOTS: Sequence[tuple[str, ...]] = [
("dplt_grid", "dplt"),
("moment_grid", "moment"),
]
The figures to plot from the model data.
A figure is defined either by a tuple of variable names, the first one being the
abscissa and the following ones the ordinates, or by a :class:.Plot when the
lines shall be styled, drawn against a secondary ordinate axis or completed with
horizontal reference lines.
A load case can override or extend these figures by declaring its own PLOTS
class attribute. A load-case entry whose abscissa and first ordinate match a
model entry replaces it in place; any other entry is appended. See
:class:.LoadCase and :func:.merge_plots.
Examples:
>>> # A single line, and two lines sharing an abscissa.
>>> PLOTS = [
... ("strain_history", "stress_history"),
... ("time", "energy_strain_history", "energy_damage_history"),
... ]
>>> # A styled figure with a secondary ordinate axis and a custom abscissa
>>> # label.
>>> PLOTS = [
... Plot(
... x="displacement_history",
... x_label="Displacement",
... traces=[
... Trace("force_history", style=LineStyle(color="blue")),
... Trace(
... "crack_position_history",
... secondary_y=True,
... style=LineStyle(color="red", marker="."),
... ),
... ],
... title="Crack propagation",
... )
... ]
POST_PROC_FAMILY
class-attribute
instance-attribute
¶
POST_PROC_FAMILY = 'PostBendingTestAnalytical'
The prefix of the post-processor class name.
PRE_PROC_FAMILY
class-attribute
instance-attribute
¶
PRE_PROC_FAMILY = 'PreBendingTestAnalytical'
The prefix of the pre-processor class name (typically MyPre for a pre-
processor class named MyPre_MyLoadCase).
RUN_FAMILY
class-attribute
instance-attribute
¶
RUN_FAMILY = 'RunBendingTestAnalytical'
The prefix of the run-processor class name.
SUBROUTINES_NAMES
class-attribute
¶
SUBROUTINES_NAMES: Sequence[str] = []
The names of the subroutines.
SUMMARY
class-attribute
instance-attribute
¶
SUMMARY = " An analytical model for the bending of a parallelepipedic beam"
A brief description of the model (purpose, range of application, hypothesis, limitations, similar models).
boundary_condition_variable_names
property
¶
boundary_condition_variable_names
The input variable names which are boundary condition parameters.
geometrical_variable_names
property
¶
geometrical_variable_names
The input variable names which are geometrical parameters.
image_path
property
¶
image_path: Path | None
The fully-qualified path to the image illustrating the model.
If no image is associated to the model, the path to the image associated with the load case is returned.
job_description
class-attribute
instance-attribute
¶
job_description: str = ''
Free string description of the job to be executed, to be passed as a metadata result.
job_executor
property
¶
job_executor
The job executor the job-settings form configures and the run step restores.
The executor of the model's :attr:run component — the scheduler doing
the heavy solve — or None when that component carries none. It never
raises: a model whose pre/post run interactively while its run uses a
scheduler carries several distinct executors, which is legitimate.
material_variable_names
property
¶
material_variable_names
The input variable names which are material parameters.
numerical_variable_names
property
¶
numerical_variable_names
The input variable names which are numerical parameters.
plots
property
¶
plots: list[Plot]
The definitions of the figures, from the model, overridden or completed by the load case.
A load-case PLOTS entry whose abscissa and first ordinate match a model
PLOTS entry replaces it (keeping the model's position in the list); any
other load-case entry is added as an extra, load-case-specific figure. See
:func:.merge_plots.
scratch_job_directory
property
¶
scratch_job_directory: Path | str
The Path to the scratch job directory, once the model is executed.
Before model execution, or if the model uses the cache, the empty string is returned.
Classes¶
InputGroupNames
¶
Bases: StrEnum
The names of the input variable groups.
Methods:¶
archive_outputs
¶
archive_outputs(output_data)
Archive the model result: field files, metadata, results, persistent files.
Runs the archive half of the execute tail against the current scratch
job directory — collecting field files (:meth:_collect_field_files),
generating the metadata into output_data, then writing results.json
and copying the persistent files through the archive manager. The archive
job directory must already be created
(self._archive_manager.create_job_directory()). Unlike
:meth:_manage_persistency it does not touch the scratch-persistency
policy, so a caller that ran individual disciplines (the vtt GUI's
pre/run/post flow) can archive exactly as model.execute does without
deleting the job directory it is reading.
Source code in src\vimseo\core\base_integrated_model.py
963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | |
auto_get_file
¶
auto_get_file(
file_suffix: str, load_cases: Iterable[str] = ()
) -> Iterable[Path]
Return file paths for files following a naming convention and placed next to the model class or its parents, or next to a model load case class. Naming convention is {model_class_name}{file_suffix} or {model_class_name}_{load_case}{file_suffix}.
Parameters:
-
file_suffix(str) –The suffix, including the extension, of the file to be searched in next to model class or its parents.
-
load_cases(Iterable[str], default:()) –an iterable of load cases. If specified, only the files placed next to these load case classes are searched. Otherwise, all load case classes associated to the model are considered.
Returns:
-
Iterable[Path]–A list of file paths.
Source code in src\vimseo\core\base_integrated_model.py
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | |
create_cache_from_archive
¶
create_cache_from_archive(
run_ids: Iterable[str] = (),
) -> HDF5Cache
Defines a temporary HDF5 cache file, based on results found on the current archive.
Source code in src\vimseo\core\base_integrated_model.py
889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | |
execute
¶
execute(
input_data: StrKeyMapping = READ_ONLY_EMPTY_DICT,
) -> DisciplineData
Execute the discipline, i.e. compute output data from input data.
If :attr:.virtual_execution is True,
this method returns the :attr:.default_output_data.
Otherwise,
it calls the :meth:._run method performing the true execution
and returns the corresponding output data.
This :meth:._run method must be implemented in subclasses.
Parameters:
-
input_data(StrKeyMapping, default:READ_ONLY_EMPTY_DICT) –The input data. Complete this dictionary with the :attr:
.default_input_data.
Returns:
-
DisciplineData–The input and output data.
Source code in src\vimseo\core\gemseo_discipline_wrapper.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
get_dataflow
¶
get_dataflow()
The inputs and outputs of the components of the model.
Returns:
-
–
A dictionary mapping component name to its input and output names.
Source code in src\vimseo\core\pre_run_post_model.py
163 164 165 166 167 168 169 170 171 172 173 | |
get_output_data_names
¶
get_output_data_names(
remove_metadata: bool = False,
) -> list[str]
Parameters:
-
remove_metadata(bool, default:False) –Whether to remove the metadata from the output data names.
Source code in src\vimseo\core\base_integrated_model.py
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | |
plot_results
¶
plot_results(
directory_path: str | Path = "",
save: bool = True,
show: bool = False,
scalar_names: Iterable[str] = (),
data: str = "PLOTS",
) -> Mapping[str, Figure]
Plots the results, from the definition of the figures in the PLOTS variable.
Parameters:
-
directory_path(str | Path, default:'') –A path where to save the plots. Default is current working directory.
-
save(bool, default:True) –Whether to save the plot.
-
show(bool, default:False) –Whether to show the plot.
-
scalar_names(Iterable[str], default:()) –The scalars to plot in a scatter matrix. Show all scalars by default.
-
data(str, default:'PLOTS') –Either
"PLOTS"to draw the figures defined inPLOTS, or"SCALARS"to draw a scatter matrix of the scalar outputs.
Returns:
-
Mapping[str, Figure]–The figures, indexed by their name.
Source code in src\vimseo\core\base_integrated_model.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | |
reset_cache
¶
reset_cache(new_cache_path: str | Path)
Create a new cache with another file path.
Has an effect only for HDF5 cache.
Source code in src\vimseo\core\base_integrated_model.py
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | |
show_image
¶
show_image() -> None
Show the image illustrating the load case.
Source code in src\vimseo\core\base_integrated_model.py
487 488 489 490 | |