rvesimulator.abaqus2py

rvesimulator.abaqus2py.abaqus_simulator

Module for calling abaqus simulation and post processing

class AbaqusSimulator(sim_info, folder_info)[source]

Bases: Simulator, AssertInputs

Abaqus simulator

Parameters:
  • Simulator (class) – simulator interface

  • AssertInputs (class) – assert inputs

Examples

>>> from rvesimulator.abaqus2py.simulator_interface import AbaqusSimulator
>>> sim_info = {}
>>> folder_info = {}
>>> simulator = AbaqusSimulator(sim_info=sim_info, folder_info=folder_info)
>>> simulator.run()
>>> simulator.read_back_results()

initialization of abaqus simulator class

Parameters:
  • sim_info (dict) – dict for defining abaqus simulation

  • folder_info (dict) – dict indicating abaqus scripts and working folders

__init__(sim_info, folder_info)[source]

initialization of abaqus simulator class

Parameters:
  • sim_info (dict) – dict for defining abaqus simulation

  • folder_info (dict) – dict indicating abaqus scripts and working folders

_run_abaqus_simulation(command, max_time=inf, sleep_time=20.0, refresh_time=5.0)[source]

run abaqus simulation

Parameters:
  • command (str) – system command for running abaqus

  • max_time (float, optional) – maximum simulation time, by default inf

  • sleep_time (float, optional) – sleep time, by default 20.0

  • refresh_time (float, optional) – refresh time, by default 5.0

Returns:

simulation status

Return type:

str

Raises:

NotImplementedError – platform not be implemented

execute(max_time=inf, sleep_time=20.0, refresh_time=5.0)[source]

execute the abaqus simulation

Parameters:
  • max_time (float, optional) – maximum simulation time, kill the simulation when time reaches the given maximum simulation time, by default inf

  • sleep_time (float, optional) – sleep time, let abaqus run for 20s first, by default 20.0

  • refresh_time (float, optional) – detect if the simulation is finished or not every given refresh time, by default 5.0

Returns:

simulation status

Return type:

str

static kill_abaqus_process()[source]

kill abaqus simulation process

Return type:

None

make_new_script(file_name, status='simulation')[source]

make a small python script for running abaqus

Parameters:
  • file_name (str) – file name

  • status (str, optional) – status of simulation, by default “simulation”

Return type:

None

post_process(delete_odb=False)[source]

post process to get the preliminary results

Parameters:

delete_odb (bool, optional) – delete odb file to save memory, by default True

Return type:

None

read_back_results(file_name='results.pkl')[source]

read back the results from the generated pickle file

Parameters:

file_name (str, optional) – file name, by default “results.pkl”

Returns:

a dict containing the results

Return type:

dict

static remove_files(directory, file_types=['.log', '.lck', '.SMABulk', '.rec', '.SMAFocus', '.exception', '.simlog', '.023', '.exception'])[source]

remove file

Parameters:
  • directory (str) – target folder

  • file_type (str) – file name

Return type:

None

rvesimulator.abaqus2py.simulator_interface

Abstract class for a FEM simulator and assert inputs

class AssertInputs[source]

Bases: object

classmethod is_cwd_in_folder_info(folder_info)[source]

assert current_work_directory in folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_inputs_proper_defined(folder_info, sim_info)[source]

assert inputs are properly defined

Return type:

None

classmethod is_job_name_in_sim_info(sim_info)[source]

assert job name in the folder dict

Parameters:

sim_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_mwd_in_folder_info(folder_info)[source]

assert main_work_directory in folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_platform_in_sim_info(sim_info)[source]

assert platform in the folder dict

Parameters:

sim_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_post_path_in_folder_info(folder_info)[source]

assert post_path in folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_post_script_in_folder_info(folder_info)[source]

assert post script in the folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_script_path_in_folder_info(folder_info)[source]

assert script_path in folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_sim_path_in_folder_info(folder_info)[source]

assert sim_path in folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

classmethod is_sim_script_in_folder_info(folder_info)[source]

assert sim_script in folder_info dict

Parameters:

folder_info (dict) – dict that contains all folder information

Return type:

None

class Simulator[source]

Bases: object

Base class for a FEM simulator

execute()[source]

Function that calls the FEM simulator the pre-processing

Return type:

None

post_process()[source]

Function that handles the post-processing

Return type:

None

run()[source]

run the simulation in one shot

Return type:

None

rvesimulator.abaqus2py.utils

Functions for general use for abaqus2py module

create_dir(current_folder, dir_name)[source]

create new directory

Parameters:
  • current_folder (str) – current working folder

  • dirname (str) – new folder name

Returns:

path of created folder

Return type:

str

print_banner(message, sign='#', length=50)[source]

print banner

Parameters:
  • message (str) – string output to the screen

  • sign (str, optional) – pattern, by default “#”

  • length (int, optional) – length of output, by default 50

Return type:

None

write_json(sim_info, file_name)[source]

write json file for abaqus

Parameters:
  • sim_info (dict) – dict that contains all simulation information

  • file_name (str) – file name of json file

Return type:

None