mirror of
https://github.com/wassname/simpeg.git
synced 2026-08-13 12:40:08 +08:00
Code is working (returning results with in couple of % for a 1D analytic solution) but test need to be "automated".
128 lines
3.2 KiB
Plaintext
128 lines
3.2 KiB
Plaintext
{
|
|
"metadata": {
|
|
"name": "",
|
|
"signature": "sha256:260d0d5c93203805d78b8fa9e20a9079ce0e65e4b6a3453fedfcda305fffaa80"
|
|
},
|
|
"nbformat": 3,
|
|
"nbformat_minor": 0,
|
|
"worksheets": [
|
|
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"import SimPEG as simpeg\n",
|
|
"import simpegMT as simpegmt\n"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"Efficiency Warning: Interpolation will be slow, use setup.py!\n",
|
|
"\n",
|
|
" python setup.py build_ext --inplace\n",
|
|
" \n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 1
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"#Define the mesh\n",
|
|
"m1d = simpeg.Mesh.TensorMesh([[(100,5,1.5),(100.,10),(100,5,1.5)]], x0=['C'])\n",
|
|
"sigma = np.zeros(m1d.nC) + 2e-3\n",
|
|
"sigma[m1d.gridCC[:]>200] = 1e-8\n"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 6
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"# Calculate the analytic fields\n",
|
|
"freqs = np.logspace(4,-1,26)\n",
|
|
"Z = []\n",
|
|
"for freq in freqs:\n",
|
|
" Ed, Eu, Hd, Hu = simpegmt.Utils.getEHfields(m1d,sigma,freq,np.array([200]))\n",
|
|
" Z.append((Ed + Eu)/(Hd + Hu))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 17
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"Zarr = np.concatenate(Z)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 19
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"def appResPhs(freq,z):\n",
|
|
" app_res = ((1./(8e-7*np.pi**2))/freq)*np.abs(z)**2\n",
|
|
" app_phs = np.arctan2(-z.imag,z.real)*(180/np.pi)\n",
|
|
" return app_res, app_phs\n",
|
|
"app_r, app_p = appResPhs(freqs,Zarr)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 20
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"app_r"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"metadata": {},
|
|
"output_type": "pyout",
|
|
"prompt_number": 21,
|
|
"text": [
|
|
"array([ 499.99998067, 499.99999231, 499.99999694, 499.99999878,\n",
|
|
" 499.99999951, 499.99999981, 499.99999992, 499.99999997,\n",
|
|
" 499.99999999, 500. , 500. , 500. ,\n",
|
|
" 500. , 500. , 500. , 500. ,\n",
|
|
" 500. , 500. , 500. , 500. ,\n",
|
|
" 500. , 500. , 500. , 500. ,\n",
|
|
" 500. , 500. ])"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 21
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": []
|
|
}
|
|
],
|
|
"metadata": {}
|
|
}
|
|
]
|
|
} |