Skip to content

pinshuai/HFR-flow

Repository files navigation

Binder Colab

Workflow for PFLOTRAN simulations

The following workflow provides some guidance on running flow and transport model using PFLOTRAN. This workflow has been used to generate a reach scale flow and transport model for the Hanford Reach, Washington. The simulation results have recently been published in Water Resources Research.

Shuai, P., X. Chen, X. Song, G. Hammond, J. Zachara, P. Royer, H. Ren, W. Perkins, M. Richmond, M. Huang (2018). Dam Operations and Subsurface Hydrogeology Control Dynamics of Hydrologic Exchange Flows in a Regulated River Reach. Water Resources Research. https://doi.org/10.1029/2018WR024193

Software needed in the workflow: Jupyter Notebook, Paraview, HDFView

Table of Contents

Model pre-processes

Run PFLOTRAN_preprocesses.ipynb to configurate model setup (model domain, parameters, inital conditions and boundary conditions and etc.) This Jupyter Notebook uses R as the kernel.

Model inputs

This section gathers model parameters such as dimension, coordinates for the structured grids.

Import geoframework

This section gathers the geologic framework for the model. Each geologic layer is an Ascii file that contains the topography for each geologic unit. It can be interpolated to the model grids.

Generate material ids and river faces

This section generates material id for each grid cell and finds the river boundary cells (where river stage is applied). Output: Material.h5

A sample material ids are listed below. Please note id = 0 is reserved for inactive cells.

Material id Unit
0 Inactive cells
1 Hf
2 Cc
3 Rtf
4 Re
5 Rlm
6 Ra
Material_h5.png
A snapshot of the Material.h5

Generate initial head and inland boundary

This section generates the initial head over the domain and the head boundary at model bounds. Output: Initial.h5 and BC.h5

Initial_h5.png
A snapshot of the Initial.h5
BC_h5.png
A snapshot of the BC.h5

Generate river boundary

This section generates transient river stage boundary. Output: Gradient.txt and Datum.txt

Note: the default time unit in external file is in seconds. You can change the time unit by specifying TIME_UNITS hr as the header in .txt file. See this example.

An example of the Gradient.txt (header should not go into the .txt file):

time (sec) grad_x grad_y grad_z
0. 4E-05 4E-05 0

An example of the Datum.txt (header should not go into the .txt file):

time (sec) x y z (stage)
0. 1000 2000 105.6
model_domain.png
Figure showing model domain


PFLOTRAN input deck

Run PFLOTRAN_input_deck.ipynb to generate PFLOTRAN input deck for the model. This notebook uses R as the kernel. Right now, the sink and cat function do not work properly in Jupyter Notebook. The alternative is to export this notebook as R script, and use Rstudio to execute.

A set of parameters can be set: model run time, timestep, hydraulic properties, river conductance, observation wells, output variables and file format and etc. A sample pflotran input deck can be found here. Output: pflotran.in

A sample hydraulic properties are listed below:

Unit Permeability ($m^{2}$) Hydraulic conductivity ($m/d$)
Hanford (Hf) 7e-09 7000
Cold Creek (Cc) 1e-10 100
Ringold Taylor Flats (Rtf) 1e-12 1
Ringold E (Re) 4e-11 40
Ringold Lower Mud (Rlm) 1e-12 1
Ringold A (Ra) 1e-12 1


Submit and run jobs on NERSC

run_job_on_NERSC.ipynb has some batch script to submit, monitor and modify jobs on NERSC.

An example batch script:

#!/bin/bash -l

#SBATCH -A m1800
#SBATCH -N 171
#SBATCH -t 48:00:00
#SBATCH -L SCRATCH  
#SBATCH -J job_name
#SBATCH --qos regular
#SBATCH --mail-type ALL
#SBATCH --mail-user <user_email>

cd $SLURM_SUBMIT_DIR

srun -n 4096 /global/project/projectdirs/pflotran/pflotran-edison/src/pflotran/pflotran -pflotranin pflotran.in


Post-processes

This section has some python script for post-processing data from PFLOTRAN outputs and generate plots.

Visulization in Paraview

Paraview can be easily used to open PFLOTRAN output HDF5 file (i.e. pflotran.h5). It visulizes the model in 3-D and can be used to export plots and animations. For detailed instruction, please take a look at Paraview manual.

Paraview can also be run in batch mode on NERSC documentation.

paraview_snapshot.png
A snapshot of Paraview


Plot flux across riverbed from mass balance output

Run NERSC-plot_flux_from_massBalance.ipynb to generate flux heat map, net gaining and flux snapshots.

flux_heatmap.jpg
Flux heat map generated from the notebook

Plot flux across riverbed from river cells

Run NERSC-plot_flux_from_river_cells.ipynb to pre-process h5 outputs and generate absolute exchange bar plots.

flux_river_cell.jpg
Flux plot generated from the notebook

Plot groundwater level

Run NERSC-plot_gw_level.ipynb to generate groundwater level contours.

wl.png
Groundwater contour plot generated from the notebook

Plot groundwater age

Run NERSC-plot_gw_age.ipynb to generate groundwater age contours.

Plot solute contour

Run NERSC-plot_solute_contour.ipynb to generate solute concentration plots.

tracer.png
Groundwater tracer plot generated from the notebook

Plot simulation against observation

Run NERSC-plot_simu_obs_well_data.ipynb to generate tracer breakthough curves.

Well_399-1-1_sup.jpg
Tracer BTC against observation data plot generated from the notebook


Miscellaneous

Other notebooks that are used for post-processing.

Import data using SQL

Table name Description
pflow.GW_SAMPLE_RESULTS_MV HEIS--ALL groundwater chemistry data
pflow.well_construction_mv HEIS--well construction data, includes depth, casing, and other fields
pflow.HYDRAULIC_HEAD_MV HEIS--manual water level data
pflow.tblWells HEIS--AWLN well information
pflow.tblProcessedData HEIS--AWLN raw data (hourly)
pflow.vAwln a view of Awln data that includes Hanford well names

note: table name above begin with "v" indiates it is a view that Patrick created and it is not a token from HEIS, rather , it is a query based on the HEIS database.

  • Run external GIS application (ArcGIS/QGIS) to retrieve GIS data (such as well locations, geologic units and plumes) using PostgreSQL/PostGIS access.

Plot groundwater chemistry data

Batch process figures in ImageMagick

Spectral analysis

Rewrite HDF5



About

repo for setting up reach-scale flow model

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published