mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-12 12:30:37 +08:00
Bug fixes to do with array sizes.
Incorporated eldads outer product code
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user