SCIA Engineer
This guide is an informative piece to help you if you have questions about our SCIA Engineer integration. If you would like a more instructive lesson, take a look at the SCIA Engineer tutorial we have available.
Create selections using Model.create_selection()
Several new objects can be constructed:
SolverSetup
to configure (general) solver settingsProjectData
to set basic project information- Library cross-sections using
Model.create_library_cross_section()
- Cross-links using
Model.create_cross_link()
Supported (tested) SCIA versions:
- v25
- v24
- v23
- v22
- v21
- v20
- v19
VIKTOR's SCIA integration requires a specific SCIA worker which can be installed using these instructions.
Creating and analyzing a SCIA model in VIKTOR consists of the following steps:
- Create the empty model.
- Fill the model with the desired parts (e.g. nodes, beams, load cases, forces, etc.), by calling the corresponding create_xxx() methods.
- Generate the XML representation of the SCIA model.
- Run the SCIA analysis with the generated XML input file and a user-created esa template file.
- Obtain the results
In code this looks like:
import viktor as vkt
# 1. Create the empty model
model = vkt.scia.Model()
# 2. Fill the model with the parts (to be extended as desired)
cross_section = model.create_rectangular_cross_section(
'rectangular_section', vkt.scia.Material(455, 'test_material'), 100, 100
)
n1 = model.create_node('n1', 0, 0, 0)
n2 = model.create_node('n2', 1, 0, 0)
model.create_beam(n1, n2, cross_section, name='test_beam')
# 3. Generate the XML input file
xml_file, def_file = model.generate_xml_input()
# 4. Run the SCIA analysis
esa_file = vkt.File.from_path('my_template.esa')
scia_analysis = vkt.scia.SciaAnalysis(xml_file, def_file, esa_file)
scia_analysis.execute(300)
# Obtain the results
analysis_result = scia_analysis.get_xml_output_file()
The ESA template file
The ESA file must be created by the user by using the SCIA interface. It functions as the template to which the model is added. The materials used in the VIKTOR model must exist in the ESA template file: both the name and id of the material must match. The SCIA version in which the template file was created must match the SCIA version called by the worker.
An I/O document has to be defined in the .esa
file, which has to be named "output". If not defined, the worker will
not be able to write this expected document and fails to execute.
Example I/O document of the esa model
Supported parts
Currently, the creation of the following SCIA parts is (fully, or partially) supported in VIKTOR:
Libraries:
- Circular composed cross-section
- Circular cross-section
- Circular hollow cross-section
- General cross-section (>= v14.7.0, polygon + openings only)
- Layer
- Library cross section (>= v13.1.0)
- Non-linear function
- Numerical cross section
- Orthotropy
- Rectangular cross-section
- Selections (>= v14.1.0)
- Subsoil
- Updating of material properties
Structure:
- Arbitrary profile
- Arbitrary profile span
- Beam
- Circular plane
- Cross-link (>= v13.1.0)
- Node
- Open slab
- Plane
- Rigid arm
Results:
- Integration strip
- Averaging strip (>= v14.3.0; Point type only)
- Section on beam
- Section on 2D-member
Supports:
- Hinge on beam
- Hinge on plane
- Line support on beam
- Line support on 2D-member edge
- Point support on beam
- Support in node
- Surface support
Sets:
- Load case permanent
- Load case variable
- Load combination
- Load group
- Nonlinear load combination
- Result class
Loads:
- Free line force
- Free point force
- Free surface load
- Line force on beam
- Line force on 2D-member edge
- Line moment on beam
- Line moment on 2D-member edge
- Moment in node
- Point force on beam
- Point force in node
- Surface load
- Thermal load on beam
- Thermal load on 2D-member
Misc.:
- Mesh setup
- Project data (>= v13.1.0)
- Solver setup (>= v13.1.0)
Testing
mock_SciaAnalysis
decorator for easier testing of SciaAnalysis
Model.generate_xml_input
and SciaAnalysis.execute
need to be
mocked within the context of (automated) testing.
The viktor.testing
module provides the mock_SciaAnalysis
decorator that
facilitate mocking of workers:
import unittest
from viktor import File
from viktor.testing import mock_SciaAnalysis
from app.my_entity_type.controller import MyEntityTypeController
class TestMyEntityTypeController(unittest.TestCase):
@mock_SciaAnalysis(
get_engineering_report=File.from_path('test_file.pdf'),
get_updated_esa_model=File.from_path('test_file.esa'),
get_xml_output_file=File.from_path('test_file.xml'),
)
def test_scia_analysis(self):
MyEntityTypeController().scia_analysis()
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).