The Homepage of Liron McLey

Snow on the way to Lake Louise, AB, Canada

Homework files     Useful links     Project


Background     The Equations     Data feed     Numerical method     Compiling and running     Validation of the code


Compiling and running the code

This procedure is best done on a Linux machine (I have run it both on Ubuntu and CentOS). It doesn't work too well and tends to be really slow on Windows. The instructions below are valid for a Linux command line.
To start, create a working directory, WorkDir, for the code: mkdir WorkDir.

Downloading the code

This is a link to the code. Right click on it and save the link to your computer.
Move it to the working directory: mv main.cpp ~/..path../WorkDir

Compiling

To compile the code you need to have a C++ compiler installed on your computer.
Compile the file: g++ main.cpp -o main.ex

Running

Before you run the program you need to obtain a proper input file (The code needs a star to work with!). The requirements for the input file are specified here. If you don't have an input file and still want to check out the code, the file fgong.ModelS is a ready-to-use input file with data for the Sun (Model S), you can save the link to your working directory under the name InputFile.
To run the code simply write: ./main.ex

The program

The program starts by asking you which input file format you have. The options are:
  • MESA file
  • fgong file
    If you are using the input file suggested above (fgong.ModelS) you need to choose the second option.
    After it reads the input file it offers two more options:
  • Look for an eigenfrequency for some mode order n and angular degree l
  • Exit the program
    As explained in the background, l can only receive non negative integer values, and for n < 0 there is no l=0 option. The program will inform you if you make a mistake.
  • The Output file

    In general, the name of the output file is "EigenF.n.l.data", where n is the mode order and l is the angular degree. Here is an example of an output file that was generated by the code. It's structure is pretty straight forward:
  • The first line is a summary of the parameters of the eigenfunctions
  • The second line is information for the Matlab script
  • The following line specifies what each data column represents
  • The rest of the file is pure data
  • Plotting

    I created a script in Matlab that draws the scaled radial displacement of the eigenfunction - Matlab script. Save the script to your working directory. Open Matlab on your computer and run the script in Matlab's window in the following way: Graph('Output_File_Name').
    'Output_File_Name' is, of course, the name of the output file that was generated by the code. So, if you download the sample output file the command would be: Graph('EigenF.23.0.data').
    Make sure you write both apostrophe signs, they are important!
    In any case, if you come across a problem, don't hesitate to contact me for help at lironmc[at]tx.technion.ac.il.


    << Previous     Next >>


    Go back to the Computational Physics Class index page