From ed7c00cbf007b2f2f1a4efd46b14531eef78d8b7 Mon Sep 17 00:00:00 2001 From: Phong Le Date: Fri, 8 Nov 2024 22:35:05 -0500 Subject: [PATCH] add integrated and extract transport runs, including changes in notebooks --- .gitignore | 9 +- 2-transport/solution_transport.xml | 570 ++++++++++++++++++ 2-transport/transport.xml | 265 ++------ 3-submesh/solution_submesh_transport.xml | 523 ++++++++++++++++ 3-submesh/submesh_transport.xml | 470 +++++++++++++++ README.md | 44 +- notebooks/1-hydrology.ipynb | 329 ++++++++++ notebooks/2-transport_integrated.ipynb | 402 ++++++++++++ notebooks/3-submesh_transport.ipynb | 353 +++++++++++ notebooks/hydro_analysis.ipynb | 323 ---------- .../libs/{vismesh_funcs.py => ats_vis.py} | 356 +++++++++-- 11 files changed, 3054 insertions(+), 590 deletions(-) create mode 100644 2-transport/solution_transport.xml create mode 100644 3-submesh/solution_submesh_transport.xml create mode 100644 3-submesh/submesh_transport.xml create mode 100644 notebooks/1-hydrology.ipynb create mode 100644 notebooks/2-transport_integrated.ipynb create mode 100644 notebooks/3-submesh_transport.ipynb delete mode 100644 notebooks/hydro_analysis.ipynb rename notebooks/libs/{vismesh_funcs.py => ats_vis.py} (54%) diff --git a/.gitignore b/.gitignore index d866c6f..6e28a1f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,11 @@ .vscode/ __pycache__/ -*.h5 +ats*.h5 +checkpoint*.h5 +ats*.xmf +observations.csv + 1-hydrology/results/ -2-transport/results/ \ No newline at end of file +2-transport/results/ +3-submesh/results/ \ No newline at end of file diff --git a/2-transport/solution_transport.xml b/2-transport/solution_transport.xml new file mode 100644 index 0000000..71e62c7 --- /dev/null +++ b/2-transport/solution_transport.xml @@ -0,0 +1,570 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/2-transport/transport.xml b/2-transport/transport.xml index c40ef3b..a3302f1 100644 --- a/2-transport/transport.xml +++ b/2-transport/transport.xml @@ -63,12 +63,12 @@ - - - - - - + @@ -77,38 +77,42 @@ + + - - - - - - + + + @@ -184,7 +188,7 @@ - + @@ -234,173 +238,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -427,8 +269,8 @@ - - + + @@ -562,12 +404,23 @@ - - - - - - + diff --git a/3-submesh/solution_submesh_transport.xml b/3-submesh/solution_submesh_transport.xml new file mode 100644 index 0000000..7450d49 --- /dev/null +++ b/3-submesh/solution_submesh_transport.xml @@ -0,0 +1,523 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/3-submesh/submesh_transport.xml b/3-submesh/submesh_transport.xml new file mode 100644 index 0000000..3dfa842 --- /dev/null +++ b/3-submesh/submesh_transport.xml @@ -0,0 +1,470 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 1cff2b0..1da7609 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,26 @@ # Amanzi-ATS Transport Tutorial -This hands-on tutorial offers a hands-on experience in setting up and running transport simulations based on hydrology models in [Amanzi-ATS](https://github.com/amanzi/ats). This is part of the IDEAS-Watershed All-hands Meeting 2024 in Denver, CO. +This hands-on tutorial offers a hands-on experience in setting up and running transport simulations based on hydrology models in [Amanzi-ATS](https://github.com/amanzi/ats). This is part of the [IDEAS-Watershed](https://ideas-watersheds.github.io/) all-hands meeting 2024 in Denver, CO. -**Facilitators:** Phong Le, Ethan Coon, Daniil Svyatsky +**Instructors:** Phong Le, Ethan Coon, Daniil Svyatsky --- -### 1. Learning Objectives +### 1. Learning Objectives :dart: By the end of this workshop, participants will be able to: -* Understand core concepts of the [transport process kernel (PK)](https://github.com/amanzi/ats/tree/master/src/pk_transport) in Amanzi-ATS -* Develop workflows that integrate transport processes into [hydrology](https://amanzi.github.io/ats/stable/input_spec/process_kernels/physical/flow.html) models +* Understand key concepts of the [transport](https://github.com/amanzi/ats/tree/master/src/pk_transport) process kernel (PK) in Amanzi-ATS; +* Develop workflows that integrate transport PK into [hydrology](https://amanzi.github.io/ats/stable/input_spec/process_kernels/physical/flow.html) PK. --- -### 2. Prerequisites +### 2. Prerequisites :bulb: To get the most out of this tutorial, participants should have: -* Basic skills in Python and familiarity with [Jupyter Notebook](https://jupyter.org/). We will use [PyVista](https://pyvista.org/) for visualization. +* Basic skills in [python](https://www.python.org/) and [jupyter notebook](https://jupyter.org/). We will use [pyvista](https://pyvista.org/) and [ipywidgets](https://ipywidgets.readthedocs.io/) for interactive visualization. * A fundamental understanding of watershed hydrology is encouraged. --- -### 3. Setup Instructions +### 3. Setup Instructions :wrench: +The tutorial will be conducted in a Docker container. The docker includes the `terminal`, `text editor`, `ats`, `python`, `jupyter notebook`, and other dependencies. The `text editor` is customized to better work with the `ats` input files in `xml` format. Follow the steps below to set up the environment. 1. **Pull the Docker Image:** Make sure to pull the Docker container for this tutorial: ```bash @@ -32,17 +33,26 @@ Start the container and open the Jupyter Notebook interface: docker run --rm -it -p 8888:8888 metsi/ideas-watersheds-all-hands-2024:v0 ``` -3. **Access Jupyter Notebooks:** -Open the link displayed in your terminal to access Jupyter Notebook in your browser. +3. **Access Jupyter notebooks:** +Open the link displayed in your terminal to access `jupyter notebook` in your browser. + +4. **Clone the tutorial repository:** +Open a terminal in the Jupyter notebook interface and run: +```bash +git clone https://github.com/amanzi/ats-hands-on-transport.git +``` + +> [!IMPORTANT] +> If you're familiar with the `VSCode` editor, you can use the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension to connect to the container and edit XML files. You can also use the [jupyter](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter) extension in `VSCode` to run notebooks directly within the Docker container. --- -### 4. Workshop Outline -* **Introduction to ATS Hydrology and Transport:** -Overview of fundamental equations in hydrology and transport in Amanzi-ATS +### 4. Workshop Outline :memo: +1. **Introduction to ATS Hydrology and Transport:** + *Overview of fundamental equations in hydrology and transport in Amanzi-ATS* -* **Hands-On Session: Building transport simulations:** -Step-by-step guidance on developing transport simulations in ATS based on the integrated hydrology model. +2. **Hands-On Session: Building Transport Simulations:** + *Step-by-step guidance on developing transport simulations in ATS based on the integrated hydrology model* -* **Discussion and Feedbacks** -Open session for questions, insights, and feedback on the tutorial content. +3. **Discussion and Feedback:** + *Open session for questions, insights, and feedback* diff --git a/notebooks/1-hydrology.ipynb b/notebooks/1-hydrology.ipynb new file mode 100644 index 0000000..2b66881 --- /dev/null +++ b/notebooks/1-hydrology.ipynb @@ -0,0 +1,329 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import sys\n", + "sys.path.append('./libs')\n", + "\n", + "%load_ext autoreload\n", + "%autoreload 2\n", + "import matplotlib.pyplot as plt\n", + "from matplotlib.ticker import MultipleLocator\n", + "import colorcet as cc\n", + "import numpy as np\n", + "import pandas as pd\n", + "import h5py\n", + "from ipywidgets import interact, widgets\n", + "import pyvista as pv\n", + "import ats_vis as atsvis\n", + "import ats_xdmf as ats_xdmf" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Visualize exodus2 mesh" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "efb5afc79b7e44268273f426db3a0c07", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Widget(value='