GPUE  v1.0
GPU Gross-Pitaevskii Equation numerical solver for Bose-Einstein condensates
mpi_vis Namespace Reference

Functions

def image_gen_single (dataName, value, imgdpi, opmode, x_dat, cbarOn=True, plot_vtx=False)
 

Variables

int CPUs = 1
 
 prec
 
 c = ConfigParser.ConfigParser()
 
int maxDensityVal = 5e7
 
 xDim = int(c.getfloat('Params','xDim'))
 
 yDim = int(c.getfloat('Params','yDim'))
 
 gndMaxVal = int(c.getfloat('Params','gsteps'))
 
 evMaxVal = int(c.getfloat('Params','esteps'))
 
 incr = int(c.getfloat('Params','printSteps'))
 
tuple sep = (c.getfloat('Params','dx'))
 
tuple dx = (c.getfloat('Params','dx'))
 
tuple dt = (c.getfloat('Params','dt'))
 
tuple xMax = (c.getfloat('Params','xMax'))
 
tuple yMax = (c.getfloat('Params','yMax'))
 
int num_vort = 0
 
 data = numpy.ndarray(shape=(xDim,yDim))
 
string cbarOn = 'true'
 
string plot_vtx = 'true'
 
list gndImgList = []
 
list evImgList = []
 
 x_coord = np.loadtxt('x_0', unpack=True)
 
 comm = MPI.COMM_WORLD
 
 size = comm.size
 
 rank = comm.rank
 
 arrG = np.array_split( xrange(0,gndMaxVal,incr), size)
 
 arrE = np.array_split( xrange(0,evMaxVal,incr), size)
 
list i = gndImgList.pop()
 

Detailed Description

vis.py - GPUE: Split Operator based GPU solver for Nonlinear
Schrodinger Equation, Copyright (C) 2011-2018, Lee J. O'Riordan
<loriordan@gmail.com>, Tadhg Morgan, Neil Crowley. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ image_gen_single()

def mpi_vis.image_gen_single (   dataName,
  value,
  imgdpi,
  opmode,
  x_dat,
  cbarOn = True,
  plot_vtx = False 
)

Definition at line 79 of file mpi_vis.py.

79 def image_gen_single(dataName, value, imgdpi,opmode, x_dat, cbarOn=True, plot_vtx=False):
80  real=open(dataName + '_' + str(0)).read().splitlines()
81  img=open(dataName + 'i_' + str(0)).read().splitlines()
82  a1_r = numpy.asanyarray(real,dtype='f8') #128-bit complex
83  a1_i = numpy.asanyarray(img,dtype='f8') #128-bit complex
84  a1 = a1_r[:] + 1j*a1_i[:]
85  b1 = np.reshape(a1,(xDim,yDim))
86 
87  if not os.path.exists(dataName+"r_"+str(value)+"_abspsi2.png"):
88  real=open(dataName + '_' + str(value)).read().splitlines()
89  img=open(dataName + 'i_' + str(value)).read().splitlines()
90  a_r = numpy.asanyarray(real,dtype='f8') #128-bit complex
91  a_i = numpy.asanyarray(img,dtype='f8') #128-bit complex
92  a = a_r[:] + 1j*a_i[:]
93  b = np.transpose(np.reshape(a,(xDim,yDim))) #Transpose to match matlab plots
94  if value=0:
95  maxDensityVal=np.max(np.abs(a)**2)
96  startBit = 0x00
97 
98  try:
99  vorts = np.loadtxt('vort_ord_' + str(value) + '.csv', delimiter=',', unpack=True)
100  except Exception as e:
101  print "Failed to load the required data file: %s"%e
102  print "Please run vort.py before plotting the density, if you wih to have correctly numbered vortices"
103  vorts = np.loadtxt('vort_arr_' + str(value), delimiter=',', unpack=True, skiprows=1)
104  startBit=0x01
105 
106  if opmode & 0b100000 > 0:
107  nameStr = dataName+"r_"+str(value)
108 
109  fig, ax = plt.subplots()
110  f = plt.imshow( (abs(b)**2), cmap='hot', vmin=0, vmax=maxDensityVal, interpolation='none',)
111  #extent=[-xMax, xMax, -xMax, xMax])
112  tstr = str(value*dt)
113  plt.title('t=' + tstr + " s", fontsize=28)
114 
115  if cbarOn==True:
116  tbar = fig.colorbar(f)
117 
118  plt.gca().invert_yaxis()
119  if plot_vtx==True:
120  if startBit==0x00:
121  zVort = zip(vorts[0,:],vorts[1,:], vorts[3,:])
122  else:
123  zVort = zip(vorts[1,:], vorts[3,:], [0, 1, 2, 3])
124  for x, y, z in zVort:
125  if z==0:
126  txt = plt.text(x, y, str(int(z)), color='#379696', fontsize=6, alpha=0.7)
127  txt.set_path_effects([PathEffects.withStroke(linewidth=1, foreground='#B9EA56')])
128  else:
129  txt = plt.text(x, y, str(int(z)), color='#B9EA56', fontsize=6, alpha=0.7)
130  txt.set_path_effects([PathEffects.withStroke(linewidth=1, foreground='#379696')])
131  plt.axis('equal')
132  plt.axis('off')
133  if plot_vtx==True:
134  plt.savefig(dataName+"r_"+str(value)+"_abspsi2_num.png",dpi=imgdpi, bbox_inches='tight')
135  else:
136  plt.savefig(dataName+"r_"+str(value)+"_abspsi2_nonum.png",dpi=imgdpi, bbox_inches='tight')
137  plt.close()
138 
139  print "Saved figure: " + str(value) + ".png"
140  plt.close()
141  else:
142  print "File(s) " + str(value) +".png already exist."
143 
def image_gen_single(dataName, value, imgdpi, opmode, x_dat, cbarOn=True, plot_vtx=False)
Definition: mpi_vis.py:79

Variable Documentation

◆ arrE

mpi_vis.arrE = np.array_split( xrange(0,evMaxVal,incr), size)

Definition at line 158 of file mpi_vis.py.

◆ arrG

mpi_vis.arrG = np.array_split( xrange(0,gndMaxVal,incr), size)

Definition at line 157 of file mpi_vis.py.

◆ c

mpi_vis.c = ConfigParser.ConfigParser()

Definition at line 56 of file mpi_vis.py.

◆ cbarOn

string mpi_vis.cbarOn = 'true'

Definition at line 146 of file mpi_vis.py.

◆ comm

mpi_vis.comm = MPI.COMM_WORLD

Definition at line 152 of file mpi_vis.py.

◆ CPUs

int mpi_vis.CPUs = 1

Definition at line 35 of file mpi_vis.py.

◆ data

mpi_vis.data = numpy.ndarray(shape=(xDim,yDim))

Definition at line 77 of file mpi_vis.py.

◆ dt

tuple mpi_vis.dt = (c.getfloat('Params','dt'))

Definition at line 72 of file mpi_vis.py.

◆ dx

tuple mpi_vis.dx = (c.getfloat('Params','dx'))

Definition at line 71 of file mpi_vis.py.

◆ evImgList

list mpi_vis.evImgList = []

Definition at line 149 of file mpi_vis.py.

◆ evMaxVal

mpi_vis.evMaxVal = int(c.getfloat('Params','esteps'))

Definition at line 68 of file mpi_vis.py.

◆ gndImgList

list mpi_vis.gndImgList = []

Definition at line 148 of file mpi_vis.py.

◆ gndMaxVal

mpi_vis.gndMaxVal = int(c.getfloat('Params','gsteps'))

Definition at line 67 of file mpi_vis.py.

◆ i

list mpi_vis.i = gndImgList.pop()

Definition at line 168 of file mpi_vis.py.

Referenced by main(), and sepAvg().

◆ incr

mpi_vis.incr = int(c.getfloat('Params','printSteps'))

Definition at line 69 of file mpi_vis.py.

◆ maxDensityVal

int mpi_vis.maxDensityVal = 5e7

Definition at line 63 of file mpi_vis.py.

◆ num_vort

int mpi_vis.num_vort = 0

Definition at line 75 of file mpi_vis.py.

◆ plot_vtx

string mpi_vis.plot_vtx = 'true'

Definition at line 147 of file mpi_vis.py.

◆ prec

mpi_vis.prec

Definition at line 55 of file mpi_vis.py.

◆ rank

mpi_vis.rank = comm.rank

Definition at line 154 of file mpi_vis.py.

◆ sep

tuple mpi_vis.sep = (c.getfloat('Params','dx'))

Definition at line 70 of file mpi_vis.py.

◆ size

mpi_vis.size = comm.size

Definition at line 153 of file mpi_vis.py.

Referenced by main().

◆ x_coord

mpi_vis.x_coord = np.loadtxt('x_0', unpack=True)

Definition at line 150 of file mpi_vis.py.

◆ xDim

mpi_vis.xDim = int(c.getfloat('Params','xDim'))

Definition at line 65 of file mpi_vis.py.

◆ xMax

tuple mpi_vis.xMax = (c.getfloat('Params','xMax'))

Definition at line 73 of file mpi_vis.py.

◆ yDim

mpi_vis.yDim = int(c.getfloat('Params','yDim'))

Definition at line 66 of file mpi_vis.py.

◆ yMax

tuple mpi_vis.yMax = (c.getfloat('Params','yMax'))

Definition at line 74 of file mpi_vis.py.