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
SUBROUTINE EXEDIT3
USE kindef, ONLY: INT4
USE fildef, ONLY : FDPRNT, FNID
USE mdpp , ONLY : MYTASK
IMPLICIT NONEINTEGER(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
END DO
DO J = 256, 1, -1
IF (FDPRNT(J:J)/=’ ‘) EXIT
END DO! Include the task number in the log file
CALL CONITC (MYTASK,TEXT5)
DO K = 2,5
IF (TEXT5(K:K)==’$’) EXIT
KK = K
END DOFNAME = FDPRNT(1:J)//’/’//FNID(1:i)//’_OUTPUT’//TEXT5(2:KK)//’.log’
NUNIT = 78 ! HOPEFULLY FREE UNITOPEN(UNIT=NUNIT,NAME=FNAME,FORM=’FORMATTED’, IOSTAT=IOS)
WRITE (NUNIT,*,IOSTAT=IOS) ‘Hello World!’
CLOSE (NUNIT)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.
- How to deal with “”Problem terminated — energy error too large””?”
- How do I request ANSYS Mechanical to use more number of cores for solution?
- Contact Definitions in ANSYS Workbench Mechanical
- The LS-DYNA equivalent of *MODEL_CHANGE card (in ABAQUS). Which keywords can be used to introduce(activate)/delete(deactivate) elements in the middle of a calculation (at user-specific time/load steps).
- How to restore the corrupted project in ANSYS Workbench?
- There is a unit systems mismatch between the environments involved in the solution.
- How to resolve “Error: Invalid Geometry”?
- After Workbench crashes, how can I recover the project from a .mechdb file?
- How to transfer a material model(s) from one Analysis system to another within Workbench?
- Model has a large number of contacts – how to reduce them?
© 2024 Copyright ANSYS, Inc. All rights reserved.