Comments (6)
Hi,
You should only be updating the accelerations in your custom routine. The REBOUND integration routines will then use the accelerations to update the positions and velocities. If you still don't get the correct behavior, I'm happy to take a look at it if you want to post your code!
from reboundx.
Hi,
The Mercury subroutine and the aforementioned paper require that additional velocity terms also be updated. Can REBOUND update velocities by ps[1].vx +=
as is done with acceleration?
Sure! If you need to see additional details, see my code here.
Thanks!
from reboundx.
So unless I'm misinterpreting something, this looks like a prescription for updating the positions and velocities of all the particles, x += dx/dt*dt, vx += dxdot/dt * dt etc. You would add this as an operator rather than an additional force. See our REBOUNDx paper on arxiv.
A different version of this is already implemented in REBOUNDx (modify_orbits_forces as a force and modify_orbits_direct as an operator). Do you need something about this implementation in particular? You can look at the migration and eccentricity damping examples in ipython_examples for how they work.
from reboundx.
I'm going to close this for now, but feel free to reopen if you have any follow-up questions!
from reboundx.
Thanks for the help! Using the operator proved a better approach.
A follow-up question. I successfully added my own effect by copying a version of modify_orbits_direct.c
. I would like to implement a time-dependent eccentricity, so I added const double t
to the static struct
and changed the operator to (for example) o.e += 0.5*cos(t/(*tau_e))
. In general, is this a correct approach for implementing time-dependence?
from reboundx.
Hi Luis,
Are you trying to enforce a specific e(t), or add a specific e(t) on top of whatever the eccentricity is doing due to other planets?
If the former, you can just put in the e(t) you want e.g., o.e = sin(omega * sim->t)
If the latter, you can do what's in modify_orbits_direct, which is just a simple euler step. o.e += omegacos(omegasim->t)*dt
In both cases you should probably use the simulation time sim->t rather than adding a const double t, and you should probably add a separate variable like omega rather than reusing tau_e, so that you (or others) could in principle use both effects at the same time. If it's just a one-off thing I guess it doesn't matter.
Note that in both cases it will not work with an adaptive timestep (IAS15) or Mercurius (which only allows forces). For IAS15 you can set sim.ri_ias15.epsilon = 0 to make it use a constant timestep sim.dt.
from reboundx.
Related Issues (20)
- Problem with the example: full version of yarkovsky_effect: Python 2.7 HOT 8
- Yarkovsky effect in Reboundx : question about the 'k' coefficient HOT 2
- Question additional forces HOT 5
- Signed int HOT 2
- Radiation forces blocked by particles HOT 3
- Need to attach reboundx.Extras instance to simulation before setting params. HOT 8
- Failed building editable for reboundx HOT 6
- Problem in installing REBOUND X HOT 7
- Errors compiling C examples HOT 13
- Question about documentation HOT 2
- implement machine independent math functions? HOT 1
- gr_source flag not working HOT 7
- librebound.cpython-39-x86_64-linux-gnu.so import error HOT 2
- REBOUNDx trouble with satellites HOT 2
- Confusing function name in "type_I_migration.c" HOT 14
- Python QuickStart Guide HOT 2
- reboundx install failed on my Macbook HOT 6
- "OSError: librebound.cpython-37m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory" when importing reboundx on Google Colab HOT 6
- REBOUNDx error: Force 'type_I_migration' not found in REBOUNDx library. HOT 5
- Setting beta via sim.particles[i].beta does not work? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reboundx.