RK4 Solver Issue: Shoot the Moon with C Program

  • Thread starter Thread starter Illuminati
  • Start date Start date
  • Tags Tags
    Rk4
Click For Summary
SUMMARY

The forum discussion centers on a 4th order Runge-Kutta (RK4) solver implemented in C for simulating a spacecraft's trajectory to "shoot the moon." The user reports issues with the RK4 implementation, leading to unexpected behavior in the spacecraft's orbit, which resembles a massed spring rather than a circular orbit. The user has provided a specific file, shoot_the_moon3.c, along with a .plt file for generating a .png output of the data. The problem may be related to an initial value problem in the RK4 setup.

PREREQUISITES
  • Understanding of 4th order Runge-Kutta methods
  • Proficiency in C programming language
  • Familiarity with numerical methods for solving ordinary differential equations (ODEs)
  • Knowledge of orbital mechanics and spacecraft trajectory simulation
NEXT STEPS
  • Review the implementation of the RK4 method in shoot_the_moon3.c
  • Investigate initial value problems in numerical simulations
  • Explore debugging techniques for C programs, particularly in numerical computations
  • Learn about visualizing simulation data using .plt files and generating .png outputs
USEFUL FOR

This discussion is beneficial for aerospace engineers, software developers working on simulation projects, and students studying numerical methods in physics or engineering.

Illuminati
Messages
5
Reaction score
0
Hey Folks,

So I've been making an 4th order Runge-Kutta program for finding a way to shoot the moon with a spacecraft . However for some reason the RK4 part of the program does not work and I cannot figure it out.

I've written it in C and attached the file. If someone who is more well versed in C could take a look at it and let me know what I'm screwing up I would be greatly appreciative.

Thanks!

Edit: I've attached a couple different methods to this post. If viewing try using shoot_the_moon3.c, it should have a working .plt file to output a .png of the data
 

Attachments

Last edited:
Technology news on Phys.org
I suppose I should add that the spacecraft is supposed to have some kind of circular orbit, instead it acts more like a massed spring

it might be an initial value problem
 

Similar threads

  • · Replies 65 ·
3
Replies
65
Views
9K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 22 ·
Replies
22
Views
5K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
3
Views
2K
  • · Replies 13 ·
Replies
13
Views
4K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 2 ·
Replies
2
Views
13K