What Should Be the Values of Ax and Ay in This Fortran 90 Code?

  • Context: Fortran 
  • Thread starter Thread starter jhosamelly
  • Start date Start date
  • Tags Tags
    Fortran Machine
Click For Summary
SUMMARY

The discussion focuses on determining the values of Ax and Ay in a Fortran 90 program that simulates motion under gravitational acceleration. The user is advised to use the formula a = -r/r^3 in component form for calculating Ax and Ay. Additionally, it is noted that the program lacks definitions for Nsteps and n, and the syntax for defining pi should be corrected to atan(1.0) for proper functionality. These adjustments are crucial for the program to execute correctly.

PREREQUISITES
  • Understanding of Fortran 90 programming syntax
  • Knowledge of numerical methods for simulating motion
  • Familiarity with gravitational acceleration calculations
  • Experience with defining variables and loops in Fortran
NEXT STEPS
  • Research how to define and initialize variables in Fortran 90
  • Learn about gravitational acceleration and its application in simulations
  • Explore the use of intrinsic functions in Fortran, specifically atan
  • Study the implementation of numerical integration methods for motion simulation
USEFUL FOR

This discussion is beneficial for Fortran developers, physics simulation programmers, and anyone interested in implementing motion dynamics in computational models.

jhosamelly
Messages
125
Reaction score
0
5by0hs.jpg


I have the code.
Code:
program star
implicit none
real (kind=8) :: x
integer :: i

dt=0.001
pi=4*(atan1.0)

do i=1, Nsteps
     t = n*dt
     !calculate acceleration
     ax= 
     ay=...
     !calculate values at next step
     vy=vy+ay*dt
     vx=vx+ax*dt
     x=x+vx*dt
     y=y+vy*dt
end do

print *, "vx= ", vx
     
end program star
What should I put as Ax and Ay??
 
Last edited:
Technology news on Phys.org
like the question says, use a = -r/r^3 in component form... you'll need to start the program with some initial x and y value.

I don't know fortran very well, but it looks like you haven't defined Nsteps or n. Also the syntax for defining pi looks dodgy.
 
Last edited:
atan is an intrinsic function.

atan(1.0) is proper syntax
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
14K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K