Create input file for PyACP#
To start working with PyACP, an input file that contains the mesh is required. PyACP supports reading the mesh from:
CDB or DAT files, using the
ACPInstance.import_model()
method with the"ansys::cdb"
or"ansys:dat"
format.HDF5 transfer files generated by Mechanical, using the
ACPInstance.import_model()
method with the"ansys::h5"
format.
PyACP reads the mesh, including any coordinate systems, element sets, and edge sets from the input file. In the case of CDB or DAT files, PyACP also reads the materials from the input file. Once the layup has been created with PyACP, you can export the model for downstream analysis.
Important
The Model.export_analysis_model()
method to export a CDB file from PyACP is only
available if the input was read from a CDB or DAT file.
If the input was read from a Mechanical HDF5 transfer file, you can export the model
either to the HDF5 Composite CAE format, or to transfer formats to PyMechanical.
See the workflow examples for more information.
The following sections describe how to create the input file in CDB or Mechanical HDF5 format.
Create a CDB input file#
Create a CDB file with Ansys Mechanical#
In the Mechanical GUI#
One way to create an input file for PyACP is to create a static structural setup and export the solver input file. To do this, follow these steps:
Open Ansys Workbench.
Add a “Static Structural” system.
Create or import a geometry in the geometry cell of the static structural system (A3). Note that PyACP only supports shell geometries.
Open the Mechanical Model (A4).
Assign a thickness and a material to the geometry. (These are later overwritten by PyACP.)
Optional: Define the boundary conditions.
Select “Static Structural (A5)” in the tree and then click Environment/Write Input File in the navigation bar.
Save the input file to a DAT file in the desired location.
For a complete example, see PyMAPDL workflow.
Note
The imported model always contains the dummy material named 1
that was assigned to the geometry.
With scripting#
You can also create a CDB file from Mechanical or PyMechanical with scripting, using the WriteInputFile
method of the analysis object. See PyMechanical to CDB shell workflow for a complete example.
Create an input file with Ansys Mechanical APDL#
You can also create an input file for PyACP by performing these steps:
Open Ansys Mechanical APDL
Load or create a model with APDL commands
Write the CDB file with the CDWRITE command:
CDWRITE,ALL,FILE,cdbfile.cdb
See PyMAPDL workflow for a complete example.
Notes on material handling#
Materials present in the input file (*.cdb or *.dat) are read into PyACP. The following rules apply:
If the material has defined a UVID, then the material is imported as locked. This means the material cannot be edited in PyACP. If the input file was created with Ansys Mechanical (see Create a CDB file with Ansys Mechanical), this is always the case. In Mechanical APDL, you can define a UVID with the
MP,UVID
orMPDATAT,UNBL,16,UVID
command.If the material has no UVID, then the material is copied on import. Only the copied material appears in PyACP. The original material is not changed and appears unmodified in the output file.
Create a Mechanical HDF5 transfer file (experimental)#
The Mechanical to ACP HDF5 transfer file can be created using the export_mesh_for_acp()
helper function. See PyMechanical shell workflow or PyMechanical solid workflow for complete examples.