环境变量

ABAQUS_BAT_PATH

The file path of the abaqus command line batch file (.bat). Only set this environment variable if abaqus is not the default Abaqus command line executable. This variable is used by abqpy to run the Abaqus command line procedure inside the Python interpreter environment where it is installed.

ABAQUS_COMMAND_OPTIONS

在 Python 环境中使用 abqpy 默认将运行以下两个命令之一:

  1. 当存在 import abaqusfrom abaqus import ... 语句时:

    abaqus cae noGUI=script.py -- [args ...]
    
  2. 当存在 import odbAccessfrom odbAccess import ... 语句时:

    abaqus python script.py [args ...]
    

但是,还有其它可以传递给 abaqus 命令的选项。要定义这些选项,您可以创建一个名为 ABAQUS_COMMAND_OPTIONS 的新系统环境变量,并将您要使用的选项为该变量设置一个 ** 字典 **。 字典的值可以是布尔值或字符串,例如:{'noGUI':True, 'database':'file.odb'}

可用选项包括:

  1. 使用 abaqus cae 命令 (导入 abaqus 模块):

    {
        'noGUI': bool,
        'database': 'database-file',
        'replay': 'replay-file',
        'recover': 'journal-file',
        'startup': 'startup-file',
        'noenvstartup': bool,
        'noSavedOptions': bool,
        'noSavedGuiPrefs': bool,
        'noStartupDialog': bool,
        'custom': 'script-file',
        'guiTester': 'GUI-script',
        'guiRecord': bool,
        'guiNoRecord': bool,
    }
    
  2. 使用 abaqus cae 命令 (导入 abaqus 模块):

    {
        'sim': 'sim_file_name',
        'log': 'log_file_name',
    }
    

使用此方案的一个优点是在代码内的运行时更改选项。

示例

下面的代码片段在运行时更改了调用 abaqus cae 命令的默认选项。

import os
os.environ['ABAQUS_COMMAND_OPTIONS'] = str({'noGUI': False, 'database':'file.odb'})

from abaqus import *
...

In this specific case, the procedure will use the graphical user interface (GUI mode) and load a database file, i.e., it will run the following command line.

abaqus cae script=script.py database=file.odb -- [args ...]

评论