def lost_d2fx_dz2 (mx, my, mz, nx, ny, nz, xstepsize, ystepsize, zstepsize, Z, factor): xnodes=nx//factor ynodes=ny//factor znodes=nz X, Y = numpy.meshgrid(range(-xnodes//2, xnodes//2), range(-ynodes//2, ynodes//2)) X=X*xstepsize*factor Y=Y*ystepsize*factor F=numpy.zeros([xnodes,ynodes],dtype=numpy.float) for k in range(0, znodes): Z0 = k*zstepsize [mx2, xnodes, ynodes] = fld_rout.losqual(mx[k,:,:], nx, ny, factor) [my2, xnodes, ynodes] = fld_rout.losqual(my[k,:,:], nx, ny, factor) [mz2, xnodes, ynodes] = fld_rout.losqual(mz[k,:,:], nx, ny, factor) for i in range(0, xnodes): X0 = (i-xnodes//2)*xstepsize*factor for j in range(0, ynodes): Y0 = (j-ynodes//2)*ystepsize*factor F[i,j]=F[i,j]+sum(sum( 105*(mx2*(X0-X)+my2*(Y0-Y)+mz2*(Z0+Z))*(Z0+Z)**2*(X0-X) /((X-X0)**2+(Y-Y0)**2+(Z+Z0)**2)**(9/2) -15*mx2*(Z0+Z)**2/((X-X0)**2+(Y-Y0)**2+(Z+Z0)**2)**(7/2) -15*(mx2*(X0-X)+my2*(Y0-Y)+mz2*(Z0+Z))*(X0-X)/((X-X0)**2+(Y-Y0)**2+(Z+Z0)**2)**(7/2) -30*mz2*(Z0+Z)*(X0-X)/((X-X0)**2+(Y-Y0)**2+(Z+Z0)**2)**(7/2) +3*mx2/((X-X0)**2+(Y-Y0)**2+(Z+Z0)**2)**(5/2))) return [F*factor*factor, xnodes, ynodes]
def lost_field_x(mx, my, mz, nx, ny, nz, xstepsize, ystepsize, zstepsize, Z, factor): xnodes = nx // factor ynodes = ny // factor znodes = nz X, Y = numpy.meshgrid(range(-xnodes // 2, xnodes // 2), range(-ynodes // 2, ynodes // 2)) X = X * xstepsize * factor Y = Y * ystepsize * factor F = numpy.zeros([xnodes, ynodes], dtype=numpy.float) for k in range(0, znodes): Z0 = k * zstepsize [mx2, xnodes, ynodes] = fld_rout.losqual(mx[k, :, :], nx, ny, factor) [my2, xnodes, ynodes] = fld_rout.losqual(my[k, :, :], nx, ny, factor) [mz2, xnodes, ynodes] = fld_rout.losqual(mz[k, :, :], nx, ny, factor) for i in range(0, xnodes): X0 = (i - xnodes // 2) * xstepsize * factor for j in range(0, ynodes): Y0 = (j - ynodes // 2) * ystepsize * factor F[i, j] = F[i, j] + sum( sum(3 * (mx2 * (X0 - X) + my2 * (Y0 - Y) + mz2 * (Z0 + Z)) * (X0 - X) / ((X - X0)**2 + (Y - Y0)**2 + (Z + Z0)**2)**(5 / 2) - mx2 / ((X - X0)**2 + (Y - Y0)**2 + (Z + Z0)**2)**(3 / 2))) return [F * factor * factor, xnodes, ynodes]
def lost_potential (mx, my, mz, nx, ny, nz, xstepsize, ystepsize, zstepsize, Z, factor): xnodes=nx//factor ynodes=ny//factor znodes=nz X, Y = numpy.meshgrid(range(-xnodes//2, xnodes//2), range(-ynodes//2, ynodes//2)) X=X*xstepsize*factor Y=Y*ystepsize*factor F=numpy.zeros([xnodes,ynodes],dtype=numpy.float) for k in range(0, znodes): Z0 = k*zstepsize [mx2, xnodes, ynodes] = fld_rout.losqual(mx[k,:,:], nx, ny, factor) [my2, xnodes, ynodes] = fld_rout.losqual(my[k,:,:], nx, ny, factor) [mz2, xnodes, ynodes] = fld_rout.losqual(mz[k,:,:], nx, ny, factor) for i in range(0, xnodes): X0 = (i-xnodes//2)*xstepsize*factor for j in range(0, ynodes): Y0 = (j-ynodes//2)*ystepsize*factor F[i,j]=F[i,j]+sum(sum((mx2*(X-X0)+my2*(Y-Y0)+mz2*(Z+Z0))/((X-X0)**2+(Y-Y0)**2+(Z+Z0)**2)**(3/2))) return [F*factor*factor, xnodes, ynodes]