Skip to content
Snippets Groups Projects
Commit 3c472e56 authored by David Hendriks's avatar David Hendriks
Browse files

small changes to the examples file

parent 51c87882
No related branches found
No related tags found
No related merge requests found
...@@ -9,28 +9,20 @@ from binarycpython.utils.custom_logging_functions import ( ...@@ -9,28 +9,20 @@ from binarycpython.utils.custom_logging_functions import (
from binarycpython.utils.grid import Population from binarycpython.utils.grid import Population
################################################# #################################################
# File containing examples for the custom logging
# I'll put several logging snippets for different purposes in this file
# #
################################################# #################################################
# no logging set. # no logging set.
pop = Population() pop = Population()
pop.set( pop.set(M_1=10, M_2=10, separation=0, orbital_period=4530, eccentricity=0, metallicity=0.02, max_evolution_time=15000)
M_1=10,
M_2=10,
separation=0,
orbital_period=4530,
eccentricity=0,
metallicity=0.02,
max_evolution_time=15000,
)
out = pop.evolve_single() out = pop.evolve_single()
print(out) print(out)
################################################# #################################################
# Example logging snippet for logging # Example logging snippet for logging
pop.set( pop.set(C_logging_code="""
C_logging_code="""
if(stardata->star[0].stellar_type>=MS) if(stardata->star[0].stellar_type>=MS)
{ {
if (stardata->model.time < stardata->model.max_evolution_time) if (stardata->model.time < stardata->model.max_evolution_time)
...@@ -54,25 +46,15 @@ pop.set( ...@@ -54,25 +46,15 @@ pop.set(
/* Kill the simulation to save time */ /* Kill the simulation to save time */
//stardata->model.max_evolution_time = stardata->model.time - stardata->model.dtm; //stardata->model.max_evolution_time = stardata->model.time - stardata->model.dtm;
}; };
""" """)
)
out = pop.evolve_single() out = pop.evolve_single()
print(out) print(out)
################################################# #################################################
# Example logging snippet for checking whether the system becomes a NS, and stop the evolution if so. # Example logging snippet for checking whether the system becomes a NS, and stop the evolution if so.
pop.set( pop.set(M_1=100, M_2=10, separation=0, orbital_period=400530, eccentricity=0, metallicity=0.002, max_evolution_time=15000)
M_1=100, pop.set(C_logging_code="""
M_2=10,
separation=0,
orbital_period=400530,
eccentricity=0,
metallicity=0.002,
max_evolution_time=15000,
)
pop.set(
C_logging_code="""
if(stardata->star[0].stellar_type>=NS) if(stardata->star[0].stellar_type>=NS)
{ {
if (stardata->model.time < stardata->model.max_evolution_time) if (stardata->model.time < stardata->model.max_evolution_time)
...@@ -94,13 +76,12 @@ pop.set( ...@@ -94,13 +76,12 @@ pop.set(
/* Kill the simulation to save time */ /* Kill the simulation to save time */
stardata->model.max_evolution_time = stardata->model.time - stardata->model.dtm; stardata->model.max_evolution_time = stardata->model.time - stardata->model.dtm;
}; };
""" """)
)
out = pop.evolve_single() out = pop.evolve_single()
# TODO: add function that shows a # TODO: add function that shows a
# TODO: add function for compact object mergers # TODO: add function for compact object mergers
# TODO: add function # TODO: add function
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment