<p>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!</p>

CC BY-SA 3.0
2014-12-19T07:46:16.090Z
This question appears to be off-topic because it is about programming.
ProfRob
CC BY-SA 3.0
2014-11-24T08:17:34.320Z
Your 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
CC BY-SA 3.0
2014-11-24T15:03:59.467Z
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](http://stackoverflow.com/) may be able to give you more help than Astronomy.
Mitch Goshorn
CC BY-SA 3.0
2014-11-24T21:56:15.613Z
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
<stellar-evolution>
stellar evolution fortran code-runge kutta mass step from center to fitting point
tzakara
# stellar evolution fortran code-runge kutta mass step from center to fitting point

(Asked by: username_0 on 2014-11-23)

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!

**Tags:** stellar-evolution

> **Comments:**
> **username_2**: Your 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.  
> **username_3**: Agreed with username_2, the question doesn't seem very clear. If this question is really more set in troubleshooting an error in Fortran, [Stack Overflow](http://stackoverflow.com/) may be able to give you more help than Astronomy.  
> **username_4**: 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.  
> **username_1**: This question appears to be off-topic because it is about programming.  

---

## 0 answers

