How to access the working directory and the name of the currently opened .ad file via User Subroutine in Autodyn?
June 6, 2022 at 9:57 amFAQParticipant
The example below shows how to access the location and the name of the currently opened Autodyn file. The variables FDPRNT and FNID from the module fildef provide the directory and the name. If you compile the example below, launch the usersub exe file, open an Autodyn ad file and execute EXEDIT, the subtoutine will check get the location and the name of the file and open a text file with the same name as the ad file, but with the extension _OUTPUT.log in the working directory and will write the string “Hello World!” to text file.
! BEGIN EXAMPLE
USE kindef, ONLY: INT4
USE fildef, ONLY : FDPRNT, FNID
USE mdpp , ONLY : MYTASK
INTEGER(INT4) :: I,J,K,KK, ICHK, IOS, NUNIT
CHARACTER(LEN=256) :: FNAME
CHARACTER (LEN=5) :: TEXT5
DO I = 256, 1, -1
IF (FNID(I:I)/=’ ‘) EXIT
DO J = 256, 1, -1
IF (FDPRNT(J:J)/=’ ‘) EXIT
! Include the task number in the log file
CALL CONITC (MYTASK,TEXT5)
DO K = 2,5
IF (TEXT5(K:K)==’$’) EXIT
KK = K
FNAME = FDPRNT(1:J)//’/’//FNID(1:i)//’_OUTPUT’//TEXT5(2:KK)//’.log’
NUNIT = 78 ! HOPEFULLY FREE UNIT
WRITE (NUNIT,*,IOSTAT=IOS) ‘Hello World!’
END SUBROUTINE EXEDIT3
Introducing Ansys Electronics Desktop on Ansys Cloud
The Watch & Learn video article provides an overview of cloud computing from Electronics Desktop and details the product licenses and subscriptions to ANSYS Cloud Service that are...
How to Create a Reflector for a Center High-Mounted Stop Lamp (CHMSL)
This video article demonstrates how to create a reflector for a center high-mounted stop lamp. Optical Part design in Ansys SPEOS enables the design and validation of multiple...
Introducing the GEKO Turbulence Model in Ansys Fluent
The GEKO (GEneralized K-Omega) turbulence model offers a flexible, robust, general-purpose approach to RANS turbulence modeling. Introducing 2 videos: Part 1 provides background information on the model and a...
Postprocessing on Ansys EnSight
This video demonstrates exporting data from Fluent in EnSight Case Gold format, and it reviews the basic postprocessing capabilities of EnSight.
- The warning message is: “The maximum contact stiffness is too big. This may affect the accuracy of the results.” Why does large contact stiffness affect results accuracy?
- Contact Definitions in ANSYS Workbench Mechanical
- How to resolve “Error: Invalid Geometry”?
- After Workbench crashes, how can I recover the project from a .mechdb file?
- Model has a large number of contacts – how to reduce them?
- How to locate an element of a particular ID number in Mechanical?
- How to display the color of each body based on the material in Mechanical?
- Please explain the warning message “coefficient ratio exceeds 10e8” ?
- How to Connect Excel to Workbench
- How can I plot bodies colored by material property in Workbench?