Skip to content

JamieJQuinn/Thesis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

230 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anisotropic viscosity with astrophysical applications

This repository contains the latex files and analysis scripts used in the production of my thesis. Most of the data analysed by the included scripts are generated by the 3D magnetohydrodynamics code Lare3d. Due to the size of the data it is not stored, however it can be easily (though perhaps not quickly) reproduced using the parameters and specific code versions specified in the appendix of the thesis. The remainder of this README describes the folder layout, how to reproduce the simulation data and how to run the analysis.

IMPORTANT: The figures in this repository are stored in git-LFS so before cloning, install git-LFS via the instructions and then simply run git clone https://github.com/JamieJQuinn/Thesis.git. This should automatically retrieve both the regular and LFS files.

Folder Layout

  • images/ containing all figures
  • code/ analysis code used to produce all figures
  • makefile the global makefile for the entire thesis
  • run_scripts/ scripts to help in the setup, building and running of simulations

Inside the images and code folders are folders corresponding to chapters: background - chapter 1 numerical_methods - chapter 2 development_of_switching_model - chapter 3 kink_instability - chapter 4 kink_instability_straight - chapter 5 null_point_khi - chapter 6

The code folder also contains the shared folder including any code shared between the project-specific analyses and the SDF folder which links to the SDF library. Each directory in the code folder contains various jupyter notebooks, python scripts and makefiles which generate the images found in the images folder. The notebooks are presented in Rmd form for ease of versioning. Each project also includes a plotting_parameters.py file which is used to hold settings relevant for plotting. In addition, some folders contain the field_line_plots folder which contains the code used by VisIt to produce field line plots. Further details on each project are presented below.

background

  • background_images.Rmd - produces all figures used in chapter 1

numerical_methods

  • sod_problem.Rmd - runs parameter studies using the lare1d code and plots relevant figures

development_of_switching_model

  • development_of_switching_model.Rmd - creates all figures not involved in the 3d numerical experiment detailed in the same chapter
  • switching_model_3d_test.Rmd - creates all figures associated with the 3d numerical experiment

kink_instability

  • single_case_analysis.Rmd - analysis of single case
  • parameter_study.Rmd - analysis of parameter study
  • misc.Rmd - miscellaneous plots
  • slices/main.Rmd - plotting of any slices
  • slices/slice_helper_functions.py - helper functions for slice notebook

The makefile in this chapter can be used to run all notebooks at once. To integrate field lines in this chapter, the tool found here was used to output files that are analysed in the above notebooks.

kink_instability_from_straight

  • exploratory_data_analysis.Rmd - exploratory analysis
  • main.Rmd - production of all figures used in associated chapter
  • sdf_file_subsampler.Rmd - notebook used to extract and save parts of the SDF files for more efficient analysis

null_point_khi

  • khi_typical_case.Rmd - single case analysis
  • parameter_study.Rmd - parameter study analysis
  • exploratory_data_analysis.Rmd - exploratory analysis (does not produce figures)
  • field_line_integrator.Rmd - development of field line integrator (does not produce figures)
  • fan_plane_integrator.Rmd - development of fan plane integrator (does not produce figures)
  • sdf_file_subsampler.Rmd - notebook used to extract and save parts of the SDF files for more efficient analysis (does not produce figures)

shared

  • energy.py - functions for manipulating and plotting the continuous energy outputs from lare3d stored in en.dat files
  • fan_plane_integrator.py - functions for integrating around the fan plane in chapter 6 (null_point_khi)
  • field_line_integrator.py - functions for integrating along field lines in chapters 5 and 6
  • parameters.py - holds relevant physical parameters used in the simulations
  • plotting.py - functions for plotting
  • sdf_helper.py - functions for manipulating SDF files

Building the thesis

The thesis can be built by simply running make from the root directory. This will likely require a full latex installation.

Analysis

Requirements

Required

  • MPI (for the SDF library)

Optional

  • VisIt (for field line plotting)

Setup

These steps set up the SDF library and python requirements and link the SDF python bindings

Ensure SDF submodule and all its submodules are set up:

[in /]
git submodule update --init --recursive

Make SDF's C interface:

[in code/SDF/C]
make

Install virtual environment and python requirements via pipenv:

[in code/]
pipenv install

Make and link SDF's python interface inside pipenv environment:

[in code/]
pipenv shell
cd SDF/utilities
./build -3 -s

Running an analysis

Run notebook:

[in code/<project>]
pipenv run jupyter <notebook>

Plotting field lines

The field lines are not plotted in jupyter notebooks. These are, instead, plotted using the package VisIt. The plotting scripts can be found in the field_line_plots folder. A field line plot is produced by specifying the input SDF files in the fill_filelist.sh script and calling make. This runs VisIt with the plotting script plot.py. This script is mostly constructed from the output from VisIt's Macro feature which records the user's actions in the GUI and represents them programatically. Saving this output in plot.py allows quick reproduction of a figure.

Reproduction of simulation data

The code which implements only the anisotropic viscosity module can be found at \url{https://github.com/jamiejquinn/lare3d} in the feature/anisotropic_viscosity branch and it should be a simple process to merge the changes into another version of Lare3d for future research. To facilitate reproduction of the simulation data presented in the thesis, the code used in each chapter is individually packaged in different branches of the same repository (\url{https://github.com/jamiejquinn/lare3d}). The branches are run/anisotropic_model_comparison for chapter 3, run/kink-instability for chapter 4, run/kink-from-straight-field for chapter 5, and run/null-point-khi for chapter 6. These versions of Lare3d include initial conditions, boundary conditions and basic running parameters. The specific parameters used in each individual simulation can be found in the methods sections of the corresponding chapters. The parameters were inputted to the simulations using the tools found in the run_scripts folder of this repository. These can be used to quickly generate multiple simulations suitable for a parameter study.

The scripts in run_scripts consist of 4 individual scripts, designed to be run from the location at which the data will be outputted:

archie_copy.sh will copy the entire lare3d folder and change the appropriate source files in the way required for a parameter run, specific run, etc. This should be heavily edited.

archie_build.sh will build the simulations (with folders passed at command line arguments) with the correct viscosity model, detected via the folder name. A folder with the suffix -isotropic will use isotropic viscosity and -switching will use switching. The script should be read to understand the other options available.

archie_start.sh will submit the given folder to the archie-west queue. This is included for completeness.

archie_set_restart.sh is used to restart a simulation after it has completed or has been cancelled by a cluster scheduler.

The most important script for reproduction of the data is within archie_copy.sh. It should be relatively clear how to edit this script to recreate out simulations but if not, please get in touch.

Template

The latex files used to produce this thesis are based on the UofG Science and Engineering Graduate School's template.

About

Accompanying files for my thesis - Modelling anisotropic viscosity with applications in the solar corona

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors