#!/usr/bin/python

#
# $Id: init.py,v 1.2 2009/04/29 11:00:16 dintrans Exp $
# Plot the initial setup
#

import pencil as pc
import pylab as P

dim=pc.read_dim()
param=pc.read_param(quiet=True)
grid=pc.read_grid(trim=True,param=param,quiet=True)

frame=param.xyz0[0],param.xyz1[0],param.xyz0[2],param.xyz1[2]

var=pc.read_var(ivar=0,quiet=True,param=param,trimall=True,magic=['bb','rho'])
bb=var.bb.reshape(3, dim.nz, dim.nx)
rho=var.rho.reshape(dim.nz, dim.nx)

P.figure(figsize=(12, 4))
P.subplot(131)
im=P.imshow(bb[0, ...], extent=frame, origin='lower', aspect='auto')
P.xlabel('x')
P.ylabel('z')
P.title('Initial Bx')

P.subplot(132)
im=P.imshow(bb[2, ...], extent=frame, origin='lower', aspect='auto')
P.xlabel('x')
P.ylabel('z')
P.title('Initial Bz')

P.subplot(133)
im=P.imshow(rho, extent=frame, origin='lower', aspect='auto')
P.xlabel('x')
P.ylabel('z')
P.title('Initial density')

#P.subplots_adjust(hspace=0.25, bottom=0.05, top=0.95, left=0.1, right=0.95)
P.subplots_adjust(left=0.05, right=0.98)
P.show()

