"cell_type": "markdown",
"metadata": {},
"source": [
- "Provided the deal.II was compiled with the python wrappers, we can import the module **PyDealII**. Note that it is only a shell and importing it will only allow you to call\n",
+ "Provided the deal.II library was compiled with the python wrappers, we can import the module **PyDealII**. Note that it is only a shell and importing it will only allow you to call\n",
"```python \n",
"help(PyDealII)\n",
"``` \n",
" - **PyDealII.Debug** which uses the debug version of **deal.II**\n",
" - **PyDealII.Release** which uses the release version of **deal.II**\n",
" \n",
- "Let's us import the release version of the library and give it the shortname **dealii**"
+ "Let us import the release version of the library and give it the shortname **dealii**"
]
},
{
]
},
{
- "cell_type": "raw",
+ "cell_type": "markdown",
"metadata": {},
"source": [
- "6.983333 25.000000 700\n",
- "6.983333 25.016667 692\n",
- "6.983333 25.033333 701\n",
- "6.983333 25.050000 695\n",
- "6.983333 25.066667 710\n",
- "6.983333 25.083333 702\n",
- "...\n",
- "-11.983333 35.950000 707\n",
- "-11.983333 35.966667 687\n",
- "-11.983333 35.983333 659"
+ "6.983333 25.000000 700<br>\n",
+ "6.983333 25.016667 692<br>\n",
+ "6.983333 25.033333 701<br>\n",
+ "6.983333 25.050000 695<br>\n",
+ "6.983333 25.066667 710<br>\n",
+ "6.983333 25.083333 702<br>\n",
+ "...<br>\n",
+ "-11.983333 35.950000 707<br>\n",
+ "-11.983333 35.966667 687<br>\n",
+ "-11.983333 35.983333 659<br>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "Now, create a 2-D triangulation object that would allow us to retrieve a topography value at an arbitrary location within the area. Since we have data on a regular grid with the known size, it is most efficient to use gridded 2-D interpolation:"
+ "Now, create a 2-D interpolation object that would allow us to retrieve a topography value at an arbitrary location within the area. Since we have data on a regular grid with the known size, it is most efficient to use gridded 2-D interpolation:"
]
},
{
{
"data": {
"text/plain": [
- "<matplotlib.colorbar.Colorbar at 0x7f159dd9ef60>"
+ "<matplotlib.colorbar.Colorbar at 0x7f5892559da0>"
]
},
"execution_count": 5,
" ((1. - ellipticity**2.) * R_bar + d) * math.sin(theta)]\n",
"\n",
"def pull_back_wgs84(x):\n",
- " b = math.sqrt(R * R * (1 - ellipticity * ellipticity))\n",
- " ep = math.sqrt((R * R - b * b) / (b * b))\n",
+ " b = math.sqrt(R**2 * (1 - ellipticity**2))\n",
+ " ep = math.sqrt((R**2 - b**2) / b**2)\n",
" p = math.sqrt(x[0]**2. + x[1]**2.)\n",
" th = math.atan2(R * x[2], b * p)\n",
" phi = math.atan2(x[1], x[0])\n",
- " theta = math.atan2(x[2] + ep * ep * b * math.pow(math.sin(th), 3.),\n",
+ " theta = math.atan2(x[2] + ep**2 * b * math.pow(math.sin(th), 3.),\n",
" (p -\n",
- " (ellipticity * ellipticity * R * math.pow(math.cos(th), 3))))\n",
- " R_bar = R / (math.sqrt(1 - ellipticity * ellipticity * math.sin(theta) *\n",
+ " (ellipticity**2 * R * math.pow(math.cos(th), 3))))\n",
+ " R_bar = R / (math.sqrt(1 - ellipticity**2 * math.sin(theta) *\n",
" math.sin(theta)))\n",
" R_plus_d = p / math.cos(theta)\n",
"\n",
"metadata": {},
"outputs": [],
"source": [
+ "repetitions = [1, 2, 1]\n",
+ "p1 = dealii.Point([26 * d2r, -10 * d2r, -500000])\n",
+ "p2 = dealii.Point([35 * d2r, 5 * d2r, 0.])\n",
+ "\n",
"triangulation = dealii.Triangulation('3D')\n",
- "triangulation.generate_subdivided_hyper_rectangle(repetitions = [1, 2, 1],\\\n",
- " p1 = dealii.Point([26 * d2r, -10 * d2r, -500000]),\\\n",
- " p2 = dealii.Point([35 * d2r, 5 * d2r, 0.]), colorize = True)\n",
+ "triangulation.generate_subdivided_hyper_rectangle(repetitions,\\\n",
+ " p1, p2, colorize = True)\n",
"\n",
"triangulation.transform(push_forward)\n",
"\n",
}
],
"source": [
- "print('# of cells = %d\\nsmallest cell = %0.1f m\\nlargest cell = %0.1f m' % (triangulation.n_active_cells(),\\\n",
- " triangulation.minimal_cell_diameter(),\\\n",
- " triangulation.maximal_cell_diameter()))"
+ "fmt_str = '# of cells = %d\\nsmallest cell = %0.1f m\\nlargest cell = %0.1f m'\n",
+ "print(fmt_str % (triangulation.n_active_cells(),\\\n",
+ " triangulation.minimal_cell_diameter(),\\\n",
+ " triangulation.maximal_cell_diameter()))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
- "For details about visualization and discussionof results and underlying issues the reader is referred to the section [Results](https://www.dealii.org/current/doxygen/deal.II/step_53.html) of the original tutorial program."
+ "For more details about visualization and discussion of results with underlying issues the reader is referred to the section [Results](https://www.dealii.org/current/doxygen/deal.II/step_53.html) of the original tutorial program."
]
}
],