You are on page 1of 10

Hands-on #1

User-defined Velocity Boundary Condition


This example shows you how to implement a user-defined sinusoidal X-velocity
boundary condition and apply it on a simple problem.
The sinusoidal X-velocity is given as: Ux = A sin t, where = 2/T

J2

I501

I1

(0, 0)

(1.5, 0.5)

J1

1.1

Go to the directory C:\Documents and Settings\username\My Documents\


AUTODYN user_subroutines and click on ad_usrsub.sln.

Visual Studio will open the solution file. You then proceed to Solution Explorer, and
double click usrsub2.f90.

1.2

Click on

and search for subroutine EXVEL.

Visual Studio will list lines in the solution that matches your search criteria. Pick the
result that indicates SUBROUTINE EXVEL.

1.3

Include module cycvar and declare variables A, OMEGA and T

SUBROUTINE EXVEL (NAMVEL,RBC,K,XB,YB,UXT,UYT)


USE
USE
USE
USE
USE

kindef
bnddef
ijknow
wrapup
cycvar

IMPLICIT NONE
INTEGER (INT4) ::
K
REAL (REAL8)
::
UXT,
UYT,
REAL (REAL8), DIMENSION(5) :: RBC
REAL (REAL8)

::

XB,

YB

A, OMEGA, T

CHARACTER (LEN=10) :: NAMVEL


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

THIS IS A USER SUPPLIED SUBROUTINE WHICH APPLIES VELOCITY


CONSTRAINTS TO NODES. THE ROUTINE IS CALLED ONCE PER CYCLE FOR
EACH NODE ASSIGNED WITH THE USER VELOCITY CONSTRAINT THROUGH
INPUT. THE USER VELOCITY CONSTRAINT IS USED WHEN THE X AND Y
VELOCITY CONSTRAINTS CANNOT BE DESCRIBED BY A COMBINATION OF
THE STANDARD VELOCITY CONSTRAINTS AVAILABLE AUTODYN

! INPUT PARAMETERS
!
!

NAMVEL
INPUT

BOUNDARY CONDITION NAME (SUPPLIED BY USER DURING

RBC(1-5) INPUT PARAMETERS FOR BOUNDARY CONDITION

1.4

Implement the sinusoidal X-velocity boundary condition

! MODULE
!
!
!

'CYCVAR'
NCYCLE - CURRENT CYCLE NUMBER
TIME
- CURRENT TIME
DLTH
- TIME STEP FOR CURRENT CYCLE

!***************************************************************
! TEMPORARY ERROR MESSAGE - REPLACE WITH YOUR OWN CODE
!CALL USR_MESSAG ('$User subroutine EXVEL missing$')
!NSWRAP = 9

Deactivate
these lines

! Name of velocity BC is essential for identification (i.e. > 1


! velocity BCs) and for plotting.
IF (NAMVEL=="SINE") THEN
!Read A and T from AUTODYN GUI
T=RBC(1)
A=RBC(2)

Insert the
following lines

OMEGA=TWO*PI/T
UXT=A*SIN(OMEGA*TIME)
ENDIF
RETURN
END SUBROUTINE EXVEL

The logic for the sinusoidal X-velocity boundary condition is available in


hands_on_1A.txt. You have the option to paste the logic from this file onto the text
editor.

1.5

Proceed to build the solution with Build Build Solution. If the subroutine has
been implemented as described, Visual Studio will output the following: Build: 1
succeeded, 0 failed, 0 skipped

Proceed to Debug Start without Debugging

1.6

Click
at the Tool Bar to open existing problem dialog window and select
velocity_sine_bc_0.ad.

Now, define two boundary conditions to apply motion constraints for uniaxial strain
and a user-defined boundary condition. To define the motion constraint for uniaxial
strain, select Boundaries on the Navigation Bar and then press New in the Dialog
Panel. In the dialog window that appears, Enter YVELZERO for the Name, select
Velocity for the Type, Y-velocity (Constant) for the Sub option and leave the
velocity field zero. Repeat this procedure to define the user-defined boundary
condition. Name it SINE, select Velocity for the Type, X, Y, R-velocity (User
EXVEL) for the Sub option, 1.0E-4 for the Parameter RBC(1), and 100 for the
Parameter RBC(2).

1.7

Now, apply the two boundary conditions. The XVELZERO boundary condition is
applied to all nodes (it allows no motion in the Y direction). The SINE boundary
condition is applied to the left boundary of the rod.
Press Boundary in the Parts Dialog Panel and then Block. In the window that
appears accept all default values to apply the velocity boundary condition. To apply
the user-defined boundary, press I Line. In the window that appears, select SINE for
Boundary name and accept the default values for the range.

(If you want to check that the boundary conditions have been applied correctly check
Boundaries under Additional components in the Plots Dialog Panel)

1.8

Now, press Controls on the Navigation Bar. In the Controls dialog panel set the
cycle limit to 10,000 and the time limit to 2.7E-4. This duration will be sufficient to
allow the gauges to capture the sinusoidal particle velocity in the rod.
Then press Output on the Navigation Bar. In the dialog panel, request Save files to
be written every 9.0E-5 ms

Press
on the Tool bar and load the settings file velocity_sine_bc.set to obtain
the following view (i.e. contour of the absolute velocity)

Press
on the Tool Bar to save your data and then press Run to compute the
problem. The calculation runs 690 cycles to completion, computing in less than a
minute.

1.9

Finally, plot X-velocity against time at the five gauges defined in the model.
Press History on the Navigation Bar and then press Single Variable Plots in the
Dialog Panel. In the dialog window that appears, select all five gauges and select
XVELOCITY as the Y variable. Press Apply to view the plots.

1.10

You might also like