General Mechanical

General Mechanical

Do loop for moving pressure load

    • HollyFart
      Subscriber

      Hello,


      I'm trying to implement a moving pressure load with a circle shaped area, which is moving along the Y direction via do loop.


      The pressure value is uniform and located within a circle shaped area.


      The moving direction is the Y axis. It should start at the global CS (0,0,0) and heads towards the positive Y axis.


      The load isn't moving, I don't have a clue why.


      The script is posted below due to size restrictions in the post.


      Best regards,


      HF

    • peteroznewman
      Subscriber

      ANSYS staff are not permitted to open attachments.


       


      total_time = 10                                  ! Total simulation time in seconds
      time_steps = 100 ! Total amount of steps
      time_inc = total_time/time_steps ! Time increment in seconds
      V_p = 0.01 ! m/s Load velocity
      Radius = 0.005 ! m Radius of the load area
      PV = 1E07 ! Pa Load value
      nsub,time_steps

      *do,I,1,time_steps,1
      time=I*time_inc
      Y_Local=V_p*time
      wpcs,-1,0 ! WP @ GLOBAL ORIGIN
      wpof,,Y_Local ! OFFSET WP ALONG ITS Y AXIS (i.e. provide current position of center of circle along Y axis)
      cswp,11,1 ! DEFINE Cylindrical COORDINATE SYSTEM @ WP ORIGIN
      esel,s,ename,,154 ! Select SURF154 elements
      sfed,all,,pres ! Delete old pressures if any
      nsle ! Select nodes attached to selected SURF elements
      nsel,r,loc,x,Radius ! Select nodes within radius of circle, 0.005m
      csys,0 ! Set CSYS back to global
      esln,r ! Select SURF elements attached to the nodes within the circle
      sfe,all,,pres,,PV ! Apply pressure based on your calculation at the said time.
      allsel,all
      outres,all,all

      *if,I,EQ,1,THEN
      /prep7 ! Enter into /prep7 as ET and ESURF are valid only in /PREP7
      et,100,154 ! Create a new element type for SURF154
      cmsel,s,surface1 ! Select nodes on a face via Face named selection
      type,100 ! Set the element type as 100
      esurf ! Create surface effect elements on the selected nodes
      allsel,all ! Select everything back
      /solu

      time=I*time_inc
      Y_Local=V_p*time

      wpcs,-1,0 ! WP @ GLOBAL ORIGIN
      wpof,,Y_Local ! OFFSET WP ALONG ITS Y AXIS (i.e. provide current position of center of circle along Y axis)
      cswp,11,1 ! DEFINE Cylindrical COORDINATE SYSTEM @ WP ORIGIN
      esel,s,ename,,154 ! Select SURF154 elements
      sfed,all,,pres ! Delete old pressures if any
      nsle ! Select nodes attached to selected SURF elements
      nsel,r,loc,x,Radius ! Select nodes within radius of circle, 0.005m
      csys,0 ! Set CSYS back to global
      esln,r ! Select SURF elements attached to the nodes within the circle
      sfe,all,,pres,,PV ! Apply pressure based on your calculation at the said time.
      allsel,all
      outres,all,all

      *else
      time=I*time_inc
      Y_Local=V_p*time

      wpcs,-1,0 ! WP @ GLOBAL ORIGIN
      wpof,,Y_Local ! OFFSET WP ALONG ITS Y AXIS (i.e. provide current position of center of circle along Y axis)
      cswp,11,1 ! DEFINE Cylindrical COORDINATE SYSTEM @ WP ORIGIN
      esel,s,ename,,154 ! Select SURF154 elements
      sfed,all,,pres ! Delete old pressures if any
      nsle ! Select nodes attached to selected SURF elements
      nsel,r,loc,x,Radius ! Select nodes within radius of circle, 0.005m
      csys,0 ! Set CSYS back to global
      esln,r ! Select SURF elements attached to the nodes within the circle
      sfe,all,,pres,,PV ! Apply pressure based on your calculation at the said time.
      allsel,all
      outres,all,all
      *endif

      *enddo
    • peteroznewman
      Subscriber

    • HollyFart
      Subscriber

      Model


      This is the model sketch

    • HollyFart
      Subscriber

      And the used script:



      total_time = 10                                  ! Total simulation time in seconds
      time_steps = 100 ! Total amount of steps
      time_inc = total_time/time_steps ! Time increment in seconds
      V_p = 0.01 ! m/s Load velocity
      Radius = 0.005 ! m Radius of the load area
      PV = 1E07 ! Pa Load value
      nsub,time_steps

      *do,I,1,time_steps,1
      time=I*time_inc
      Y_Local=V_p*time
      wpcs,-1,0 ! WP @ GLOBAL ORIGIN
      wpof,,Y_Local ! OFFSET WP ALONG ITS Y AXIS (i.e. provide current position of center of circle along Y axis)
      cswp,11,1 ! DEFINE Cylindrical COORDINATE SYSTEM @ WP ORIGIN
      esel,s,ename,,154 ! Select SURF154 elements
      sfed,all,,pres ! Delete old pressures if any
      nsle ! Select nodes attached to selected SURF elements
      nsel,r,loc,x,Radius ! Select nodes within radius of circle, 0.005m
      csys,0 ! Set CSYS back to global
      esln,r ! Select SURF elements attached to the nodes within the circle
      sfe,all,,pres,,PV ! Apply pressure based on your calculation at the said time.
      allsel,all
      outres,all,all

      *if,I,EQ,1,THEN
      /prep7 ! Enter into /prep7 as ET and ESURF are valid only in /PREP7
      et,100,154 ! Create a new element type for SURF154
      cmsel,s,surface1 ! Select nodes on a face via Face named selection
      type,100 ! Set the element type as 100
      esurf ! Create surface effect elements on the selected nodes
      allsel,all ! Select everything back
      /solu

      time=I*time_inc
      Y_Local=V_p*time

      wpcs,-1,0 ! WP @ GLOBAL ORIGIN
      wpof,,Y_Local ! OFFSET WP ALONG ITS Y AXIS (i.e. provide current position of center of circle along Y axis)
      cswp,11,1 ! DEFINE Cylindrical COORDINATE SYSTEM @ WP ORIGIN
      esel,s,ename,,154 ! Select SURF154 elements
      sfed,all,,pres ! Delete old pressures if any
      nsle ! Select nodes attached to selected SURF elements
      nsel,r,loc,x,Radius ! Select nodes within radius of circle, 0.005m
      csys,0 ! Set CSYS back to global
      esln,r ! Select SURF elements attached to the nodes within the circle
      sfe,all,,pres,,PV ! Apply pressure based on your calculation at the said time.
      allsel,all
      outres,all,all

      *else
      time=I*time_inc
      Y_Local=V_p*time

      wpcs,-1,0 ! WP @ GLOBAL ORIGIN
      wpof,,Y_Local ! OFFSET WP ALONG ITS Y AXIS (i.e. provide current position of center of circle along Y axis)
      cswp,11,1 ! DEFINE Cylindrical COORDINATE SYSTEM @ WP ORIGIN
      esel,s,ename,,154 ! Select SURF154 elements
      sfed,all,,pres ! Delete old pressures if any
      nsle ! Select nodes attached to selected SURF elements
      nsel,r,loc,x,Radius ! Select nodes within radius of circle, 0.005m
      csys,0 ! Set CSYS back to global
      esln,r ! Select SURF elements attached to the nodes within the circle
      sfe,all,,pres,,PV ! Apply pressure based on your calculation at the said time.
      allsel,all
      outres,all,all
      *endif

      *enddo

Viewing 4 reply threads
  • You must be logged in to reply to this topic.