viktor.external.rfem
CopyNodalLoadAction
- class viktor.external.rfem.CopyNodalLoadAction(copy_from_to, loading_type=LoadingType.LOAD_CASE, *, factor=1.0)
Bases:
RFEMAction
Copy the nodal load from one load case to the other, applying a factor on the magnitude.
- Note: only the 1st nodal load is copied from and to each load case/combination, other loads are ignored. Make
sure that at least 1 such nodal load exists in both the copy-from and copy-to load cases/combinations.
- Parameters:
copy_from_to (
List
[Tuple
[int
,int
]]) – a list of load case/combination numbers to copy (from, to)loading_type (
LoadingType
) – defines if integers in ‘copy_from_to’ must be interpreted as load case (LOAD_CASE) or load combination (LOAD_COMBINATION) numbers (default: LOAD_CASE)factor (
float
) – factor to be applied on the nodal load magnitude (default: 1.0)
EnergyOptimizationAction
- class viktor.external.rfem.EnergyOptimizationAction(load_cases, loading_type=LoadingType.LOAD_CASE, *, goal, accuracy)
Bases:
RFEMAction
- Performs an iterative analysis (consisting of a series of RFEM analyses) to solve for the magnitude of the
1st nodal load, such that the energy at that node (approximately) equals the ‘goal’. The iteration comes to a finish if the change in displacement at the node is lower than the specified ‘accuracy’. This is done for each of the load cases specified.
- Parameters:
load_cases (
List
[int
]) – a list of load cases/combinations to do a energy optimization calculation for. None for all load cases/combinations (default: None).loading_type (
LoadingType
) – defines if integers in ‘load_cases’ must be interpreted as load case (LOAD_CASE) or load combination (LOAD_COMBINATION) numbers (default: LOAD_CASE)goal (
float
) – energy level [Nm] for which the calculation tries to solve the 1st nodal load. Same goal is used for all load cases/combinations.accuracy (
float
) – change in displacement [m] of the node corresponding to the 1st nodal load at which the iteration will successfully return. A lower accuracy in general means more iterations. Same accuracy is used for all load cases/combinations.
LoadingType
- class viktor.external.rfem.LoadingType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases:
Enum
- LOAD_CASE:
LoadingType
= 1
- LOAD_COMBINATION:
LoadingType
= 2
- LOAD_CASE:
RFEMAction
- class viktor.external.rfem.RFEMAction(id_)
Bases:
ABC
Abstract base class of all RFEM action objects.
RFEMAnalysis
- class viktor.external.rfem.RFEMAnalysis(rfx_file, actions)
Bases:
ExternalProgram
RFEMAnalysis can be used to perform an analysis with RFEM on third-party infrastructure. To start an analysis call the method
execute()
, with an appropriate timeout (in seconds). To retrieve the model callget_model()
and for results callget_result()
for the desired load combination (only afterexecute()
).Exceptions which can be raised during calculation:
viktor.errors.ExecutionError
: generic error. Error message provides more information
Example usage:
# SLS sls_cases = [1, 2, 3] sls_optimization = EnergyOptimizationAction(sls_cases, goal=10000, accuracy=0.1) # goal = 10 kNm, accuracy = 10 cm # ALS als_cases = [4, 5, 6] als_optimization = EnergyOptimizationAction(als_cases, goal=15000, accuracy=0.1) # goal = 15 kNm, accuracy = 10 cm # ULS uls_cases = [7, 8, 9] uls_creation = CopyNodalLoadAction(list(zip(sls_cases, uls_cases)), factor=1.5) # ULS = SLS x 1.5 # Write action write_result_action = WriteResultsAction(sls_cases + als_cases + uls_cases) # or can be left empty = all cases actions = [sls_optimization, als_optimization, uls_creation, write_result_action] rfem_analysis = RFEMAnalysis(rfx_file=my_rfx_file, actions=actions) # my_rfx_file contains the desired load cases and nodal loads rfem_analysis.execute(timeout=300) model = rfem_analysis.get_model() result_lc1 = rfem_analysis.get_result(1) result_lc2 = rfem_analysis.get_result(2)
- Parameters:
rfx_file (
Union
[BytesIO
,File
]) – RFEM input fileactions (
List
[RFEMAction
]) –list of actions to be performed sequentially. Possible actions are:
- get_model(*, as_file=False)
Get the model that is returned after the RFEM analysis.
- Parameters:
as_file (
bool
) – Return as BytesIO (default) or FileNew in v13.5.0- Return type:
Union
[BytesIO
,File
]
- get_result(load_case, *, as_file=False)
Get the nodal deformations (X, Y, Z) [m] and member internal forces (Location [m], My and Mz [Nm], Fy and Fz [N]) for a certain load case/combination number.
- Parameters:
load_case (
int
) – number of the load case/combination to get the result for. A ‘WriteResultsAction’ must have been performed on the corresponding load case/combination to be available.as_file (
bool
) – Return as BytesIO (default) or FileNew in v13.5.0
- Return type:
Union
[BytesIO
,File
]
WriteResultsAction
- class viktor.external.rfem.WriteResultsAction(load_cases=None, loading_type=LoadingType.LOAD_CASE)
Bases:
RFEMAction
Write all nodal deformations (X, Y, Z) and member internal forces (Location, My, Mz, Fy, Fz) for the model in current state, for each of the load cases/combinations requested, so that it is available in
get_result()
.- Parameters:
load_cases (
List
[int
]) – a list of load cases/combinations to write the results for. None for all load cases/combinations (default: None).loading_type (
LoadingType
) – defines if integers in ‘load_cases’ must be interpreted as load case (LOAD_CASE) or load combination (LOAD_COMBINATION) numbers (default: LOAD_CASE)