Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,000 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export OPENGL=1 | ||
|
||
ifndef REB_DIR | ||
ifneq ($(wildcard ../../../rebound/.*),) # Check for REBOUND in default location | ||
REB_DIR=../../../rebound | ||
endif | ||
ifneq ($(wildcard ../../../../rebound/.*),) # Check for REBOUNDx being inside REBOUND directory | ||
REB_DIR=../../../ | ||
endif | ||
endif | ||
ifndef REB_DIR # REBOUND is not in default location and REB_DIR is not set | ||
$(error REBOUNDx not in the same directory as REBOUND. To use a custom location, you Must set the REB_DIR environment variable for the path to your rebound directory, e.g., export REB_DIR=/Users/dtamayo/rebound. See reboundx.readthedocs.org) | ||
endif | ||
PROBLEMDIR=$(shell basename `dirname \`pwd\``)"/"$(shell basename `pwd`) | ||
|
||
include $(REB_DIR)/src/Makefile.defs | ||
|
||
REBX_DIR=../../ | ||
|
||
all: librebound.so libreboundx.so | ||
@echo "" | ||
@echo "Compiling problem file ..." | ||
$(CC) -I$(REBX_DIR)/src/ -I$(REB_DIR)/src/ -Wl,-rpath,./ $(OPT) $(PREDEF) problem.c -L. -lreboundx -lrebound $(LIB) -o rebound | ||
@echo "" | ||
@echo "Problem file compiled successfully." | ||
|
||
librebound.so: | ||
@echo "Compiling shared library librebound.so ..." | ||
$(MAKE) -C $(REB_DIR)/src/ | ||
@echo "Creating link for shared library librebound.so ..." | ||
@-rm -f librebound.so | ||
@ln -s $(REB_DIR)/src/librebound.so . | ||
|
||
libreboundx.so: | ||
@echo "Compiling shared library libreboundx.so ..." | ||
$(MAKE) -C $(REBX_DIR)/src/ | ||
@-rm -f libreboundx.so | ||
@ln -s $(REBX_DIR)/src/libreboundx.so . | ||
|
||
clean: | ||
@echo "Cleaning up shared library librebound.so ..." | ||
@-rm -f librebound.so | ||
$(MAKE) -C $(REB_DIR)/src/ clean | ||
@echo "Cleaning up shared library libreboundx.so ..." | ||
@-rm -f libreboundx.so | ||
$(MAKE) -C $(REBX_DIR)/src/ clean | ||
@echo "Cleaning up local directory ..." | ||
@-rm -vf rebound |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Inner disk edge. | ||
* | ||
* This example shows how to add an inner disk edge. | ||
*/ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include "rebound.h" | ||
#include "reboundx.h" | ||
#include "core.h" | ||
|
||
int main(int argc, char* argv[]){ | ||
struct reb_simulation* sim = reb_create_simulation(); | ||
/*sim units are ('yr', 'AU', 'Msun')*/ | ||
sim->G = 4*M_PI*M_PI; | ||
|
||
struct reb_particle star = {0}; | ||
star.m = 1.; | ||
reb_add(sim, star); | ||
|
||
double m = 0.00001; | ||
double a = 1; | ||
double e = 0; | ||
double inc = 0.; | ||
double Omega = 0.; | ||
double omega = 0.; | ||
double f = 0.; | ||
|
||
struct reb_particle p1 = reb_tools_orbit_to_particle(sim->G, star, m, a, e, inc, Omega, omega, f); | ||
reb_add(sim, p1); | ||
|
||
sim->dt = 0.002; //The period at inner disk edge divided by 20, for a disk edge location at 0.1 AU | ||
sim->integrator = REB_INTEGRATOR_WHFAST; | ||
|
||
struct rebx_extras* rebx = rebx_attach(sim); | ||
|
||
struct rebx_force* inner_edge = rebx_load_force(rebx, "inner_disk_edge"); | ||
rebx_set_param_double(rebx, &inner_edge->ap, "inner_disk_edge_position", 0.1); | ||
rebx_set_param_double(rebx, &inner_edge->ap, "disk_edge_width", 0.02); //Calculated using a scale height value of 0.03. See Pichierri et al. 2018 for the equation | ||
rebx_add_force(rebx, inner_edge); | ||
|
||
double tmax = 1.e4; | ||
rebx_set_param_double(rebx, &sim->particles[1].ap, "tau_a", -tmax); | ||
rebx_set_param_double(rebx, &sim->particles[1].ap, "tau_e", -tmax/100.); | ||
|
||
reb_integrate(sim, tmax); | ||
rebx_free(rebx); | ||
reb_free_simulation(sim); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export OPENGL=1 | ||
|
||
ifndef REB_DIR | ||
ifneq ($(wildcard ../../../rebound/.*),) # Check for REBOUND in default location | ||
REB_DIR=../../../rebound | ||
endif | ||
ifneq ($(wildcard ../../../../rebound/.*),) # Check for REBOUNDx being inside REBOUND directory | ||
REB_DIR=../../../ | ||
endif | ||
endif | ||
ifndef REB_DIR # REBOUND is not in default location and REB_DIR is not set | ||
$(error REBOUNDx not in the same directory as REBOUND. To use a custom location, you Must set the REB_DIR environment variable for the path to your rebound directory, e.g., export REB_DIR=/Users/dtamayo/rebound. See reboundx.readthedocs.org) | ||
endif | ||
PROBLEMDIR=$(shell basename `dirname \`pwd\``)"/"$(shell basename `pwd`) | ||
|
||
include $(REB_DIR)/src/Makefile.defs | ||
|
||
REBX_DIR=../../ | ||
|
||
all: librebound.so libreboundx.so | ||
@echo "" | ||
@echo "Compiling problem file ..." | ||
$(CC) -I$(REBX_DIR)/src/ -I$(REB_DIR)/src/ -Wl,-rpath,./ $(OPT) $(PREDEF) problem.c -L. -lreboundx -lrebound $(LIB) -o rebound | ||
@echo "" | ||
@echo "Problem file compiled successfully." | ||
|
||
librebound.so: | ||
@echo "Compiling shared library librebound.so ..." | ||
$(MAKE) -C $(REB_DIR)/src/ | ||
@echo "Creating link for shared library librebound.so ..." | ||
@-rm -f librebound.so | ||
@ln -s $(REB_DIR)/src/librebound.so . | ||
|
||
libreboundx.so: | ||
@echo "Compiling shared library libreboundx.so ..." | ||
$(MAKE) -C $(REBX_DIR)/src/ | ||
@-rm -f libreboundx.so | ||
@ln -s $(REBX_DIR)/src/libreboundx.so . | ||
|
||
clean: | ||
@echo "Cleaning up shared library librebound.so ..." | ||
@-rm -f librebound.so | ||
$(MAKE) -C $(REB_DIR)/src/ clean | ||
@echo "Cleaning up shared library libreboundx.so ..." | ||
@-rm -f libreboundx.so | ||
$(MAKE) -C $(REBX_DIR)/src/ clean | ||
@echo "Cleaning up local directory ..." | ||
@-rm -vf rebound |
Oops, something went wrong.