Computation of qP and qS rays, traveltime field, slowness vector and polarization vector in arbitrarily strong anisotropic medium

A video clip shows the computation results of qP, qS1 (fast) and qS2 (slow) in a triclinic medium. The isosurface show the wavefront of both P and S propagating away from the source. The traced rays are curved instead of straight in a homogeneous anisotropic medium. The polarization (red arrow) is different from the ray vector (blue arrow) due to the anisotropy.

Computation of qP, qSV, qSH traveltime, rays and slowness vectors in orthorhombic media

The direct traveltime field of qP, qSV, qSH can be calculated by solving a Hamilton-Jacobi equation. With the traveltime field in 3D, the computation of rays and slowness vectors is straightforward. Note that the orthorhombic medium has a isotropic block at the center where the point source is located. The orthorhombic medium outside of the isotropic medium is obtained by perturbing an arbitrarily strong transversal isotropic medium. In other word, the orthorhombic is weak but the anisotropy can be arbitrarily strong. Here is the video:

Install h5py on Ubuntu 12.04

I used the following commands:

$ wget http://h5py.googlecode.com/files/h5py-2.2.0.tar.gz
$ tar -xzf h5py-2.2.0.tar.gz
$ cd h5py-2.2.0
$ export C_INCLUDE_PATH=/usr/lib/openmpi/include

If you don’t issue the last command, you will see errors like “mpi.h” cannot be found

$ python setup.py build
$ python setup.py test
$ sudo python setup.py install

By now, you have h5py installed. Try this example: https://github.com/h5py/h5py/blob/2.1/examples/multiprocessing_example.py, and observe a beautiful picture generated using all processors on your computer.

mandelbrot

mandelbrot

Qt5, Windows 7, MSVC 2010, and 64 bit compilation

Basically following this blog. However not every step works for me so some steps are modified. Local downloads of python, ICU, Perl64, ruby, openSSL and Windows SDK are offered.

1-Download and install python
link

2-download and unzib ICU to c:icu
link

3-Download and install Perl64
link

4-Download and install ruby
link

5-Download and install OpenSSL
link

6-Download and install Windows SDK
link

7-Download and unzib QT5 source to a any directory, ex D:Qt64Qt5.1.1qtbase
(This path will be added to path variable in your environment variables later)
link

8-Download jom
link

9-Make a new environment variable
Name: QMAKESPEC
Value: win32-msvc2010

10-Make another environment variable
Name: QTDIR
Value: D:Qt64Qt5.1.1qtbase

11-Make sure you have these vars in your path
C:icubin64;C:Ruby193bin;C:Python33;C:Perl64sitebin;C:Perl64bin;QTDIRbin;D:Qt64Qt5.1.1gnuwin32bin;

12-After installing everything, start “Visual Studio x64 Win64 Command Prompt” from start menu

13-Enter these commands

set CL=/MP
cd D:Qt64Qt5.1.1qtbase

configure -debug-and-release -confirm-license -opensource -mp -qt-sql-sqlite -opengl desktop -platform win32-msvc2010 -openssl -L C:/OpenSSL-Win64/lib -I C:/OpenSSL-Win64/include

This configure command is different from the qt blog.

14-Now the configuration process starts, it will take around a minute to configure qt

15-After the configuration finishes just type nmake or jom.exe -j6. I have 8 threads so I used 6

16-The compiling should start, this took 3.5~4 hours on my Intel i7 2670.

17-type nmake doc or jom.exe -j6 doc to generate the documentation. After building, you should find *qch files under D:Qt64Qt5.1.1qtbasedoc

If you need to compile QtCreator X64 you need to

1-Download and unzib QtCreator source code to a directory ex D:Qt64qt-creator-5.1.1
link

2-Start “Visual Studio x64 Win64 Command Prompt” from start menu

3-Enter these commands

set CL=/MP
cd D:Qt64qt-creator-5.1.1

D:Qt64Qt5.1.1qtbasebinqmake.exe -r -spec win32-msvc2010 "CONFIG+=release" "QT_PRIVATE_HEADERS=D:Qt64Qt5.1.1qtbaselib" .qtcreator.pro

The above command is different from the qt blog.

4-After the processing finishes just type nmake or jom.exe -j6 and PRESS ENTER
this will take around 1 hour to complete.

qtcreator_info

After Qtcreator built, changing a user local path, restart, or installation of any qt plugin may make qtcreator not working. For example, I got messages like “QT5core.dll” not found, even though I can use Qtcreator after building. So

5- copy all *.dll from D:Qt64Qt5.1.1qtbasebin to D:Qt64qt-creator-5.1.1bin

if you want to compile mysqldriver plugin

1-Download and install MySql Server
link

2-Go to D:Qt64Qt5.1.1qtbasesrcpluginssqldriversmysql and open the file “mysql.pro”
in notepad

3-Add the following lines at the end of the file
INCLUDEPATH += “C:Program FilesMySQLMySQL Server 5.5include”
LIBS += -L“C:Program FilesMySQLMySQL Server 5.5lib”

4- save and close the file

5-Start “Visual Studio x64 Win64 Command Prompt” from start menu

6-Enter these commands
set CL=/MP PRESS ENTER
cd D:Qt64Qt5.1.1qtbasesrcpluginssqldriversmysql PRESS ENTER

D:Qt64Qt5.1.1qtbasebinqmake.exe D:Qt64Qt5.1.1qtbasesrcpluginssqldriversmysqlmysql.pro

PRESS ENTER

7- Now just type nmake PRESS ENTER
The mysql driver plugin should now be compiled

D-Link DWA-125 works on ubuntu 12.04 server out of the box

Just to confirm. Set up step is easy, once you plug in the usb adapter.

Step 1. use

$ ifconfig

to find out if wlan0 is already up. If not,

$ sudo ifconfig wlan0 up

Step 2. Check if the adapter detects available wifi signals

sudo iwlist scan

It works on my ubuntu 12.04.

Step 3. the WIFI spot I am about to connect is password protected. So need to type

wpa_passphrase YOURSSID YOURWIFIPASSWORD

This will result in something that looks like this:

network={
ssid="YOURSSID"
#psk="YOURWIFIPASSWORD"
psk=fe727aa8b64ac9b3f54c72432da14faed933ea511ecab1 5bbc6c52e7522f709a
}

Remember the long string.

Step 4. Next, you need to edit your interfaces file, so issue:

sudo nano /etc/network/interfaces

At the end of this file, you need to add your WiFi configuration. Here are the options you can add.

auto wlan0     #change this to the name of your WiFi interface
iface wlan0 inet dhcp     #this is normally fine, if you want a static IP address replace “dhcp” with “static”
netmask 255.255.255.0     #change this as appropriate for your network, this value is usually right
gateway 192.168.1.1     #change this as appropriate for your network
address 192.168.1.100     #only needed for a static IP address
dns-nameservers 192.168.1.1     #only needed for a static IP address
wpa-driver wext     #you shouldn’t need to change this
wpa-ssid YOURSSID     #just type the name of your SSID here
wpa-ap-scan 1     #if the name of your SSID is hidden usually, type 2 instead of 1
wpa-proto WPA    #if you use WPA1 type WPA, if you use WPA2 type RSN
wpa-pairwise CCMP     #if you use AES type CCMP, if you use TKIP type TKIP
wpa-group CCMP     #if you use AES type CCMP, if you use TKIP type TKIP
wpa-key-mgmt WPA-PSK     #usually WPA-PSK (if you share a key) but sometimes WPA-EAP (for enterprises)
wpa-psk YOURHEXKEYFROMABOVE     #the hex key that you generated earlier

Step 5. Finally, comment out the top section so it looks like this:

#auto eth0
#iface eth0 inet dhcp

This stops your wired network from working. This helps to ensure there are no conflicts. Remember, if you want your wired network to work again, remove these two comments (the #).

After the 5 steps, my usb adapter is up and running. You can reboot if needed to reconfigure the networking interface.

A major part of this learning notes follow this blog.

set up your own git repository with Qtcreator on Ubuntu 12.04 server

I followed this instruction
Since I am the only developer, I simplified the process a lot. Here are the steps:
1. make sure git has been installed by checking

$ which git
/usr/bin/git

or install it by typing:

$ sudo apt-get install git-core

2. create your git folder on ubuntu server 12.04

$ cd
$ mkdir git
$ cd git
$ mkdir project1.git
$ cd project1.git
$ git --bare init

3. on the local computer where you develop programs, type

# on local computer
$ cd myproject
$ git init
$ git add .
$ git commit -m 'initial commit'
$ git remote add origin junwei@junweihuang.info:/your/path/to/project1.git
$ git push origin master

4. on the local computer I develop programs in Qtcreator. After the above steps, git remote repository is already set and thus future operations can be committed to the remote server.

git under Qtcreator

git under Qtcreator

When a 6-node cluster told you this “connect() to 192.168.122.1 failed: Connection refused (111)”

and all processors hangs, like waiting for ever. Here is the solution and I just do a copy/paste:

Tell Open MPI not to use the virtual bridge interface virbr0 interface for sending messages over TCP/IP. Or better tell it to only use eth0 for the purpose:

$ mpiexec --mca btl_tcp_if_include eth0 ...

This comes from the greedy behaviour of Open MPI’s tcp BTL component that transmits messages using TCP/IP. It tries to use all of the available network interfaces that are up on each node in order to maximise the data bandwidth. Both nodes have virbr0 configured with the same subnet address. Open MPI falls to recognise that both addresses are equal, but since the subnets match, it assumes that it should be able to talk over virbr0. So process A is trying to send a message to process B, which resides on the other node. Process B listens on port P and process A knows this, so it tries to connect to 192.168.122.1:P. But this is actually the address given to the virbr0 interface on the node where process A is, so the node tries to talk to itself on a non-existent port, hence the “connection refused” error.

To avoid remember such a long command, I added

alias mympirun='mpirun --mca btl_tcp_if_include eth0'

to ~/.bashrc

Use ganglia to monitor DRBL (Diskless Remote Boot in Linux) based cluster

Another helmer cluster with 52 cores, 104 GB RAM and 3 TB hard disk has been assembled. To monitor master and slave nodes, I installed ganglia on the master node. In a nutshell, ganglia works like this:
1. gmond: A process running on the slave nodes. On Ubuntu, run

sudo apt-get install ganglia-monitor

to install it. It’s configuration file is /etc/gmond.conf, and the associated service is ganglia-monitor.
2. gmetad: A process running on the master that collects the statistics sent by the various gmond processes in the slave nodes. For Ubuntu, this is the package ganglia-webfrontend package:

sudo apt-get install ganglia-webfrontend

Its configuration in /etc/gmetad.conf, and the associated service is gmetad.
3. A web UI: The web front end is installed/contained within the same package as gmetad. The UI is used to display the collected data.

Since the DRBL based slave nodes have no harddrive, so all the services must be started from the master.
1. The first step is to add “#mcast_if = eth1”:

/* Feel free to specify as many udp_send_channels as you like.  Gmond
   used to only support having a single channel */
udp_send_channel {
  mcast_join = 239.2.11.71
  #mcast_if = eth1
  port = 8649
  ttl = 1
}

/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
  mcast_join = 239.2.11.71
  #mcast_if = eth1
  port = 8649
  bind = 239.2.11.71
} 

The master node uses eth1 to communicate with slaves, whereas slaves use eth0 communicate with the master. So the trick here is keep the “#” and do

sudo drblpush -c /etc/drbl/drblpush.conf

2. With all slaves alive, run the following commands

sudo drbl-client-service ganglia-monitor on
sudo drbl-doit "/etc/init.d/ganglia-monitor start"

3. done. It will look like this

Ganglia monitor DRBL based cluster

Ganglia monitor DRBL based cluster

!!!Remember before every time you run

sudo drblpush -c /etc/drbl/drblpush.conf

Keep the “#” in front of “mcast_if = eth1” and uncomment it when you start ganglia on the master node.