mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-01 20:41:22 +08:00
Merge branch 'master' of https://github.com/simpeg/simpegpf
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import sys
|
||||
sys.path.append('../../')
|
||||
|
||||
from simpegPF.MagAnalytics import MagSphereAnalFunA, IDTtoxyz
|
||||
from simpegPF.MagAnaytics import MagSphereAnaFunA, IDTtoxyz
|
||||
from SimPEG import *
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
||||
@@ -19,7 +19,7 @@ deckr = 54. + 9/60
|
||||
btotkr = 50898.6
|
||||
Bokr = IDTtoxyz(inckr, deckr, btotkr)
|
||||
|
||||
bx,by,bz = MagSphereAnalFunA(X, Y, Z,100.,0.,0.,0.,0.01,Bokr,'secondary')
|
||||
bx,by,bz = MagSphereAnaFunA(X, Y, Z,100.,0.,0.,0.,0.01,Bokr,'secondary')
|
||||
Bzkr = np.reshape(bz, (np.size(xr), np.size(yr)), order='F')
|
||||
|
||||
# Bz component at Canada
|
||||
@@ -28,7 +28,7 @@ decca = 70. + 19/60
|
||||
btotca = 54692.1
|
||||
Boca = IDTtoxyz(incca, decca, btotca)
|
||||
|
||||
bx,by,bz = MagSphereAnalFunA(X, Y, Z,100.,0.,0.,0.,0.01,Boca,'secondary')
|
||||
bx,by,bz = MagSphereAnaFunA(X, Y, Z,100.,0.,0.,0.,0.01,Boca,'secondary')
|
||||
Bzca = np.reshape(bz, (np.size(xr), np.size(yr)), order='F')
|
||||
|
||||
fig = plt.figure( figsize = (14,5) )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from SimPEG import *
|
||||
import matplotlib.pyplot as plt
|
||||
from simpegPF.MagAnalytics import spheremodel, MagSphereAnalFun, CongruousMagBC
|
||||
from simpegPF.MagAnalytics import spheremodel, MagSphereAnaFun, CongruousMagBC
|
||||
import time
|
||||
|
||||
# Step1: Generate 3D tensor mesh
|
||||
@@ -66,7 +66,7 @@ H0 = Box/mu0
|
||||
|
||||
flag = 'secondary'
|
||||
|
||||
Bxra, Byra, Bzra = MagSphereAnalFun(X, Y, Z, 50., 0., 0., 0., mu0, mu0*(1+chiblk), H0, flag)
|
||||
Bxra, Byra, Bzra = MagSphereAnaFun(X, Y, Z, 50., 0., 0., 0., mu0, mu0*(1+chiblk), H0, flag)
|
||||
Bxra = np.reshape(Bxra, (np.size(xr), np.size(yr)), order='F')
|
||||
Byra = np.reshape(Byra, (np.size(xr), np.size(yr)), order='F')
|
||||
Bzra = np.reshape(Bzra, (np.size(xr), np.size(yr)), order='F')
|
||||
|
||||
@@ -15,7 +15,7 @@ def spheremodel(mesh, x0, y0, z0, r):
|
||||
|
||||
|
||||
|
||||
def MagSphereAnalFun(x, y, z, R, x0, y0, z0, mu1, mu2, H0, flag):
|
||||
def MagSphereAnaFun(x, y, z, R, x0, y0, z0, mu1, mu2, H0, flag):
|
||||
"""
|
||||
test
|
||||
Analytic function for Magnetics problem. The set up here is
|
||||
@@ -124,7 +124,7 @@ def CongruousMagBC(mesh, Bo, chi):
|
||||
return np.r_[Bbcx, Bbcy, Bbcz], (1/gamma-1/(3+gamma))*1/V
|
||||
|
||||
|
||||
def MagSphereAnalFunA(x, y, z, R, xc, yc, zc, chi, Bo, flag):
|
||||
def MagSphereAnaFunA(x, y, z, R, xc, yc, zc, chi, Bo, flag):
|
||||
"""
|
||||
Computing boundary condition using Congrous sphere method.
|
||||
This is designed for secondary field formulation.
|
||||
@@ -210,16 +210,16 @@ if __name__ == '__main__':
|
||||
flag = 'secondary'
|
||||
Box = 1.
|
||||
H0 = Box/mu_0
|
||||
Bbcxx, Bbcxy, Bbcxz = MagSphereAnalFun(M3.gridFx[(indxd|indxu),0], M3.gridFx[(indxd|indxu),1], M3.gridFx[(indxd|indxu),2], 100, 0., 0., 0., mu_0, mu_0*(1+chiblk), H0, flag)
|
||||
Bbcyx, Bbcyy, Bbcyz = MagSphereAnalFun(M3.gridFy[(indyd|indyu),0], M3.gridFy[(indyd|indyu),1], M3.gridFy[(indyd|indyu),2], 100, 0., 0., 0., mu_0, mu_0*(1+chiblk), H0, flag)
|
||||
Bbczx, Bbczy, Bbczz = MagSphereAnalFun(M3.gridFz[(indzd|indzu),0], M3.gridFz[(indzd|indzu),1], M3.gridFz[(indzd|indzu),2], 100, 0., 0., 0., mu_0, mu_0*(1+chiblk), H0, flag)
|
||||
Bbc_anal = np.r_[Bbcxx, Bbcyy, Bbczz]
|
||||
Bbcxx, Bbcxy, Bbcxz = MagSphereAnaFun(M3.gridFx[(indxd|indxu),0], M3.gridFx[(indxd|indxu),1], M3.gridFx[(indxd|indxu),2], 100, 0., 0., 0., mu_0, mu_0*(1+chiblk), H0, flag)
|
||||
Bbcyx, Bbcyy, Bbcyz = MagSphereAnaFun(M3.gridFy[(indyd|indyu),0], M3.gridFy[(indyd|indyu),1], M3.gridFy[(indyd|indyu),2], 100, 0., 0., 0., mu_0, mu_0*(1+chiblk), H0, flag)
|
||||
Bbczx, Bbczy, Bbczz = MagSphereAnaFun(M3.gridFz[(indzd|indzu),0], M3.gridFz[(indzd|indzu),1], M3.gridFz[(indzd|indzu),2], 100, 0., 0., 0., mu_0, mu_0*(1+chiblk), H0, flag)
|
||||
Bbc_ana = np.r_[Bbcxx, Bbcyy, Bbczz]
|
||||
|
||||
# fig, ax = plt.subplots(1,1, figsize = (10, 10))
|
||||
# ax.plot(Bbc_anal)
|
||||
# ax.plot(Bbc_ana)
|
||||
# ax.plot(Bbc)
|
||||
# plt.show()
|
||||
err = np.linalg.norm(Bbc-Bbc_anal)/np.linalg.norm(Bbc_anal)
|
||||
err = np.linalg.norm(Bbc-Bbc_ana)/np.linalg.norm(Bbc_ana)
|
||||
|
||||
if err < 0.1:
|
||||
print 'Mag Boundary computation is valid, err = ', err
|
||||
|
||||
@@ -26,7 +26,7 @@ class MagFwdProblemTests(unittest.TestCase):
|
||||
self.chi = chi
|
||||
|
||||
|
||||
def test_anal_forward(self):
|
||||
def test_ana_forward(self):
|
||||
|
||||
survey = PF.BaseMag.BaseMagSurvey()
|
||||
|
||||
@@ -47,7 +47,7 @@ class MagFwdProblemTests(unittest.TestCase):
|
||||
u = self.prob.fields(self.chi)
|
||||
B = u['B']
|
||||
|
||||
bxa,bya,bza = PF.MagAnalytics.MagSphereAnalFunA(rxLoc[:,0],rxLoc[:,1],rxLoc[:,2],100.,0.,0.,0.,0.01, b0,'secondary')
|
||||
bxa,bya,bza = PF.MagAnalytics.MagSphereAnaFunA(rxLoc[:,0],rxLoc[:,1],rxLoc[:,2],100.,0.,0.,0.,0.01, b0,'secondary')
|
||||
|
||||
dpred = survey.projectFieldsAsVector(B)
|
||||
err = np.linalg.norm(dpred-np.r_[bxa, bya, bza])/np.linalg.norm(np.r_[bxa, bya, bza])
|
||||
|
||||
Reference in New Issue
Block a user