Dear Ashish,

Thanks for your response. I want to apply a force that is a function of the instantaneous mass displacement, but, I couldn't find such a force defined in your code. I have copied my code below.

To put it in equations, I have m*x\ddot + k*x = f(**x**,t) not m*x\ddot + k*x = f(t).

I understand that applying a state dependent force requires to be able tap into output at every step and extract displacement/velocity at every instant and redefine the force on nodes depending on these vales. I thought my code should do the same, but, as mentioned in my previous posts results are not as expected. Please help me understand the issue.

/title,Spring Mass Controller force

FINISH

/Clear

/PREP7

ET,1,MASS21

!*

ET,2,COMBIN14

!*

R,1,0.001, , , , ,

R,2,1,0,0, , ,50,

!Defining Material properties (Not needed for this problem though)

MPTEMP,1,0

MPDATA,EX,1,,210000

MPDATA,DENS,1,,7800E-12

MPDATA,PRXY,1,,0.3

!Defining two nodes

n,1,,,

n,2,50,,

! MODEL Definition

!Defining element attributes before creating elements

TYPE, 1

MAT, 1

REAL, 1

ESYS, 0

!Creating mass element at node 2

E,2, !Element 1 definition

!Defining element attributes before creating elements

TYPE,2

MAT,1

REAL,2

ESYS,0

!Creating spring between node1 and node2

E,1,2,

!Defining boundary condition (Fix node1)

D,1,all,all

! Setup analysis

/solu

antype,transient

trnopt,full

time,0.001

solve

*DO,t,0.01,3,0.01 !Begining of DO loop

TIME,t !Time at the end of load step

*IF,t,LT,0.1,THEN, !Begining of IF condition

F,2,FX,0

*ELSEIF,t,EQ,0.1,THEN

F,2,FX,2 ! A 2N force applied at 0.1s

*ELSEIF,t,GT,0.1,AND,t,LT,1

F,2,FX,0 ! Zero external force

*ELSE

*GET,error,NODE,2,U,X ! Obtain the deformation of node2

F,2,FX,error*0.5 ! Applying the force

*ENDIF !End of IF Condition

SOLVE

*ENDDO !END of DO loop

!Post processing

/post26

nsol,3,2,u,x,

plvar,3

Regards,

Kumara