Skip to content

Commit b2b8932

Browse files
authored
Merge pull request #167 from mbakker7/use_ttim_line_elements
Use ttim line elements
2 parents ba3c105 + 30d1b62 commit b2b8932

21 files changed

+1875
-145
lines changed

docs/02examples/02_wells_rivers_and_recharge.ipynb

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@
4949
"outputs": [],
5050
"source": [
5151
"# Create basic model elements\n",
52-
"ml = tml.ModelMaq(\n",
53-
" kaq=[2, 6, 4], z=[165, 140, 120, 80, 60, 0], c=[2000, 20000], npor=0.3\n",
54-
")\n",
52+
"ml = tml.ModelMaq(kaq=[2, 6, 4], z=[165, 140, 120, 80, 60, 0], c=[2000, 20000], npor=0.3)\n",
5553
"rf = tml.Constant(ml, xr=20000, yr=20000, hr=175, layer=0)\n",
5654
"p = tml.CircAreaSink(ml, xc=10000, yc=10000, R=15000, N=0.0002, layer=0)\n",
5755
"w1 = tml.Well(ml, xw=10000, yw=8000, Qw=1000, rw=0.3, layers=0, label=\"well 1\")\n",
@@ -97,10 +95,10 @@
9795
"]\n",
9896
"hls4 = [170, np.nan, 166, np.nan, 162, np.nan, np.nan, 156]\n",
9997
"\n",
100-
"ls1 = tml.HeadLineSinkString(ml, xy=xy1, hls=hls1, layers=0)\n",
101-
"ls2 = tml.HeadLineSinkString(ml, xy=xy2, hls=hls2, layers=0)\n",
102-
"ls3 = tml.HeadLineSinkString(ml, xy=xy3, hls=hls3, layers=0)\n",
103-
"ls4 = tml.HeadLineSinkString(ml, xy=xy4, hls=hls4, layers=0)"
98+
"ls1 = tml.RiverString(ml, xy=xy1, hls=hls1, layers=0)\n",
99+
"ls2 = tml.RiverString(ml, xy=xy2, hls=hls2, layers=0)\n",
100+
"ls3 = tml.RiverString(ml, xy=xy3, hls=hls3, layers=0)\n",
101+
"ls4 = tml.RiverString(ml, xy=xy4, hls=hls4, layers=0)"
104102
]
105103
},
106104
{
@@ -185,6 +183,13 @@
185183
"w3.plotcapzone(hstepmax=50, nt=10, zstart=30, tmax=50 * 365.25, orientation=\"both\")\n",
186184
"w3.plotcapzone(hstepmax=50, nt=10, zstart=100, tmax=50 * 365.25, orientation=\"both\")"
187185
]
186+
},
187+
{
188+
"cell_type": "code",
189+
"execution_count": null,
190+
"metadata": {},
191+
"outputs": [],
192+
"source": []
188193
}
189194
],
190195
"metadata": {

docs/02examples/04_horizontal_wells.ipynb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,7 @@
238238
"metadata": {},
239239
"outputs": [],
240240
"source": [
241-
"ml.plots.vcontour(\n",
242-
" win=[-400, 400, 0, 0], n=200, levels=20, vinterp=False, figsize=(16, 4)\n",
243-
")"
241+
"ml.plots.vcontour(win=[-400, 400, 0, 0], n=200, levels=20, vinterp=False, figsize=(16, 4))"
244242
]
245243
},
246244
{
@@ -293,9 +291,7 @@
293291
"metadata": {},
294292
"outputs": [],
295293
"source": [
296-
"ml.plots.vcontour(\n",
297-
" win=[-400, 400, 0, 0], n=200, levels=20, vinterp=False, figsize=(16, 4)\n",
298-
")"
294+
"ml.plots.vcontour(win=[-400, 400, 0, 0], n=200, levels=20, vinterp=False, figsize=(16, 4))"
299295
]
300296
},
301297
{

docs/02examples/building_pit.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
" layers=layers,\n",
195195
")\n",
196196
"\n",
197-
"tml.HeadLineSink(\n",
197+
"tml.River(\n",
198198
" ml,\n",
199199
" x1=-length / 2 + offset,\n",
200200
" y1=width / 2 - offset,\n",
@@ -203,7 +203,7 @@
203203
" hls=h_bem,\n",
204204
" layers=np.arange(last_lay_dw + 1),\n",
205205
")\n",
206-
"tml.HeadLineSink(\n",
206+
"tml.River(\n",
207207
" ml,\n",
208208
" x1=-length / 2 + offset,\n",
209209
" y1=0,\n",
@@ -212,7 +212,7 @@
212212
" hls=h_bem,\n",
213213
" layers=np.arange(last_lay_dw + 1),\n",
214214
")\n",
215-
"tml.HeadLineSink(\n",
215+
"tml.River(\n",
216216
" ml,\n",
217217
" x1=-length / 2 + offset,\n",
218218
" y1=-width / 2 + offset,\n",
@@ -228,7 +228,7 @@
228228
"Qtot = 0.0\n",
229229
"\n",
230230
"for e in ml.elementlist:\n",
231-
" if e.name == \"HeadLineSink\":\n",
231+
" if e.name == \"River\":\n",
232232
" Qtot += e.discharge()\n",
233233
"\n",
234234
"print(\"\\nDischarge =\", np.round(Qtot.sum(), 2), \"m^3/day\")\n",
@@ -471,7 +471,7 @@
471471
"wlayers = np.arange(np.sum(-14 <= ml.aq.zaqbot))\n",
472472
"wlayers = wlayers[1:]\n",
473473
"\n",
474-
"tml.HeadLineSink(\n",
474+
"tml.River(\n",
475475
" ml,\n",
476476
" x1=-length / 2 + offset,\n",
477477
" y1=width / 2 - offset,\n",
@@ -480,7 +480,7 @@
480480
" hls=h_bem,\n",
481481
" layers=wlayers,\n",
482482
")\n",
483-
"tml.HeadLineSink(\n",
483+
"tml.River(\n",
484484
" ml,\n",
485485
" x1=-length / 2 + offset,\n",
486486
" y1=0,\n",
@@ -490,7 +490,7 @@
490490
" layers=wlayers,\n",
491491
" order=5,\n",
492492
")\n",
493-
"tml.HeadLineSink(\n",
493+
"tml.River(\n",
494494
" ml,\n",
495495
" x1=-length / 2 + offset,\n",
496496
" y1=-width / 2 + offset,\n",
@@ -506,7 +506,7 @@
506506
"Qtot_ml = 0.0\n",
507507
"\n",
508508
"for e in ml.elementlist:\n",
509-
" if e.name == \"HeadLineSink\":\n",
509+
" if e.name == \"River\":\n",
510510
" Qtot_ml += e.discharge()\n",
511511
"\n",
512512
"print(\"\\nDischarge =\", np.round(Qtot_ml.sum(), 2), \"m^3/day\")\n",

docs/04tests/test_linesink_discharge.ipynb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"metadata": {},
4747
"outputs": [],
4848
"source": [
49-
"print(\"head at center of line-sink:\", ml1.head(ls1.xc, ls1.yc))\n",
49+
"print(\"head at center of line-sink:\", ml1.head(ls1.xc[0], ls1.yc[0]))\n",
5050
"print(\"discharge of line-sink:\", ls1.discharge())"
5151
]
5252
},
@@ -732,16 +732,28 @@
732732
"metadata": {},
733733
"outputs": [],
734734
"source": [
735-
"ml.plots.vcontour(\n",
736-
" win=[-20, 20, 0, 0], n=100, levels=20, layout=True, horizontal_axis=\"x\"\n",
737-
")\n",
735+
"ml.plots.vcontour(win=[-20, 20, 0, 0], n=100, levels=20, layout=True, horizontal_axis=\"x\")\n",
738736
"plt.xlabel(\"x (m)\");"
739737
]
740738
}
741739
],
742740
"metadata": {
741+
"kernelspec": {
742+
"display_name": "Python 3 (ipykernel)",
743+
"language": "python",
744+
"name": "python3"
745+
},
743746
"language_info": {
744-
"name": "python"
747+
"codemirror_mode": {
748+
"name": "ipython",
749+
"version": 3
750+
},
751+
"file_extension": ".py",
752+
"mimetype": "text/x-python",
753+
"name": "python",
754+
"nbconvert_exporter": "python",
755+
"pygments_lexer": "ipython3",
756+
"version": "3.13.5"
745757
}
746758
},
747759
"nbformat": 4,

docs/04tests/test_normal_flux.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@
223223
"for i in range(len(xy_out) - 1):\n",
224224
" xyi = np.array(xy_out[i : i + 2])\n",
225225
" (p2,) = plt.plot(xyi[:, 0], xyi[:, 1], ls=\"dashed\", color=\"r\", label=\"well outside\")\n",
226-
"plt.legend(\n",
227-
" [p1, p2], [p1.get_label(), p2.get_label()], loc=(0, 1), frameon=False, ncol=2\n",
228-
")\n",
226+
"plt.legend([p1, p2], [p1.get_label(), p2.get_label()], loc=(0, 1), frameon=False, ncol=2)\n",
229227
"plt.grid(True)"
230228
]
231229
},

docs/04tests/test_polygon_areasink.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@
4848
"metadata": {},
4949
"outputs": [],
5050
"source": [
51-
"ml.plots.contour(\n",
52-
" win=[-100, 100, -100, 100], ngr=100, layers=[0], levels=20, labels=False\n",
53-
")"
51+
"ml.plots.contour(win=[-100, 100, -100, 100], ngr=100, layers=[0], levels=20, labels=False)"
5452
]
5553
},
5654
{

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ packages = ["timml", "timml.besselaesnumba"]
6161
version = { attr = "timml.version.__version__" }
6262

6363
[tool.ruff]
64-
line-length = 88
64+
line-length = 90
6565
extend-include = ["*.ipynb"]
6666

6767
[tool.ruff.lint]

timml/aquifer_parameters.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@ def param_3d(kaq, z, kzoverkh, npor, top="conf", topres=0):
129129
)
130130
H = z[:-1] - z[1:]
131131
assert np.all(H >= 0), "Error: Not all layers thicknesses are non-negative" + str(H)
132-
c = 0.5 * H[:-1] / (kzoverkh[:-1] * kaq[:-1]) + 0.5 * H[1:] / (
133-
kzoverkh[1:] * kaq[1:]
134-
)
132+
c = 0.5 * H[:-1] / (kzoverkh[:-1] * kaq[:-1]) + 0.5 * H[1:] / (kzoverkh[1:] * kaq[1:])
135133
if top == "conf":
136134
c = np.hstack((1e100, c))
137135
elif top == "semi":

timml/besselaesnumba/besselaesnumba.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -479,12 +479,12 @@ def IntegralF(zin, z1in, z2in, Lin, labda, order, Rconv, lstype):
479479
cln1 = np.log(cd1minz)
480480
cln2 = np.log(cd2minz)
481481
for n in range(0, 2 * NTERMS + order + 1):
482-
cInt = cInt + (
483-
2.0 * calpha[n] * cln2 - 2.0 * calpha[n] / (n + 1) + cbeta[n]
484-
) * (cd2minz) ** (n + 1) / float(n + 1)
485-
cInt = cInt - (
486-
2.0 * calpha[n] * cln1 - 2.0 * calpha[n] / (n + 1) + cbeta[n]
487-
) * (cd1minz) ** (n + 1) / float(n + 1)
482+
cInt = cInt + (2.0 * calpha[n] * cln2 - 2.0 * calpha[n] / (n + 1) + cbeta[n]) * (
483+
cd2minz
484+
) ** (n + 1) / float(n + 1)
485+
cInt = cInt - (2.0 * calpha[n] * cln1 - 2.0 * calpha[n] / (n + 1) + cbeta[n]) * (
486+
cd1minz
487+
) ** (n + 1) / float(n + 1)
488488
pot = np.real(cInt) * biglab / (2.0 * np.pi)
489489
return pot
490490

@@ -624,12 +624,12 @@ def IntegralG(zin, z1in, z2in, Lin, labda, order, Rconv, lstype):
624624
cln1 = np.conj(cln1)
625625
cln2 = np.conj(cln2)
626626
for n in range(0, 2 * NTERMS + order):
627-
g3 = g3 - (calpha[n] * cln2 - calpha[n] / (n + 1)) * (cd2minz) ** (
627+
g3 = g3 - (calpha[n] * cln2 - calpha[n] / (n + 1)) * (cd2minz) ** (n + 1) / float(
628628
n + 1
629-
) / float(n + 1)
630-
g3 = g3 + (calpha[n] * cln1 - calpha[n] / (n + 1)) * (cd1minz) ** (
629+
)
630+
g3 = g3 + (calpha[n] * cln1 - calpha[n] / (n + 1)) * (cd1minz) ** (n + 1) / float(
631631
n + 1
632-
) / float(n + 1)
632+
)
633633
g3 = biglabin * g3 / (2.0 * np.pi)
634634
wdis = g1 + g2 + g3
635635
return wdis

timml/besselaesnumba/besselaesnumba_old.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -467,12 +467,12 @@ def IntegralF(zin, z1in, z2in, Lin, labda, order, Rconv, lstype):
467467
cln1 = np.log(cd1minz)
468468
cln2 = np.log(cd2minz)
469469
for n in range(0, 2 * NTERMS + order + 1):
470-
cInt = cInt + (
471-
2.0 * calpha[n] * cln2 - 2.0 * calpha[n] / (n + 1) + cbeta[n]
472-
) * (cd2minz) ** (n + 1) / float(n + 1)
473-
cInt = cInt - (
474-
2.0 * calpha[n] * cln1 - 2.0 * calpha[n] / (n + 1) + cbeta[n]
475-
) * (cd1minz) ** (n + 1) / float(n + 1)
470+
cInt = cInt + (2.0 * calpha[n] * cln2 - 2.0 * calpha[n] / (n + 1) + cbeta[n]) * (
471+
cd2minz
472+
) ** (n + 1) / float(n + 1)
473+
cInt = cInt - (2.0 * calpha[n] * cln1 - 2.0 * calpha[n] / (n + 1) + cbeta[n]) * (
474+
cd1minz
475+
) ** (n + 1) / float(n + 1)
476476
pot = np.real(cInt) * biglab / (2.0 * np.pi)
477477
return pot
478478

@@ -612,12 +612,12 @@ def IntegralG(zin, z1in, z2in, Lin, labda, order, Rconv, lstype):
612612
cln1 = np.conj(cln1)
613613
cln2 = np.conj(cln2)
614614
for n in range(0, 2 * NTERMS + order):
615-
g3 = g3 - (calpha[n] * cln2 - calpha[n] / (n + 1)) * (cd2minz) ** (
615+
g3 = g3 - (calpha[n] * cln2 - calpha[n] / (n + 1)) * (cd2minz) ** (n + 1) / float(
616616
n + 1
617-
) / float(n + 1)
618-
g3 = g3 + (calpha[n] * cln1 - calpha[n] / (n + 1)) * (cd1minz) ** (
617+
)
618+
g3 = g3 + (calpha[n] * cln1 - calpha[n] / (n + 1)) * (cd1minz) ** (n + 1) / float(
619619
n + 1
620-
) / float(n + 1)
620+
)
621621
g3 = biglabin * g3 / (2.0 * np.pi)
622622
wdis = g1 + g2 + g3
623623
return wdis

0 commit comments

Comments
 (0)