I am trying to integrate the four stellar model equations from the core to a fitting point and from the surface to the fitting point ($x_f$). When I start the outward integration, however, I have to use a huge mass shell step $dx$ where $x_1=dx$ too and the callling routine has the form $rk4(dx,x,y,dy)$(Runge-Kutta 4th order with mass step $dx,x$ core). As a result I am getting a bus error. I do not know what is the appropriate step since if we consider that I want to integrate from $x_1$ to $x_f=10^{33}$, it means that I need a huge step $dx$ to make it work. I have tried it in many different ways and I cannot figure out how to properly do that and get a result when dealing with such huge numbers. If you have any ideas I would appreciate it, since I am stuck! Thank you very much!
Asked
Active
Viewed 220 times
4
-
1Your question isn't particularly clear, nor am I sure that it's suitable for Astro.SE. But even so, have you rescaled or reformulated the variables? Most stellar evolution codes actually use things that vary stably as you approach the centre. e.g. $m^{2/3}$ instead of $m$. In addition, state variables are usually treated in logarithmic form. i.e. the codes track $\log T$ and $\log P$ rather than $T$ and $P$. The pressure in particular may vary by a factor of about $10^12$ in a solar model. – Warrick Nov 24 '14 at 08:17
-
Agreed with Warrick, the question doesn't seem very clear. If this question is really more set in troubleshooting an error in Fortran, Stack Overflow may be able to give you more help than Astronomy. – Mitch Goshorn Nov 24 '14 at 15:03
-
You specifically mentioned you are getting a bus error. A bus error almost always means you as a programmer made a big mistake; your code is attempting to access or update memory that does not belong to the program. This has nothing to do with how you encoded the laws of physics. The problem lies instead with how you encoded your code. Learn to use and to love your debugger. – David Hammen Nov 24 '14 at 21:56
-
4This question appears to be off-topic because it is about programming. – ProfRob Dec 19 '14 at 07:46