Skip to content

Commit 2ae7f54

Browse files
authored
Merge pull request #246 from amoodie/docs_init
add some initialization documentation, reogranize files.
2 parents 6a6b9f1 + 76191ba commit 2ae7f54

File tree

7 files changed

+411
-42
lines changed

7 files changed

+411
-42
lines changed

docs/source/info/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ All of these questions and more are answered here!
1414
.. toctree::
1515
:maxdepth: 1
1616

17+
initialization
1718
yamlparameters
1819
modeltime
1920
hydrodynamics
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
**************
2+
Initialization
3+
**************
4+
5+
.. currentmodule:: pyDeltaRCM.init_tools
6+
7+
There are many built-in parameters for setting up pyDeltaRCM runs.
8+
9+
10+
Domain configuration
11+
====================
12+
13+
The domain configuration is controlled by a series of input configuration parameters.
14+
Conceptually, we can consider the domain of pyDeltaRCM to be made up of an *inlet* along the top edge of the model domain and bounded by a strip of land, and the *basin*.
15+
16+
.. plot:: init_tools/domain_parameters.py
17+
18+
By default, the basin and inlet are both flat and have the same depth. However these characteristics can be controlled by a variety of input parameters explained below.
19+
Moreover, any complex initial geometry can be configured by the use of hooks; see an example here :doc:`../examples/slight_slope`.
20+
21+
Domain size
22+
-----------
23+
24+
The domain size is controlled by the `Length` and `Width` YAML parameters.
25+
26+
.. plot:: init_tools/domain_size_compare.py
27+
28+
.. hint::
29+
30+
The size of the computational domain is determined by the size of the smallest size of the domain. The value for `Width` should almost always be 2 times `Length` to minimize unecessary calcualtions outside the valid computational domain.
31+
32+
Importantly, the number of cells in the domain is then a function of the domain size in meters and the grid spacing :obj:`dx`.
33+
Because the number of grid cells is inverse nonlinearly related to the grid spacing (:math:`numcells = 1/dx^2`), the model runtime is sensitive to the choice of `dx` relative to `Length` and `Width`.
34+
35+
36+
Basin depth and inlet depth
37+
---------------------------
38+
39+
Inlet depth is controlled by :obj:`h0`.
40+
If no argument is given in the configuration for the parameter :obj:`hb`, then the basin depth is determined to be the same as the inlet depth.
41+
However, these depths can be controlled independently.
42+
43+
.. plot:: init_tools/domain_basin_inlet_depth.py
44+
45+
46+
Inlet width and length
47+
----------------------
48+
49+
The inlet length and width are controlled by an inlet length parameter :obj:`L0_meters` and an inlet width parameter :obj:`N0_meters`.
50+
In implementation, the input length and width are rounded to the nearest grid location (a function of :obj:`dx`).
51+
52+
.. plot:: init_tools/domain_inlet_geometry.py
53+
54+
55+
56+
Input water and sediment
57+
========================
58+
59+
The input flow velocity is determined by :obj:`u0`.
60+
61+
The input water discharge is thus fully constrained by the inlet geometry and the inlet flow velocity as:
62+
63+
.. math::
64+
Q_{w0} = h_0 \times N_0 \times u_0
65+
66+
.. hint::
67+
Keep in mind that :math:`N_0` is specified in meters as :obj:`N0_meters` in the input configuration. Ditto for the inlet length (:obj:`L0_meters`).
68+
69+
70+
Input sediment discharge is then determined by a **percentage concentration** of sediment in the flow :obj:`C0_percent`.
71+
72+
.. math::
73+
Q_{s0} = Q_{w0} \times (C_{0percent}/100)
74+
75+
The volume of each parcel of water to be routed is then determined by the total water discharge divided by the number of parcels :obj:`Np_water`.
76+
The volume of each parcel of sediment to be routed is then determined by the total sediment discharge divided by the number of parcels :obj:`Np_sed`.
77+
78+
The number of sand and mud parcels are then determined as `Np_sed` times :obj:`f_bedload` and `Np_sed` times (1-:obj:`f_bedload`), respectively.

docs/source/info/yamlparameters.rst

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ Model Settings
2222

2323
:attr:`pyDeltaRCM.model.DeltaModel.verbose`
2424

25-
:attr:`pyDeltaRCM.model.DeltaModel.seed`
26-
2725

2826
.. _model-domain-parameters:
2927

@@ -38,18 +36,20 @@ Model Domain Parameters
3836

3937
:attr:`pyDeltaRCM.model.DeltaModel.L0_meters`
4038

39+
:attr:`pyDeltaRCM.model.DeltaModel.N0_meters`
40+
4141
:attr:`pyDeltaRCM.model.DeltaModel.S0`
4242

4343
:attr:`pyDeltaRCM.model.DeltaModel.u0`
4444

45-
:attr:`pyDeltaRCM.model.DeltaModel.N0_meters`
46-
4745
:attr:`pyDeltaRCM.model.DeltaModel.h0`
4846

4947
:attr:`pyDeltaRCM.model.DeltaModel.hb`
5048

5149
:attr:`pyDeltaRCM.model.DeltaModel.H_SL`
5250

51+
:attr:`pyDeltaRCM.model.DeltaModel.seed`
52+
5353
:attr:`pyDeltaRCM.model.DeltaModel.SLR`
5454

5555
:attr:`pyDeltaRCM.model.DeltaModel.f_bedload`
@@ -65,6 +65,44 @@ Model Domain Parameters
6565
:attr:`pyDeltaRCM.model.DeltaModel.start_subsidence`
6666

6767

68+
Reduced-Complexity Routing Parameters
69+
=====================================
70+
71+
:attr:`pyDeltaRCM.model.DeltaModel.Np_water`
72+
73+
:attr:`pyDeltaRCM.model.DeltaModel.Np_sed`
74+
75+
:attr:`pyDeltaRCM.model.DeltaModel.omega_sfc`
76+
77+
:attr:`pyDeltaRCM.model.DeltaModel.omega_flow`
78+
79+
:attr:`pyDeltaRCM.model.DeltaModel.Nsmooth`
80+
81+
:attr:`pyDeltaRCM.model.DeltaModel.Csmooth`
82+
83+
:attr:`pyDeltaRCM.model.DeltaModel.theta_water`
84+
85+
:attr:`pyDeltaRCM.model.DeltaModel.coeff_theta_sand`
86+
87+
:attr:`pyDeltaRCM.model.DeltaModel.coeff_theta_mud`
88+
89+
:attr:`pyDeltaRCM.model.DeltaModel.beta`
90+
91+
:attr:`pyDeltaRCM.model.DeltaModel.sed_lag`
92+
93+
:attr:`pyDeltaRCM.model.DeltaModel.coeff_U_dep_mud`
94+
95+
:attr:`pyDeltaRCM.model.DeltaModel.coeff_U_ero_mud`
96+
97+
:attr:`pyDeltaRCM.model.DeltaModel.coeff_U_ero_sand`
98+
99+
:attr:`pyDeltaRCM.model.DeltaModel.alpha`
100+
101+
:attr:`pyDeltaRCM.model.DeltaModel.itermax`
102+
103+
:attr:`pyDeltaRCM.model.DeltaModel.stepmax`
104+
105+
68106
Output Settings
69107
===============
70108

@@ -113,41 +151,3 @@ Output Settings
113151
:attr:`pyDeltaRCM.model.DeltaModel.clobber_netcdf`
114152

115153
:attr:`pyDeltaRCM.model.DeltaModel.legacy_netcdf`
116-
117-
118-
Reduced-Complexity Routing Parameters
119-
=====================================
120-
121-
:attr:`pyDeltaRCM.model.DeltaModel.Np_sed`
122-
123-
:attr:`pyDeltaRCM.model.DeltaModel.Np_water`
124-
125-
:attr:`pyDeltaRCM.model.DeltaModel.omega_sfc`
126-
127-
:attr:`pyDeltaRCM.model.DeltaModel.omega_flow`
128-
129-
:attr:`pyDeltaRCM.model.DeltaModel.itermax`
130-
131-
:attr:`pyDeltaRCM.model.DeltaModel.Nsmooth`
132-
133-
:attr:`pyDeltaRCM.model.DeltaModel.Csmooth`
134-
135-
:attr:`pyDeltaRCM.model.DeltaModel.theta_water`
136-
137-
:attr:`pyDeltaRCM.model.DeltaModel.coeff_theta_sand`
138-
139-
:attr:`pyDeltaRCM.model.DeltaModel.coeff_theta_mud`
140-
141-
:attr:`pyDeltaRCM.model.DeltaModel.beta`
142-
143-
:attr:`pyDeltaRCM.model.DeltaModel.sed_lag`
144-
145-
:attr:`pyDeltaRCM.model.DeltaModel.coeff_U_dep_mud`
146-
147-
:attr:`pyDeltaRCM.model.DeltaModel.coeff_U_ero_mud`
148-
149-
:attr:`pyDeltaRCM.model.DeltaModel.coeff_U_ero_sand`
150-
151-
:attr:`pyDeltaRCM.model.DeltaModel.alpha`
152-
153-
:attr:`pyDeltaRCM.model.DeltaModel.stepmax`
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import warnings
2+
3+
import matplotlib
4+
import matplotlib.pyplot as plt
5+
6+
import pyDeltaRCM
7+
8+
9+
# filter out the warning raised about no netcdf being found
10+
warnings.filterwarnings("ignore", category=UserWarning)
11+
12+
13+
n = 1
14+
cm = matplotlib.colormaps.get_cmap("tab10")
15+
16+
param_dict = {"timesteps": 0}
17+
_matrix = {"h0": [2, 5], "hb": [2, 5]}
18+
param_dict["matrix"] = _matrix
19+
param_dict["L0_meters"] = 500
20+
param_dict["N0_meters"] = 500
21+
22+
# init delta models with preprocessor
23+
with pyDeltaRCM.shared_tools._docs_temp_directory() as output_dir:
24+
param_dict.update({"out_dir": output_dir})
25+
26+
pp = pyDeltaRCM.preprocessor.Preprocessor(param_dict)
27+
28+
pp.run_jobs()
29+
30+
31+
fig, ax = plt.subplots(
32+
2, 2, figsize=(6, 4), subplot_kw=dict(aspect="equal"), sharex=True, sharey=True
33+
)
34+
35+
ax = ax.ravel()
36+
for i in range(4):
37+
ax[i].imshow(
38+
pp.job_list[i].deltamodel.eta,
39+
interpolation="none",
40+
extent=[
41+
0,
42+
pp.job_list[i].deltamodel.Width,
43+
pp.job_list[i].deltamodel.Length,
44+
0,
45+
],
46+
)
47+
ax[i].text(
48+
0.05,
49+
0.05,
50+
f"h0: {pp.job_list[i].deltamodel.h0}\nhb: {pp.job_list[i].deltamodel.hb}",
51+
ha="left",
52+
va="bottom",
53+
color="white",
54+
fontsize=8,
55+
transform=ax[i].transAxes,
56+
)
57+
58+
for i, axi in enumerate(ax.ravel()):
59+
axi.tick_params(labelsize=7)
60+
if i % 2 == 0:
61+
axi.set_ylabel("Length", fontsize=8)
62+
if i > 2:
63+
axi.set_xlabel("Width", fontsize=8)
64+
65+
plt.tight_layout()
66+
plt.show()
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import warnings
2+
3+
import matplotlib
4+
import matplotlib.pyplot as plt
5+
6+
import pyDeltaRCM
7+
8+
9+
# filter out the warning raised about no netcdf being found
10+
warnings.filterwarnings("ignore", category=UserWarning)
11+
12+
13+
n = 1
14+
cm = matplotlib.colormaps.get_cmap("tab10")
15+
16+
param_dict = {"timesteps": 0}
17+
_matrix = {"L0_meters": [200, 500, 1000], "N0_meters": [200, 500, 1000]}
18+
param_dict["matrix"] = _matrix
19+
20+
# init delta models with preprocessor
21+
with pyDeltaRCM.shared_tools._docs_temp_directory() as output_dir:
22+
param_dict.update({"out_dir": output_dir})
23+
24+
pp = pyDeltaRCM.preprocessor.Preprocessor(param_dict)
25+
26+
pp.run_jobs()
27+
28+
29+
fig, ax = plt.subplots(
30+
3, 3, figsize=(9, 5), subplot_kw=dict(aspect="equal"), sharex=True, sharey=True
31+
)
32+
33+
ax = ax.ravel()
34+
for i in range(9):
35+
ax[i].imshow(
36+
pp.job_list[i].deltamodel.eta,
37+
interpolation="none",
38+
extent=[
39+
0,
40+
pp.job_list[i].deltamodel.Width,
41+
pp.job_list[i].deltamodel.Length,
42+
0,
43+
],
44+
)
45+
ax[i].text(
46+
0.05,
47+
0.05,
48+
f"L0_meters: {pp.job_list[i].deltamodel.L0_meters}\nN0_meters: {pp.job_list[i].deltamodel.N0_meters}",
49+
ha="left",
50+
va="bottom",
51+
color="white",
52+
fontsize=8,
53+
transform=ax[i].transAxes,
54+
)
55+
56+
for i, axi in enumerate(ax.ravel()):
57+
axi.tick_params(labelsize=7)
58+
if i % 3 == 0:
59+
axi.set_ylabel("Length", fontsize=8)
60+
if i > 6:
61+
axi.set_xlabel("Width", fontsize=8)
62+
63+
plt.tight_layout()
64+
plt.show()

0 commit comments

Comments
 (0)