def setBackgroundField(self, Inc, Dec, Btot): Bx = Btot*np.cos(Inc/180.*np.pi)*np.sin(Dec/180.*np.pi) By = Btot*np.cos(Inc/180.*np.pi)*np.cos(Dec/180.*np.pi) Bz = -Btot*np.sin(Inc/180.*np.pi) self.B0 = np.r_[Bx, By, Bz]
def setBackgroundField(self, Inc, Dec, Btot): Bx = Btot * np.cos(Inc / 180. * np.pi) * np.sin(Dec / 180. * np.pi) By = Btot * np.cos(Inc / 180. * np.pi) * np.cos(Dec / 180. * np.pi) Bz = -Btot * np.sin(Inc / 180. * np.pi) self.B0 = np.r_[Bx, By, Bz]
def simpleFail(x): return np.sin(x), -sdiag(np.cos(x))
def simpleFunction(x): return np.sin(x), lambda xi: sdiag(np.cos(x)) * xi
def simplePass(x): return np.sin(x), sdiag(np.cos(x))
#%% Create a 2D mesh along axis of Tx end points and keep z-discretization dx = np.min( [ np.min(mesh.hx), np.min(mesh.hy) ]) nc = np.ceil(dl_len/dx)+3 padx = dx*np.power(1.4,range(1,15)) # Creating padding cells h1 = np.r_[padx[::-1], np.ones(nc)*dx , padx] # Create mesh with 0 coordinate centerer on the ginput points in cell center mesh2d = Mesh.TensorMesh([h1, mesh.hz], x0=(-np.sum(padx)-dx/2,mesh.x0[2])) # Create array of points for interpolating from 3D to 2D mesh xx = Tx[0][0,0] + mesh2d.vectorCCx * np.cos(azm) yy = Tx[0][1,0] + mesh2d.vectorCCx * np.sin(azm) zz = mesh2d.vectorCCy [XX,ZZ] = np.meshgrid(xx,zz) [YY,ZZ] = np.meshgrid(yy,zz) xyz2d = np.c_[mkvc(XX),mkvc(YY),mkvc(ZZ)] #plt.scatter(xx,yy,s=20,c='y') F = interpolation.NearestNDInterpolator(mesh.gridCC,model) m2D = np.reshape(F(xyz2d),[mesh2d.nCx,mesh2d.nCy]).T #==============================================================================
def simpleFunction(x): return np.sin(x), lambda xi: sdiag(np.cos(x))*xi