[Mesa-users] Eigenfunctions and eigenfrequencies

Warrick Ball W.H.Ball at bham.ac.uk
Wed Sep 20 20:42:55 UTC 2023


Dear Andrew,

It's possible to get the displacement eigenfunctions of your stellar models using ADIPLS and without modifying the source.  As Rich said, you might find this easier with GYRE, but I'll explain how to use ADIPLS anyway.

I'm not sure how familiar you are with ADIPLS already but I'm pitching this at a typical MESA user in case it's a useful guide for others in the future.

If you've installed MESA, then ADIPLS should have been built when you installed MESA and I'll use that version as an example.  As far as I know, the ADIPLS scripts expect you to set an environment variable `aprgdir` and add `${aprgdir}/bin` to your path.  So this should work:

     $ export aprgdir=${MESA_DIR}/adipls/adipack.c
     $ export PATH=${PATH}:${aprgdir}/bin

where the leading `$` indicates my terminal prompt.

I'm not sure what model you're using but as an example I'll use Model S [1], which we can download in FGONG format with

     $ wget https://users-phys.au.dk/~jcd/solar_models/fgong.l5bi.d.15

We need an ADIPLS input file, which we could try to construct from scratch using the documentation (in `${aprgdir}/notes`), or we can copy something from the `astero` work folder:

     $ cp $MESA_DIR/astero/work/adipls.c.in .

This input file expects an input model in ADIPLS's binary format in `amdl.mesa`, so we'll convert the Model S FGONG using

     $ fgong-amdl.d fgong.l5bi.d.15 amdl.mesa

You can do the same with your own stellar model by saving it as FGONG using MESA's controls.

At this point, you should be able to run ADIPLS with

     $ adipls.c.d adipls.c.in

and eventually find the output in `agsm.mesa`, which is an ADIPLS "Grand Summary" (see the ADIPLS docs).  We can convert some of the output to plain text with

     $ set-obs.d 14 agsm.mesa freq.mesa

after which a table of l, n, frequency and mode inertia is contained in `freq.mesa`.

But we want eigenfunctions!

Section 7.2.3f and 8.4 of the main docs (`adiab.prg.c.pdf`) say that `nfmode=1` gives us a full set of eigenfunctions and the input file is annotated so we can see where to add that: by changing line 40 to

     1,,,,1,,,,,,,,,,,     @

(note the second `1`).  Finally, we also need to specify an output file, which is attached to unit 4 (see Sec. 8), so add something like

     4  'amde.mesa'   @

around the start (I put them in order, so the second line).  I've attached my version after making these two changes, in case this description is unclear.

Now run ADIPLS again with

     $ adipls.c.d adipls.c.in

and you'll now see an `amde.mesa` file.

What do you do with that?

I'm not sure of any bundled tools that do this.  Based on the docs and snippets and ideas from colleagues many years ago (shout out to Earl Bellinger and Emanuele Papini), I wrote my own Python functions that became a package called `tomso` [2].  If you speak Python and install tomso (e.g. `pip install tomso`), you can do something like

     >>> import matplotlib.pyplot as pl
     >>> amde = adipls.load_amde('amde.mesa', nfmode=1)
     >>> pl.plot(amde.x, amde.eigs[11][:,5])
     >>> pl.show()  # possibly unnecessary

to plot the scaled radial component ẑ₁ (the full array is defined in Sec. 8.4; ẑ₁ is defined in eq. 4.6) of the 12th eigenfunction in the output, which happens to be the (l,n)=(0,21) mode with frequency ~3 mHz.  I've attached my (labelled) version of this output.

Various other things are possible, and the best resources for finding what you need is the main documentation file bundled with ADIPLS.  `tomso` should also make some other tasks a bit easier.  (If you'd like to cite it, you can cite the JOSS article [3].)

Cheers,
Warrick

[1] https://ui.adsabs.harvard.edu/abs/1996Sci...272.1286C
[2] https://tomso.readthedocs.io/

___________

Warrick Ball
Senior Research Software Engineer
University of Birmingham
W.H.Ball at bham.ac.uk

On Mon, 18 Sep 2023, Andrew Dublin via Mesa-users wrote:

> CAUTION: This email originated from outside the organisation. Do not click links or open attachments unless you recognise the sender and know the content is safe.
> Hello everyone,
> 
> I'm interested in examining the displacement eigenfunctions of my stellar models. Does anyone know how to modify the adipls.c.d subroutine to print the radial eigenfunctions along with the eigenfrequencies? (From what I've read online, it seems that
> I have to modify the code in adipls, but I am not sure how to do so.) 
> 
> Best,
> Andrew
> 
>
-------------- next part --------------
2  'amdl.mesa'   @
4  'amde.mesa'   @
9  'ttt.adipls.prt'   @
11 'agsm.mesa'   @
15 'ttt.adipls.ssm'   @
16 'ttt.adipls.fsm'  @
-1 ''   @
  cntrd,
mod.osc.cst.int.out     @

mod:
  ifind,xmod,imlds,in,irname,nprmod,
,,,,,,,   @
  ntrnct,ntrnsf,imdmod,
,,1,,,,,,,,,,,,,,,,,,,, @
osc:
  el,nsel,els1,dels,,dfsig1,dfsig2,nsig1,nsig2
   0,3,0,1,,,,,,,     @
  itrsig,sig1,istsig,inomde,itrds,
    1,  220,   ,    1,10,,,,,,,,     @
  dfsig,nsig,iscan,sig2,
,2,100,1000,,,,,,,,,,,,     @
eltrw1, eltrw2, sgtrw1, sgtrw2
,,,,,,,,,,,,,,,,    @
cst:
cgrav
6.67232e-8               @
int:
  iplneq,iturpr,icow,alb,
,,0,,             @
  istsbc,fctsbc,ibotbc,fcttbc,
1,,,,,,,,,,,,,,,  @
  mdintg,iriche,xfit,fcnorm,eps,epssol,itmax,
5,0,0.99,,,,,,,,,,,,,,  @
  fsig,dsigmx,irsevn,xmnevn,nftmax,itsord
,,,,,-1,,,,,,,,,,,,,,  @
out:
  istdpr,nout,nprcen,irsord,iekinr
9,10,,20,1,,,,,,,,     @
  iper,ivarf,kvarf,npvarf,nfmode,
1,,,,1,,,,,,,,,,,     @
  irotkr,nprtkr,igm1kr,npgmkr,ispcpr,
0,,,,6,,,,,,     @
icaswn, sigwn1, sigwn2, frqwn1, frqwn2,iorwn1, iorwn2, frlwn1, frlwn2
,,,,,-5000,100,,,,,,,,,,,,,,,,,,,,,,,,   @
dgn:
  itssol,idgtss,moddet,iprdet,npout
,,,,,,,,,,     
  imstsl,imissl,imjssl,idgnrk
,,,,,,,,,,,,    
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example_adipls_eig.png
Type: image/png
Size: 69657 bytes
Desc: 
URL: <https://lists.mesastar.org/pipermail/mesa-users/attachments/20230920/4ab92a13/attachment.png>


More information about the Mesa-users mailing list