Bug fixes to do with array sizes.

Incorporated eldads outer product code
This commit is contained in:
Rowan Cockett
2013-07-19 11:24:14 -07:00
parent c9dc29bf89
commit f626cedfb8
6 changed files with 96 additions and 104 deletions
+6 -7
View File
@@ -11,12 +11,11 @@ for i in range(4):
icount=i+1
nc = 2**icount
# Define the mesh
h1 = np.ones((1,nc))/nc
h2 = np.ones((1,nc))/nc
h3 = np.ones((1,nc))/nc
h1 = np.ones(nc)/nc
h2 = np.ones(nc)/nc
h3 = np.ones(nc)/nc
h = [h1, h2, h3]
x0 = np.zeros((3, 1))
M = TensorMesh(h, x0)
M = TensorMesh(h)
#n = M.plotGrid()
# Generate DIV matrix
@@ -41,7 +40,7 @@ for i in range(4):
if icount == 1:
print 'h | inf norm | error ratio'
print '---------------------------------------'
print '%6.4f | %8.2e |'% (h1[0,0], err)
print '%6.4f | %8.2e |'% (h1[0], err)
else:
print '%6.4f | %8.2e | %6.4f' % (h1[0,0], err, err_old/err)
print '%6.4f | %8.2e | %6.4f' % (h1[0], err, err_old/err)
err_old = err
+8 -8
View File
@@ -11,9 +11,9 @@ for i in range(4):
icount=i+1
nc = 2**icount
# Define the mesh
h1 = np.ones((1,nc))/nc
h2 = np.ones((1,nc))/nc
h3 = np.ones((1,nc))/nc
h1 = np.ones(nc)/nc
h2 = np.ones(nc)/nc
h3 = np.ones(nc)/nc
h = [h1, h2, h3]
x0 = np.zeros((3, 1))
M = TensorMesh(h, x0)
@@ -24,9 +24,9 @@ for i in range(4):
#Test function
fun = lambda x: np.sin(x)
Fx = fun(M.gridFx[:,0])
Fy = fun(M.gridFy[:,1])
Fz = fun(M.gridFz[:,2])
Fx = fun(M.gridFx[:, 0])
Fy = fun(M.gridFy[:, 1])
Fz = fun(M.gridFz[:, 2])
F = np.concatenate((Fx,Fy,Fz))
divF = DIV*F
@@ -39,7 +39,7 @@ for i in range(4):
if icount == 1:
print 'h | inf norm | error ratio'
print '---------------------------------------'
print '%6.4f | %8.2e |'% (h1[0,0], err)
print '%6.4f | %8.2e |'% (h1[0], err)
else:
print '%6.4f | %8.2e | %6.4f' % (h1[0,0], err, err_old/err)
print '%6.4f | %8.2e | %6.4f' % (h1[0], err, err_old/err)
err_old = err
+6 -7
View File
@@ -11,12 +11,11 @@ for i in range(4):
icount=i+1
nc = 2**icount
# Define the mesh
h1 = np.ones((1,nc))/nc
h2 = np.ones((1,nc))/nc
h3 = np.ones((1,nc))/nc
h1 = np.ones(nc)/nc
h2 = np.ones(nc)/nc
h3 = np.ones(nc)/nc
h = [h1, h2, h3]
x0 = np.zeros((3, 1))
M = TensorMesh(h, x0)
M = TensorMesh(h)
#n = M.plotGrid()
# Generate DIV matrix
@@ -38,8 +37,8 @@ for i in range(4):
if icount == 1:
print 'h | inf norm | error ratio'
print '---------------------------------------'
print '%6.4f | %8.2e |'% (h1[0,0], err)
print '%6.4f | %8.2e |'% (h1[0], err)
else:
print '%6.4f | %8.2e | %6.4f' % (h1[0,0], err, err_old/err)
print '%6.4f | %8.2e | %6.4f' % (h1[0], err, err_old/err)
err_old = err