Generate Polytropes in GYRE?

General discussion of all things GYRE-related (e.g., results, talks, ideas, tips)
Post Reply
jguillochon
Posts: 1
Joined: Thu Nov 20, 2014 8:00 pm

Generate Polytropes in GYRE?

Post by jguillochon » Fri Nov 21, 2014 12:58 pm

Hi, I was toying around with the polytrope test, and it looks like there might be some code in GYRE that can actually generate a polytrope profile directly. In the polytrope test folder there is a "build_poly_hom.in," and upon inspecting the code it seems like the machinery to do this might be there. However, just running gyre_ad on that input file produces some errors. My question is if this feature is in fact implemented yet? If so, how does one generate a polytrope, and if not, is it coming soon?

Thanks!

ehsan
Posts: 88
Joined: Sun Jun 16, 2013 11:31 am

Re: Generate Polytropes in GYRE?

Post by ehsan » Thu Dec 18, 2014 3:56 am

Hi.
I do not know if this is exactly what you're asking for, but I have attached a Python short script that solves the Lane-Emden equation for a set of indices, n<5.
Please unzip the attached file. Unfortunately, the .py is not a valid extension for attachments.
I hope you find it useful.

Best
Ehsan.
Attachments
polytrope.py.zip
zipped Python script
(1.68 KiB) Downloaded 534 times

User avatar
rhtownsend
Site Admin
Posts: 397
Joined: Sun Mar 31, 2013 4:22 pm

Re: Generate Polytropes in GYRE?

Post by rhtownsend » Thu Dec 18, 2014 9:26 am

Ehsan's comment (thanks!) has prompted me to respond to the original one. Yes, GYRE has some tools in the src/utils subdirectory for generating polytropes:

*) build_poly -- generate a polytrope of arbitrary index 0 <= n < 5, and write it out in GYRE's POLY format
*) build_poy_hom -- generate a homogeneous incompressible (n=0) polytrope and write it out in GYRE's POLY format

To build these tools, run 'make' in the src/util subdirectory. *NOTE*: you'll need to install the Madison SDK (MADSDK) to compile -- this is a superset of the MESA SDK, which includes the ODEPACK library and a number of other useful things. You can grab the MADSDK from

http://www.astro.wisc.edu/~townsend/sta ... ref=madsdk

To use the tools, you need to create a namelist input file. There's a sample input file, build_poly.in, provided in src/utils -- it specifies an n=4.97 polytrope with a spacing of 1E-2 in the Lane-Emden variable xi. Input files are read from standard input, and so

./build_poly < build_poly.in

...will run build_poly with the build_poly.in namelist input file. In future releases of the code I'm going to make build_poly[_hom] use command-line arguments, but for now we're stuck using namelists.

kmbrgandhi
Posts: 2
Joined: Fri Jun 22, 2018 10:50 am

Re: Generate Polytropes in GYRE?

Post by kmbrgandhi » Fri Jun 22, 2018 12:13 pm

Hi, Apologies for bumping this very old thread. I am new to Gyre, and was interested in using the build_poly functionality. I noticed that locations of things had changed, and was wondering how one would go about using build_poly (and related tools) now, if it differs in a meaningful way. Furthermore, I was a little confused by the sample namelist file build_poly.in given in src/poly; in particular, I wanted to clarify what the namelist entries were (was in particular confused at how n_poly specified the polytropic index in that example file).

EDIT: I've realized that that the build_poly executable, which the compilation says should be produced by the build process, is not present in gyre/bin/. Is this something I should try to address?

Thanks so much,
Kavish

User avatar
rhtownsend
Site Admin
Posts: 397
Joined: Sun Mar 31, 2013 4:22 pm

Re: Generate Polytropes in GYRE?

Post by rhtownsend » Mon Jun 25, 2018 11:45 am

kmbrgandhi wrote:
Fri Jun 22, 2018 12:13 pm
Hi, Apologies for bumping this very old thread. I am new to Gyre, and was interested in using the build_poly functionality. I noticed that locations of things had changed, and was wondering how one would go about using build_poly (and related tools) now, if it differs in a meaningful way. Furthermore, I was a little confused by the sample namelist file build_poly.in given in src/poly; in particular, I wanted to clarify what the namelist entries were (was in particular confused at how n_poly specified the polytropic index in that example file).

EDIT: I've realized that that the build_poly executable, which the compilation says should be produced by the build process, is not present in gyre/bin/. Is this something I should try to address?

Thanks so much,
Kavish
Hi Kavish --

For build_poly to get compiled, you need to be using the Mad SDK rather than the usual MESA SDK. The Mad (Madison) SDK is a superset of the MESA SDK, which includes the ODEPACK integration library; build_poly requires ODEPACK to integrate the Lane-Emden equation.

So, grab the Mad SDK from here:

http://www.astro.wisc.edu/~townsend/sta ... ref=madsdk

...and install it and activate it, in lieu of the MESA SDK. Then, when you run 'make' inside $GYRE_DIR, build_poly should now get built.

How to use it is another matter -- I recently revamped it to allow for composite polytropes, and so the layout of input files has changed quite a bit. I'll try to throw together a crash-course over the next day or so, so you can get up and running.

As an aside: can I ask what your interest in build_poly is? Are you wanting to use GYRE on polytropes, or are you just looking for a polytrope builder? (Either answer is good!).

cheers,

Rich

kmbrgandhi
Posts: 2
Joined: Fri Jun 22, 2018 10:50 am

Re: Generate Polytropes in GYRE?

Post by kmbrgandhi » Mon Jun 25, 2018 12:17 pm

Hi Rich,

Thank you for the fix! No rush on the crash course, although it certainly would be much appreciated. As for myself: I am mostly interested in learning to use Gyre, and was practicing using polytropes as an example. I had started by generating my own .h5 files but then saw a post here that mentioned that the functionality was in-built, which prompted me to try to use it (and then led me here when I got confused).

Best,
Kavish

Post Reply