# Set velocity to 0 on z-axis
velocityZ = zeros((nx, ny, 1))

###### Setup ##################################################################

# velocity
velocityFileName = "l{0}_nr{1}_dia{2}.npy".format(nx,nrOfPairs,halfDiameterVortexCell)

if os.path.isfile(velocityFileName):
    print "Loading vortices"
    vel = load(velocityFileName)
    print "Loading vortices complete"
else:
    print "Building vortices"
    vel = buildVortexField(nx,ny, nrOfPairs,halfDiameterVortexCell)
    print "Building vortices complete"

os.chdir(outputFolder)

vel = vel*uLB

avgVelX = mean(vel[0,:,:])
avgVelY = mean(vel[1,:,:])

# initial particle distributions
feq   = equilibrium(1.0, vel.reshape((2,nx*ny))).reshape((9,nx,ny))
fin   = feq.copy()
fpost = feq.copy()  # post collision distributions

fluidDomain = full((nx,ny), True, dtype=bool)
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from auxiliary.vortex import buildVortexField
import sys, getopt
import os

import numpy

try:
  opts, args = getopt.getopt(sys.argv[1:],"hs:n:",)
except getopt.GetoptError:
    print "parse error"
    print 'test.py -s <edge length> -n <number of vortex pairs in one row/column> '
    sys.exit(2)
for opt, arg in opts:
    if opt == '-h':
        print 'test.py -s <edge length> -n <number of vortex pairs in one row/column> '
        sys.exit()
    elif opt in ("-s"):
        length = int(float(arg))
    elif opt in ("-n"):
        nrOfPairs = int(float(arg))

diameter = length/(4.*nrOfPairs)

vel = buildVortexField(length,length,nrOfPairs,diameter)

numpy.save("l{0}_nr{1}_dia{2}".format(length,nrOfPairs,diameter),vel)