An AxisVM binding has been developed by VIKTOR to simplify the process of creating and analyzing an AxisVM model. VIKTOR's AxisVM integration requires a specific AxisVM worker which can be downloaded here.
This binding was tested in AxisVM version 5. We cannot guarantee that the binding in combination with the worker will function properly with other versions of AxisVM.
An AxisVM model is made by starting off with an empty model and creating/modifying objects via their respective
interfaces. The following
Model interfaces are available:
references: for creating reference points, vectors, axes, planes and angles.
materials: for creating materials.
nodes: for creating nodes.
cross_sections: for creating cross-sections.
lines: for creating lines, beams, etc.
domains: for creating domains.
node_supports: for creating node supports.
line_supports: for creating line supports.
load_cases: for creating load cases.
loads: for creating loads.
load_combinations: for creating load combinations.
sections: for creating sections, on which results can be obtained.
results: for requesting results from the worker (only requested results will be returned).
Below is an example of a model, representing a cantilever beam bending under its own weight:
from viktor.external.axisvm import Model
from viktor.external.axisvm import Material
model = Model() # Initialize the empty model.
material = model.materials.add_from_catalog('C12/15', Material.DesignCode.EURO_CODE)
cross_section = model.cross_sections.create_rectangular(0.01, 0.01)
n1 = model.nodes.create(0, 0, 0)
n2 = model.nodes.create(1, 0, 0)
beam = model.lines.create(n1, n2).define_as_beam(material, cross_section)
model.node_supports.create_relative_to_member(n1, stiffness_x=1e10, stiffness_y=1e10, stiffness_z=1e10,
stiffness_xx=1e10, stiffness_yy=1e10, stiffness_zz=1e10)
load_case = model.load_cases.create()
Running an AxisVM analysis
The model can be fed to the
AxisVMAnalysis as follows:
from viktor.external.axisvm import AxisVMAnalysis
# Run the analysis and obtain the results, model (.axs) and/or result file (.axe).
analysis = AxisVMAnalysis(model, return_results=True, return_model=True)
analysis.execute(timeout=25) # make a conservative estimation of the time needed to finish
results = analysis.get_results() # obtain the results in a dict
model_file = analysis.get_model_file() # obtain the model file (.axs)
result_file = analysis.get_result_file() # obtain the result file (.axe)
return_results is set to
True, an analysis will be performed and the following methods become available:
return_model=True, the model file will also become available:
mock_AxisVMAnalysis decorator for easier testing of
AxisVMAnalysis.execute needs to be mocked
within the context of (automated) testing.
viktor.testing module provides the
mock_AxisVMAnalysis decorator that
facilitate mocking of workers:
from viktor import File
from viktor.testing import mock_AxisVMAnalysis
from app.my_entity_type.controller import MyEntityTypeController
For the decorator's input parameters the following holds:
- If a Sequence type is provided, the next entry is returned for each corresponding method call. When a call is performed on a depleted iterable, an Exception is raised.
- If a single object is provided, the object is returned each time the corresponding method is called (endlessly).
- If None is provided (default), a default File/BytesIO object (with empty content) is returned each time the corresponding method is called (endlessly).