Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TTim to compute per log t-interval #74

Closed
wants to merge 37 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
66cbb16
Merge pull request #67 from mbakker7/dev
dbrakenhoff Sep 26, 2024
46d3da0
refactor model.py
dbrakenhoff Oct 29, 2024
95ab8cd
add initialize_interval
dbrakenhoff Oct 29, 2024
66ed452
refactor functions:
dbrakenhoff Oct 29, 2024
3ccdb8b
refactor solve()
dbrakenhoff Oct 29, 2024
88eea89
npint -> nppar
dbrakenhoff Oct 29, 2024
c5b8aff
refactor AquiferData
dbrakenhoff Oct 29, 2024
0861ee2
refactor WellBase
dbrakenhoff Oct 29, 2024
a647941
rename potinf to potinfall
dbrakenhoff Oct 29, 2024
5197c51
refactor Well
dbrakenhoff Oct 29, 2024
0582d91
fix super call
dbrakenhoff Oct 29, 2024
cc14baf
refactor Element
dbrakenhoff Oct 29, 2024
b874f11
refactor WellBoreStorageEquation
dbrakenhoff Oct 29, 2024
d084c71
refactor invlapnumba
dbrakenhoff Oct 29, 2024
10ef23d
add test notebook for Theis problem with log t intervals
dbrakenhoff Oct 29, 2024
acd0b12
Update aquifer.py
mbakker7 Nov 1, 2024
9acaa2e
comment about lababs
mbakker7 Nov 1, 2024
3d44800
Added Hantush
mbakker7 Nov 1, 2024
cb60548
allow time on right boundary of last interval
dbrakenhoff Nov 1, 2024
8a6e59f
start modifying disvec in Model, Element and Well classes
dbrakenhoff Nov 1, 2024
2abe17c
initialize arrays with dtype=complex
dbrakenhoff Nov 1, 2024
999407d
rename old disvec to disvecall
dbrakenhoff Nov 1, 2024
aae4ce6
initialize arrays or astype using float instead of "d"
dbrakenhoff Nov 1, 2024
d16271b
initialize arrays with dtype=complex
dbrakenhoff Nov 1, 2024
1fea1ac
adjust array sizes in element docstring
dbrakenhoff Nov 1, 2024
630d9e7
working on multi-layers systems
mbakker7 Nov 1, 2024
dbfd157
Working on multi-layer solution
mbakker7 Nov 2, 2024
90f7770
testing headwell
mbakker7 Nov 2, 2024
197d764
still working on HeadWell
mbakker7 Nov 2, 2024
1c40eb3
working on potinflayers
mbakker7 Nov 2, 2024
cf69b67
fixed potential function
mbakker7 Nov 2, 2024
8da751e
ml.potential fixed
mbakker7 Nov 2, 2024
b582daa
multi-layer pumping well works
mbakker7 Nov 2, 2024
5b25335
Fixed HeadWell by fixing storing parameters in ml.solve
mbakker7 Nov 3, 2024
9e6f76a
Modified DischargeWell
mbakker7 Nov 4, 2024
25cef84
Added comments
mbakker7 Nov 4, 2024
4241925
fixed dtype from "D" to complex
mbakker7 Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 105 additions & 3 deletions docs/03examples/test_t_intervals2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,112 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"self.neq 3\n",
"solution complete\n"
]
}
],
"source": [
"k = 25\n",
"H = 20\n",
"Ss = 1e-4 / H\n",
"t = np.logspace(0, 1, 100)\n",
"Q = 500\n",
"rw = 0.2\n",
"hwell = -2\n",
"\n",
"ml = ttim.Model3D(kaq=k, z=np.linspace(H, 0, 3), Saq=Ss, tmin=0.1, tmax=10, M=10)\n",
"w1 = ttim.Well(ml, xw=0, yw=0, tsandQ=[(0, Q)], layers=0)\n",
"w2 = ttim.HeadWell(ml, xw=100, yw=50, tsandh=[(0, 2)], rw=rw, layers=[0, 1])\n",
"ml.solve()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(array([[-1.40355951],\n",
" [ 0.13485716]]),\n",
" array([[1.99974041],\n",
" [1.9997507 ]]))"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ml.head(rw, 0, 2), ml.head(100, 50, 2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### `DischargeWell`"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"self.neq 0\n",
"No unknowns. Solution complete\n"
]
}
],
"source": [
"k = 25\n",
"H = 20\n",
"Ss = 1e-4 / H\n",
"t = np.logspace(0, 1, 100)\n",
"Q = 500\n",
"rw = 0.2\n",
"hwell = -2\n",
"\n",
"ml = ttim.Model3D(kaq=k, z=np.linspace(H, 0, 3), Saq=Ss, tmin=0.1, tmax=10, M=10)\n",
"w1 = ttim.DischargeWell(ml, xw=0, yw=0, tsandQ=[(0, Q)], layers=[0, 1])\n",
"#w2 = ttim.HeadWell(ml, xw=100, yw=50, tsandh=[(0, 2)], rw=rw, layers=[0, 1])\n",
"ml.solve()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[-2.28582088],\n",
" [-2.28582087]])"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ml.head(2, 3, 2)"
]
}
],
"metadata": {
Expand Down
9 changes: 0 additions & 9 deletions ttim/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,6 @@ def unitpotential(self, x, y, t_int, aq=None):
aq = self.model.aq.find_aquifer_data(x, y)
return np.sum(self.potinf(x, y, t_int, aq), 0)

def unitpotentialone(self, x, y, jtime, aq=None):
"""Returns complex array of size (naq, npval).

Can be more efficient for given elements.
"""
if aq is None:
aq = self.model.aq.find_aquifer_data(x, y)
return np.sum(self.potinfone(x, y, jtime, aq), 0)

@abstractmethod
def disvecinf(self, x, y, t_int, aq=None):
"""Returns 2 complex arrays of size (nparam, naq, nppar)."""
Expand Down
2 changes: 1 addition & 1 deletion ttim/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def potential(self, x, y, time, layers=None, aq=None, derivative=0, returnphi=0)
time = np.atleast_1d(time) - self.tstart # used to be ).copy()
pot = np.zeros((self.ngvbc, aq.naq, self.nppar), dtype=complex)
for i in range(self.ngbc):
pot[i, :] += self.gbclist[i].unitpotentialone(x, y, t_int, aq)
pot[i, :] += self.gbclist[i].unitpotential(x, y, t_int, aq)
for e in self.vzbclist:
pot += e.potential(x, y, t_int, aq)
# multiply by eigenvectors
Expand Down
22 changes: 19 additions & 3 deletions ttim/well.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def changetrace(


class DischargeWell(WellBase):
r"""Well with a specified discharge for each layer that the well is screened in.
r"""Well with one specified discharge for each layer that the well is screened in.

This is not very common and is likely only used for testing and comparison with
other codes. The discharge must be specified for each screened layer. The resistance
Expand Down Expand Up @@ -265,13 +265,17 @@ class DischargeWell(WellBase):
label : string or None (default: None)
label of the well

Implementation
--------------
This element doesn't compute or store parameters as everything is given.

Examples
--------
Example of a well that pumps with a discharge of 100 between times
10 and 50, with a discharge of 20 between times 50 and 200, and zero
discharge after time 200.
discharge after time 200. All from layer 0 (default).

>>> Well(ml, tsandQ=[(10, 100), (50, 20), (200, 0)])
>>> DischargeWell(ml, tsandQ=[(10, 100), (50, 20), (200, 0)])
"""

def __init__(
Expand All @@ -292,6 +296,18 @@ def __init__(
label=label,
)

def initialize(self):
super().initialize()
self.parameters = {}
for t_int in self.model.logtintervals:
self.initialize_interval(t_int)

def initialize_interval(self, t_int):
super().initialize_interval(t_int)
self.parameters[t_int] = np.zeros(
(self.model.ngvbc, self.nparam, self.model.nppar), "D"
dbrakenhoff marked this conversation as resolved.
Show resolved Hide resolved
)


class Well(WellBase, WellBoreStorageEquation):
r"""Create a well with a specified discharge.
Expand Down
Loading