https://github.com/tboudreaux/PolytropicStellarModel
Simple Polytropic Stellar Model
https://github.com/tboudreaux/PolytropicStellarModel
astrophysics numerical-integration stellar
Last synced: over 1 year ago
JSON representation
Simple Polytropic Stellar Model
- Host: GitHub
- URL: https://github.com/tboudreaux/PolytropicStellarModel
- Owner: tboudreaux
- Created: 2020-01-21T21:59:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-23T15:23:58.000Z (over 3 years ago)
- Last Synced: 2023-08-13T14:22:25.748Z (almost 3 years ago)
- Topics: astrophysics, numerical-integration, stellar
- Language: TeX
- Homepage:
- Size: 6.54 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
- License: LICENSES
Awesome Lists containing this project
README
Polytrope Project Numerical Integrator
Thomas M. Boudreaux
===================
Compilation Instructions:
- To compile $ make
- There are two compile time arguemnts which may be set
- DATADIR will set where that data files are written to (will make the folder to)
- PSTANOT will determine if the output is also written to standard output
- This is in addition to dumping to a dat file which will always happen
- 0 to supress standard output
- 1 to print to standard output
- Examples of use
- $ make PSTANOT=1 DATADIR=results
- this will print to standard out and save binaries in a folder called results
- $ make
- this will use the default values of PSTANOT=0 and DATADIR=data
Run Time Instructions:
- there are two executable files, integrate-nonDegenerate and integrate-degenerate
- running the nonDegenerate file with integrate a polytrope
- running the degenerate model will integrate a white dwarf model
- To run $ ./integrate-[non][d/D]generate [n/theta_c] [h] [xi0] [xif] [itr]
n/theta_c[float] - polytroic index(non degenerate case)/central density (degenerate case)
h[float] - integration step size
xi0[float] - initial value of xi to start at
xif[float] - value of xi to integrate too
[itr[int]] - number of terms in power serise to use to approximation theta(xi=Xi0) only used in non degenerate case
Data File Format Specs:
- After running either executable a file will be saved to whatever data director was spesificed at compile
time, by default this is a directory called "data"
- That file will have the input polytropic index in it along with the either being degenerate or non degenerate
- The file has a header and a body
- The header is an set of ASCII key value pairs
- The body is a byte stream of c++ type doubles
- The file starts with ">> HEADER"
- The header continues until the line ">> BODY"
- After this line the next line is the byte stream
Data View Instructions:
- To generate graphs of the data:
- Use the included script
- $ python pyUtils/ViewCOutput.py
- the script can plot either one data file or multiple
- If plotting multiple the script can place them all on one figure
or break them out into seperate figures
- Command line options can be shown by running
- $ python pyUtils.py --help
- To Get the value of Xi1
- Use the uncluded script
- $ python getXi1.py
- Command line options can be shown by running
- $ python getXi1.py --help
- If you want to generate the figures of all the dataruns on seperate plots use something like from the pyUtils directory
- $ ls data/*.dat | awk '{split($0,a,"/"); print a[2]}' | xargs -I{} ./ViewCOutput.py data/{} -o Figures/Multi_{}.pdf
Physical Scaling quantities:
- To generate the physical scalings from xi, theta, and dtheta use the python script
- $ python pyUtils/convertToPhysical.py
- use --help to see command line options
- To plot the physical quantities use the python script
- $ python pyUtils/plotPhysical.py --output
- use --help to see command line options
Tests:
- To test the code use the script
- To do this you have to have compiled the integrator and had DATADIR=data (or change the path in the python file in tests)
- This script will integrate a polytrope of n=1 from 0.00001 to 4 xi with a step size of 0.00001
- It will then use an the resultant xi array from that integration to compute the exact solution in the n=1 case
- sin(xi)/xi
- Finally it will take the arithmatic mean of the differences
- Smaller values of the this imply that the integrator is returning a solution close to the exact solution.