Tuesday, January 17, 2012

Python MEEP

Python-MEEP is a python wrapper around MEEP's C++ core. I found it difficult to use because
- there weren't many high level functions
- of poor documentation
- I found it awkward using object-oriented programming to 'script' a simulation. I felt like i was writing more code than necessary because I have to create and initialize objects /then/ preform an action with them. Of course, with procedural programming it's just one step.

I found it helpful to read MEEP's C++ help pages since there is a direct correlation to Python-MEEP. However, MEEP's C++ documentation is lacking also.

So why use Python-MEEP? My reason for using Python-MEEP is because I have moved much of my work into the Python environment. Also, I might need to customize MEEP and I think that will be easier using Python.

after some experimentation, it looks like python-meep is going to slow me down towards reaching my goal. i'm no longer enthusiastic about it.

Tuesday, January 10, 2012

PBS management tools

This is related to my parameter study mgt. code.  The problem is how to keep track of and resubmit interrupted jobs.

The usage scenario I'll describe here illustrates the motivation of the code:

Create the task array (eg. folders 0-3). Each task has a pbs script with "pbs_name 0/1/2/3" in the script to identify it in the pbs system. (You can create these unique names yourself or have them automatically generated by PSMT.)

cd into the parent of the folders. submit all pbs scripts in the subdirectories with
python pbsmgr.py
This will keep running and resubmit any jobs that are interrupted. So you should have your script rename or delete the pbs script when it's (actually) finished so that it doesn't get picked up my pbsmgr again.

You can watch the status of jobs with
python pbsmon.py
from the same directory. At first it will list all jobs but then it will only print /changes/ to job status.

LAMMPS tools: ave/time reader

Self explanatory.

vecfilesrdr in avetimevecrdr.py in https://github.com/majidaldo/lammpstools

LAMMPS tools: dumpfiles to hdf5 database

If you're going to manipulate large dump file data more than once, it's best to have it in the binary but portable hdf5 format. Requires h5py. Can resume if the process is interrupted.

dumps2hdf5 in dumps2hdf5.py in https://github.com/majidaldo/lammpstools. Can also be run from the command line. See code documentation

LAMMPS tools: dumpfile reader

function dumps2vecs in dumps2vecs.py in https://github.com/majidaldo/lammpstools

 I tried to make this reader as fast as possible since dump files can get huge. It can read one dump file or a sequence of them.

Parameter-study management with Python

A common task in scientific computing is running a set of scripts with different variable values each time. For example, say you have variables a and b and you want to create 4 sets of scripts so that
a=  b=
1    1
2    1
1   2
2   2

So the problem is:
1. generating the set of scripts quickly.
2. keeping track of folders
 - deleting folders corresponding to a certain set
 - view the correspondence of each folder to a variable set.
3. analyzing the output consistently

This is what motivated me to create "PSMT" (parameter study management tools). The code creates the example set by inputting a=[1,2] and b=[1,2]. Each set is in a separate numbered folder (no need to name the folders yourself or come up with a naming scheme!). There is an attribute (dict) for the object you create that stores the folder and the associated variable values

a=  b=  folder
1    1     \0

2    1     \1
1   2      \2
2   2      \3

Now you have your output organized! This gives structure to disparate files. Access the data in the analysis via either the folder number or by specifying the variables! The code separates the script mgt from the analysis since you're probably going to do these two processes on different computers.

This is the basic idea. I've documented my code pythonically but it's probably (lacking. I'm willing to answer questions. I've documented all the functions that the user is interested in, prefixed by user_ (eg. user_acoolfunction).
In the repository, I've also included a dictionary object that stores its items as separate files on the filesystem. The keys should be alphanumeric. The dictionary can be nested. I wanted a simple way to store hierarchies without using a database.

Near-Field Radiation for themophotovoltaics

I just finished a literature review for a new field I'm interested in. I did it for a class so it's not a publication-quality document.

The summary:
Thermophotovoltaics (TPVs) are solid state devices that convert thermally generated radiation into electrical current. Any TPV device consists of a thermal emitter and a photovoltaic cell separated by a gap. TPVs were conceived in the 1950s but suffered from very low efficiency. The advent of low band-gap photovoltaics in the 1990's renewed interest in TPVs in hope of increasing their efficiency. In the 2000s, near-field radiation effects have been explored to further increase efficiency and power output. Much of the research on near-field effects has been focused on surface phonon polaritons since they can be excited thermally and can transfer energy in a narrow spectral band. The radiation transfer between (bulk) surfaces, thin films, photonic crystals, and metamaterials have been analyzed. The research seems to be headed towards analyzing arbitrary geometries and more realistic modeling.


Wednesday, January 4, 2012

Thermal Properties of Yttrium Aluminum Garnett from Molecular Dynamics Simulations

This document contains all my efforts in my Master's work. It wasn't accepted by the master's committee due to inexplicable results. The accepted work is a bit shorter published at http://etd.library.vanderbilt.edu/available/etd-03262012-212003/Ms R0