Skip to content

Commit

Permalink
Merge pull request #129 from langevin-usgs/patch-langevin-notebooks
Browse files Browse the repository at this point in the history
Update Langevin notebooks based on reviewer comments
  • Loading branch information
mnfienen authored Mar 18, 2024
2 parents f658558 + 9858c21 commit eec977f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 13 deletions.
14 changes: 11 additions & 3 deletions notebooks/part0_python_intro/04_files_and_strings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"source": [
"### A better way to write a file, with `with`.\n",
"\n",
"The python `with` statement allows us to create a file handle that automatically closes after the code exits the with statement. This not only reduces the amount of code that exists, it also ensures that file handles are not not left open as the code progresses."
"The python `with` statement allows us to create a file handle that automatically closes after the code exits the with statement. The use of `with` invokes a Python context manager, which ensures that the file is closed as soon as the program exits the `with` context block. This not only reduces the amount of code that exists, it also ensures that file handles are not not left open as the code progresses."
]
},
{
Expand Down Expand Up @@ -840,13 +840,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "pyclass",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"version": "3.11.7"
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down
19 changes: 15 additions & 4 deletions notebooks/part1_flopy/05-unstructured-grids.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# 05: FloPy Model Grids"
"# Unstructred Grids\n",
"\n",
"This notebook demonstrates FloPy functionality for creating different types of model grids. Six different model grids are constructed for the same domain. The domain is defined by a polygon intended to represent a hydrologic basin.\n",
"\n",
"The grids generated in this notebook include the following:\n",
"\n",
"* Regular MODFLOW grid\n",
"* Irregular MODFLOW grid with variable row and column spacings\n",
"* Nested grid, consisting of parent and child grids\n",
"* Quadtree grid created using the FloPy wrapper for the [USGS Gridgen program](https://www.usgs.gov/software/gridgen-program-generating-unstructured-finite-volume-grids)\n",
"* Triangular grid created using the FloPy wrapper for the [Triangle program](https://www.cs.cmu.edu/~quake/triangle.html).\n",
"* Voronoi grid created using the [Triangle program](https://www.cs.cmu.edu/~quake/triangle.html) and the [Scipy voronoi class](https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Voronoi.html#scipy.spatial.Voronoi) "
]
},
{
Expand Down Expand Up @@ -437,7 +448,7 @@
"tri.add_polygon(poly)\n",
"tri.build(verbose=False)\n",
"\n",
"# Create the flopy Voronoi grid oboject and the flopy VertexGrid\n",
"# Create the flopy Voronoi grid object and the flopy VertexGrid\n",
"vor = VoronoiGrid(tri)\n",
"gridprops = vor.get_gridprops_vertexgrid()\n",
"idomain = np.ones((1, vor.ncpl), dtype=int)\n",
Expand All @@ -459,7 +470,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "pyclass",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -473,7 +484,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down
47 changes: 41 additions & 6 deletions notebooks/part1_flopy/09-gwt-voronoi-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,26 @@
"id": "afad5282",
"metadata": {},
"source": [
"# 09: Demonstration of MODFLOW 6 Groundwater Transport"
"# Demonstration of MODFLOW 6 Groundwater Transport with a Voronoi Grid\n",
"\n",
"MODFLOW 6 includes a Groundwater Transport (GWT) Model for simulation of solute transport through the subsurface. The GWT Model can be used with structured or unstructured model grids. The purpose of this example is to demonstrate the construction, running, and post-processing of a simple solute transport model.\n",
"\n",
"The solute transport model is based on an existing flow model of the Freyberg example. The flow model usesd a voronoi model grid to simulate steady-state conditions. In this notebook, we create a transient solute transport model using the same voronoi grid that was used for flow.\n",
"\n",
"The following steps are used in this notebook.\n",
"* Load the existing flow model into FloPy\n",
"* Plot the model grid\n",
"* Create the solute transport model\n",
"* Run the solute transport model with MODFLOW 6\n",
"* Create animations of the model results"
]
},
{
"cell_type": "markdown",
"id": "88945275-63d6-4c07-8189-45e2911bc5cc",
"metadata": {},
"source": [
"### Imports"
]
},
{
Expand All @@ -24,6 +43,14 @@
"from flopy.utils.triangle import Triangle as Triangle"
]
},
{
"cell_type": "markdown",
"id": "01909c79-e3d5-45c9-b058-ffb1d8216f51",
"metadata": {},
"source": [
"### Load and Plot the Existing Flow Model"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -100,7 +127,7 @@
"id": "24a69ac7-9fd0-4dbb-940e-138f7a7493e5",
"metadata": {},
"source": [
"Determine the cell number of the constant concentration"
"Assign a constant concentration condition to the x, y location of 550, 7900. Use the `modelgrid.intersect` method to determine the cell number for the constant concentration condition."
]
},
{
Expand Down Expand Up @@ -138,7 +165,7 @@
"id": "e664ff92-50bf-444b-b78d-86d85e2497e8",
"metadata": {},
"source": [
"### Create the GWT Model"
"### Create the Groundwater Transport Model"
]
},
{
Expand Down Expand Up @@ -282,6 +309,14 @@
"sim_gwt.write_simulation()"
]
},
{
"cell_type": "markdown",
"id": "cc7c4f0c-1dc6-4a1b-b933-caa6ba5c360f",
"metadata": {},
"source": [
"### Run the Solute Transport Model"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -297,7 +332,7 @@
"id": "dab370b7-c023-402a-bf3d-792cc82ad4de",
"metadata": {},
"source": [
"#### Post-process the results"
"### Post-process the results"
]
},
{
Expand Down Expand Up @@ -422,7 +457,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "pyclass",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -436,7 +471,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down

0 comments on commit eec977f

Please sign in to comment.