- #1

Abhisheko07

- 5

- 0

- TL;DR Summary
- Can anyone help me figure out what is going wrong?

I have checked the program several times the program is running but the graphs I am getting is not what I was accepting soon one of the variables approaches zero I don't know why is it happening. The program I have made is below and it's in the FORTRAN language. If anyone knows Fortran can they please help me it's really very important for my project work?

These are the four equations I have used (actually they are two 2nd order ordinary differential equation but i have to convert it into four equations to do the programming)

if anyone finds anything please help me

Fortran:

```
implicit real*8(a-h,o-z)
real*8 m,l
ti=0
tf=1000
dt=0.01
n=(tf-ti)/dt
! initial values
t1=0.5
r=2.0
td=0.3
p=1.0
l=3.0
m=2.0
t=ti
open(1,file='elast1.dat',status='unknown')
open(2,file='elast2.dat',status='unknown')
open(3,file='elast3.dat',status='unknown')
!starting the loop
do i=1,n
write(1,*)t,t1,td
write(2,*)t,r,p
write(3,*)t,t1,r
fa=f(t1,r,td,p,m,l)*dt
f1a=f1(td)*dt
ea=e(t1,r,td,p,m,l)*dt
e1a=e1(p)*dt
fb=f(t1+0.5*f1a,r+0.5*e1a,td+0.5*fa,p+0.5*ea,m,l)*dt
f1b=f1(td+0.5*fa)*dt
eb=e(t1+0.5*f1a,r+0.5*e1a,td+0.5*fa,p+0.5*ea,m,l)*dt
e1b=e1(p+0.5*ea)*dt
fc=f(t1+0.5*f1b,r+0.5*e1b,td+0.5*fb,p+0.5*eb,m,l)*dt
f1c=f1(td+0.5*fb)*dt
ec=e(t1+0.5*f1b,r+0.5*e1b,td+0.5*fb,p+0.5*eb,m,l)*dt
e1c=e1(p+0.5*eb)*dt
fd=f(t1+f1c,r+e1c,td+fc,p+ec,m,l)*dt
f1d=f1(td+fc)*dt
ed=f(t1+f1c,r+e1c,td+fc,p+ec,m,l)*dt
e1d=e1(p+ec)*dt
td=td+(fa/6.0)+(fb/3.0)+(fc/3.0)+(fd/6.0)
p=p+(ea/6.0)+(eb/3.0)+(ec/3.0)+(ed/6.0)
t1=t1+(f1a/6.0)+(f1b/3.0)+(f1c/3.0)+(f1d/6.0)
r=r+(e1a/6.0)+(e1b/3.0)+(e1c/3.0)+(e1d/6.0)
t=t+dt
enddo
close(1)
close(2)
end !Function (definition of theta double dot)
function f(t1,r,td,p,m,l)
implicit real*8(a-h,o-z)
real*8 m,l
g=9.8
xa=-(g*dsin(t1))/(l+r)
xb=-(2*p*td)/(l+r)
f=xa+xb
return
end
!Function (definition of theta dot)
function f1(td)
implicit real*8(a-h,o-z)
f1=td
return
end
! Function (definition of r double dot)
function e(t1,r,td,p,m,l)
implicit real*8(a-h,o-z)
real*8 m,l
g=9.8
k=10.0
xc=-(k*r)/m
xd=g*dcos(t1)
xe=(l+r)*td**2
e=cx+xd+xe
return
end
! Function (definition of r dot)
function e1(p)
implicit real*8(a-h,o-z)
e1=p
end
```

These are the four equations I have used (actually they are two 2nd order ordinary differential equation but i have to convert it into four equations to do the programming)

if anyone finds anything please help me

Last edited by a moderator: