[Scons-users] SCons for Ansys APDL Analysis

Hubley, Christopher (GE Aerospace, US) Christopher.Hubley at ge.com
Mon Oct 17 23:21:59 EDT 2022


Hi Bill,
Thanks for clarifying.

> How do you specify this dependency to the ansys tools? is this a command in
> the APDL file? Is this a command line to a tool?  Other?

APDL doesn’t have anything like #include statements like C++ or import statements like Python.

The main script is called from the command line.
Dependencies are simply called from files with commands in the script. 

For example,

    RESUME, path/to/my/database, db
    /INPUT, path/to/my/apdl_script, inp

You could also call “myCmd.mac” (in the working directory) by adding a line to your script:
    myCmd

I think there are a few more ways to specify reading from files (e.g. *USE, CDREAD), but the three above are the most common.

A simple APDL file might look like this:

    ! MyFile.inp
    ! (This is a comment)
    RESUME, DATABASE_NAME, db   ! <- An input
    ! Or
    /FILENAM, DATABASE_NAME
    RESUME
    
    /PREP7
        /INPUT, cut_boundary_loads, inp   ! <- An input
        /INPUT, nodal_temperatures, inp   ! <- An input
        /INPUT, pressure_loads, inp   ! <- An input
    FINISH
    /SOLU
        SOLVE   ! <- Creates a results database (DATABASE_NAME.rst) and
                !    other files
    FINISH
    SAVE ! Updates DATABASE_NAME.db

You would launch Ansys in batch mode with a command like this:
    $ ansys212x64 -b -i myFile.inp -o myFile.out

Or like this:
    $ ansys212x64 -b < myFile.inp > myFile.out


I anticipate that some coding discipline may be required to make APDL scripts
work with SCons. 
For example, making sure that input DB files renamed prior to modifying them.


> I noticed you said you're running in cygwin?
> Is this with cygwin's python? or windows python, but running in a cygwin bash shell?

Our setup is a bit peculiar. We run our engineering tools with Cygwin (e.g.
Ansys), but our Python installation Anaconda Python installed in Windows.

I had to hack in a Python subprocess call to get SCons to launch Ansys.

-Chris

Christopher K. Hubley
Senior Engineer, TFTJ Fan & Compressor
GE Aviation


More information about the Scons-users mailing list