Skip to main content

Need help in executing ANSYS subroutine userpr

Submitted by samueltcw on

Dear all

I need help in executing ANSYS user programmable feature (UPF), specifically subroutine userpr (changing element pressure information) for my 2D model. I have read the manual but don't understand the subroutine program structure (attached below). Can someone kindly explain how can I activate and run the subroutine?

Thanks,

Samuel

"Subroutine Userpr text file":

*deck,userpr         parallel            user                         pck

      subroutine userpr (ielc,elem,time,ndat,dat)

c *** primary function:    change element pressure information.

c         *** copyright(c) 2006 SAS IP, Inc.  All rights reserved.

c         *** ansys, inc.

c         in order to activate this user programmable feature,

c         the user must enter the 'usrcal,userpr' command.

c         this routine is called at each substep of each load step for which

c         pressures are used. it is called for each equilibrium iteration.

c         it is called once per element.

c         the call to get the standard ansys input pressures is made just before

c         entering this routine.

c     input arguments:

c        variable (typ,siz,intent)    description

c        ielc   (int,ar(IELCSZ),in) - array of element type characteristics

c        elem     (int,sc,in)       - element number for operation.

c        time     (dp,sc,in)        - time of current substep

c        ndat     (int,sc,in)       - number of pressure items for this element

c        dat      (dp,ar(ndat,2),inout) - the element pressure vector

c                                      (has input values for each corner

c                                      of each face)



c     output arguments:

c        variable (typ,siz,intent)    description

c        dat      (dp,ar(ndat,2),inout) - the element pressure vector

c                                      (defines input values for each corner

c                                      of each face)

c                                      dat(1:ndat,1) - real pressures

c                                      dat(1:ndat,2) - complex pressures

c                                                      (surface elements only)



c        the input array  dat  may be used in one of three ways:

c          1.  it may be simply passed thru

c          2.  it may be used as a flag(e.g. if dat(1) = -3.0, use

c                 a certain set of logic)

c          3.  it may be completely ignored and instead defined with new logic

#include "impcom.inc"

#include "echprm.inc"

#include "ansysdef.inc"

       external erhandler, FaceNodeList

    

       external elmget,ndgall

       integer  elmget,ndgall

      integer elem,ielc(IELCSZ),ndat,

     x i,j,iface,num,nodes(20),inode(8),numnd,elmdat(EL_DIM)

      double precision time, dat(ndat,2),

     x xyz(6)

 

c     ***** demonstration coding  ***

      numnd = elmget (elem,elmdat(1),nodes(1))

c     --- keep the analyzer happy

      numnd = numnd

c     **** numnd = number of nodes

c     **** nodes = vector of node numbers

      do  iface = 1,ielc(NMPRES)

c        **** given element number and a face, get the number of nodes

c        ***   on that face, and the numbers of those nodes by

c        ***   using FaceNodeList:

         call FaceNodeList (iface,ielc(1),nodes(1),num,inode(1))

         do j = 1,num

c           **** given a node number, get the coordinates using ndgall

c           **** input - node number, output = coordinates and angles:

            i = ndgall (inode(j),xyz(1))

            i = i

         enddo

      enddo

      return

      end