LS Dyna

LS Dyna

Topics related to LS-DYNA, Autodyn, Explicit STR and more.

Finding data obtained from Autodyn user subroutine

    • Conorryan98
      Subscriber

      Hi there,

      I implemented the EXEDIT3 example thats found in the ANSYS Autodyn user subroutines guide. It stores the maximum momentum over time for all cells in the problem. I built the solution in Microsft Visual Studio 2017. It gave me 219 warnings but 0 errors...the last line i got was "Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped".

    • Chris Quan
      Ansys Employee
      The user subroutine EXEDIT3 in the Autodyn User Subroutine Tutorial uses VAR01 and VAR02 to store the maximum momentum calculated by the user subroutine and its associated time.
      To plot VAR01 & VAR02 in Autodyn GUI using Contour Plot or set them as Time History variables for History Plot, you need to activate these two variables in Autodyn GUI before running the model.
      You need to click on User Variables at the left navigational bar in Autodyn GUI to Add and Activate the variables VAR01 & VAR02. Make sure Restart is checked so these variables are stored for restart analysis. See attached picture below.


      You can also rename the variable, for example, VAR.1 to Momentum. See attached picture below. Thus, for plotting purpose, Autodyn will show its name as Momentum in Contour Plot and Time History Plot. However, internally the name doesn't change so you still need to refer it to VAR01 in the user subroutine.



    • Conorryan98
      Subscriber
      Hi there
      Thank for the reply. Unfortunately when I do this I still don't see any results.

      For the contour plot I don't get any results for VAR.1 and VAR.2 (see photos).

      I also don't have any options to plot this data in the time history plot.
      Do you think the warnings I'm getting in my Build log are affecting the results (in original post)

      Thanks
      C
    • Chris Quan
      Ansys Employee
      The user subroutine EXEDIT3 in the Tutorial is created for Lagrange parts, not for other parts such as SPH particles.
      Make sure the variables VAR01 & VAR02 are selected in Output. See attached pictures below:







    • Conorryan98
      Subscriber
      okay thank you. The EXEDIT tutorial (2D) seems to be working when I use it with SPH. Is it just the 3D one that doesn't work with SPH?
      I have modified the EXEDIT example subroutine to find minimum X-velocity of the particles. I would like to extract the negative values of all the cells which have a negative x-velocity. In picture 2, this is all the particles which move in the left direction. The contouring is in x-velocity. I have tried to create a file called mytable.txt which writes this data so that I can see it, but I can't seem to figure out where to put it in the code. Eventually I would also like to add cell mass so that I can extract each node's x-momentum. Any help would be greatly appreciated. Thanks.



      SUBROUTINE EXEDIT

      ! ************************************************************************

      ! THIS IS A USER SUPPLIED SUBROUTINE WHICH CAN BE USED TO PROVIDE
      ! SPECIAL CUSTOM EDITING. THE FREQUENCY AT WHICH THIS SUBROUTINE
      ! IS CALLED IS DEFINED THROUGH INPUT (GLOBAL-EDIT-USER). WHEN
      ! REQUESTED, IT IS CALLED BY THE EDIT PROCESSOR AT THE END OF A
      ! COMPUTATIONAL CYCLE. THE ROUTINE IS CALLED BEFORE ANY OTHER
      ! TYPES OF STANDARD EDITS ARE CALLED FOR THAT CYCLE (EG. PRINT ! SAVE, HISTORY, DISPLAY, ETC), SO IT MAY ALSO BE USED TO SET UP
      ! DATA TO BE PROCESSED BY OTHER EDIT TYPES.

      ! ************************************************************************

      USE mdgrid
      USE ranges
      USE kindef
      USE cycvar
      USE wrapup
      USE subdef

      IMPLICIT NONE

      INTEGER (INT4) ::I,J,NS,IJK
      REAL (REAL8)::X_VEL

      ! ************************************************************************

      ! THIS SUBROUTINE ATTAINS Minimum X Velocity FOR EACH CELL (2D)
      !
      !VAR01ARRAY STORING Minimum X Velocity
      !VAR02ARRAY STORING TIME WHEN Minimum X Velocity OCCURS

      ! ************************************************************************

      OPEN(99,FILE='mytable.txt')
      write (99,*)'X-Vel'


      ! INITIALIZATION OF ARRAYS
      IF (NCYCLE == 1) THEN
      ! LOOP OVER ALL PARTS
      DO NS = 1, NUMSUB

      NSUB = NS
      CALL GETSUB
      ! LOOP OVER ALL CELLS
      DO I = 1,IMAX
      DO J = 1,JMAX
      IJK= IJSET(I,J)
      VAR01(IJK)= BIG! BIG = 1.01E20_real8
      VAR02(IJK)= BIG
      ! END LOOP ON CELLS
      END DO
      END DO

      ! END LOOP ON PARTS
      END DO
      END IF

      ! GET Minimum X Velocity
      ! LOOP OVER ALL PARTS
      IF (NCYCLE > 1) THEN
      DO NS = 1, NUMSUB !NUMSUB = Number of Parts in problem
      IF (NS/=NSUB) THEN !NSUB = Current Part number /= not equals "If 1 does not equal the current part number, then Current Part number is 1?
      NSUB = NS
      CALL GETSUB
      END IF

      ! LOOP OVER ALL CELLS
      DO I = 1,IMAX !From I=1 to I=MAX IMAX = Maximum I-index for current Part
      DO J = 1,JMAX !From J=1 to J=MAX

      ! GET MAXIMUM X Velocity FOR EACH CELL
      IJK = IJSET(I,J)
      X_VEL = UXN(IJK)
      IF(X_VEL <= VAR01(IJK)) THEN
      VAR01(IJK) = X_VEL
      VAR02(IJK) = TIME
      IF (VAR01(IJK) < 0) THEN
      VAR03(IJK) = VAR01(IJK)! If value of VAR01(IJK) is less than 0, it is equal to VAR03(IJK)
      END IF
      END IF
      ! END LOOP ON CELLS
      END DO
      END DO

      ! END LOOP ON PARTS
      END DO

      END IF
      RETURN

      END SUBROUTINE EXEDIT
    • Conorryan98
      Subscriber
      I resolved the issue thanks
    • Chris Quan
      Ansys Employee
      For 3D SPH particles, you may need different approach to access the particle variables. Please review the Autodyn User Subroutine Tutorial carefully.
Viewing 6 reply threads
  • The topic ‘Finding data obtained from Autodyn user subroutine’ is closed to new replies.