Skip to content

Add loading efficiency to xsection plot - #170

Merged
dbrakenhoff merged 22 commits into
timflow-org:devfrom
MattBrst:add-loading-efficiency-plot
Sep 9, 2026
Merged

dbrakenhoff merged 22 commits into
timflow-org:devfrom
MattBrst:add-loading-efficiency-plot

Conversation

@MattBrst

Copy link
Copy Markdown
Contributor

I would like to add the loading efficiency to the cross section plots.

Example from the benchmark with the following line of code:

ml_leff[0].plots.xsection(params=True, names=False, labels=False, sep="\n")
image

So basically non-zero loading efficiencies for aquifers are plotted.

@dbrakenhoff

Copy link
Copy Markdown
Contributor

Good addition, but could you modify it to use the symbol $\beta$, similar to Mark's paper? Looks a bit cleaner than load eff written out, though it is a bit more obscure as to what that means.

We could consider a small list of symbols somewhere to help users understand what's what. Or at least have the loading_efficiency notebook mention $\beta$.

@mbakker7

Copy link
Copy Markdown
Contributor

And to be one step ahead in the process, the loading efficiency of the leaky layer is on its way. So can we include that right away as well?

@mbakker7

mbakker7 commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

In the mathematical formulation, we use \beta for the loading efficiency. In the code it is called leffaq and leffll. I don't think that betaaq and betall is better (definitely less readable). But I think the $\beta$ symbol in the xsection plots is better, since the other parameters are also symbols, like $k_h$ and $S_s$.
Once #74 has been merged, we can also add $\beta$ to the leaky layers in this PR.

@dbrakenhoff dbrakenhoff mentioned this pull request Sep 2, 2026
5 tasks
MattBrst and others added 9 commits September 2, 2026 10:36
param_maq never broadcast/padded leffaq and leffll in the confined/
phreatic-top branch, unlike c/Sll/porll, so leffll was off-by-one
relative to the lli index used when plotting. Also add the missing
beta line to plots.py's standalone xsection implementation, which
never had it (unlike inhom1d.py's Xsection.plot).
inhom1d.py's Xsection.plot already showed leffaq as beta text, but
plots.py's separate xsection implementation (used by regular
ModelMaq/Model3D models) never had it. leffll (leaky layer beta) is
not added here since this branch has no leffll plumbing yet -- that
depends on the head_in_leaky_layer work.
Guarded with hasattr since this branch doesn't have leffll plumbed
into AquiferData yet (that lands with the head_in_leaky_layer work).
Once it is, beta will show for leaky layers here too, same as it
already does for aquifers.
self.leffll was referenced unconditionally, but this branch doesn't
plumb leffll through AquiferData yet, so plotting params on any
confined model with a leaky layer raised AttributeError. Guard with
hasattr, consistent with the same guard just added in plots.py.
param_maq's confined/phreatic branch never broadcast leffaq to naq
(unlike the leaky-top branch, which does), so leffaq stayed length 1
for any multi-aquifer confined model. Dormant since the original
loading-efficiency commit; surfaced now because ml.plots.xsection()
and Xsection.plot() both index leffaq[aqi] for aqi up to naq-1.
@MattBrst

MattBrst commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@dbrakenhoff:

  • I modified the PR to use the β symbol for both aquifers and leaky layers. This should work even when leffll is not yet defined in the model.
  • I had to add the labeling code twice (once in plots.py for the normal models and once in inhom1d.py for the 1D models).

@mbakker7:

  • I had to make some changes in aquifer_parameters.py for leffaq, and would guess you will have to do the same for the leffll.

Currently my plot from the benchmark River1D becomes:
image

And for an 'normal' model with the code below:

image
import timflow.transient as tft

ml = tft.ModelMaq(
    kaq=50,
    z=[7, 5, 2, 1, 0],
    c=100,
    leffaq=[0.3, 0.1],
    leffll=0.7,
    topboundary="semi",
    tmin=0.1,
    tmax=100,
)

ml.plots.xsection(params=True)

@mbakker7

mbakker7 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Pictures look nice! But I think it should work w/o any changes to aquifer_parameters, I would think. Let's first merge #74, which is almost done (working on some benchmark notebooks) and then see what needs to be done.

@mbakker7

mbakker7 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

When Sll=0, Timflow substitutes Sll=1e-20 (as it cannot deal with exactly zero). Maybe this can be done more elegant in the code. But that is what it is for now. In the xsection plot, can you check if Sll=1e-20 and print 0 instead?

@mbakker7

mbakker7 commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

#74 has been merged. This PR can now be compared to dev. And the suggestion about printing Sll=0 (see above) can be implemented. Also, the changes in aquifer_parameters.py should be reconsidered. I wouldn't be surprised if they are not needed anymore.

@dbrakenhoff

Copy link
Copy Markdown
Contributor

Ok I took the liberty of updating your PR @MattBrst. Sll now shown as 0.0 if timflow uses default 1E-20.

Maybe one final thought is necessary on the leffaq/leffll parsing in param_maq for the confined branch? I guess we should just force leffaq and leffll to zeros with the correct dimensions for this case? That way plotting continues to work (the correct layer is selected), but never plotted because values are 0.0.

@MattBrst

MattBrst commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@dbrakenhoff: Thanks for updating the work!

Are you sure that we do not need loading efficiency for confined aquifers? In the paper of Mark I see also for the confined case differences between beta=0 and beta=1.

@dbrakenhoff

Copy link
Copy Markdown
Contributor

Isn't it that the river section is always semi-confined and has loading efficiency but the section next to it can have different top boundaries?

@MattBrst

MattBrst commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

In the paper, loading efficiencies are only shown below the river section and those are semi-confined. So I guess you are right.

@mbakker7

mbakker7 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Just to confirm, the loading efficiency only has an effect with a semi-confined top (otherwise the load on the aquifer system cannot increase - well, if a trains rides by, but we don't have a train element yet). To be honest, I am not sure what happens when a value is specified for the case that the top is not semi-confined. It shouldn't do anything, but has anybody tried that? I think it would be best not to show the loading efficiency when the topboundary is not semi-confined.

@mbakker7

mbakker7 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

I just checked and the loading efficiency is not shown in xsection plots when the topboundary is not semi. Nice.
I also updated the doc strings in the xsection models to make clear that loading efficiency is only used when the topboundary is semi and hstar varies with time.

@mbakker7 mbakker7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to go. Nice job.

@dbrakenhoff
dbrakenhoff merged commit f9096b8 into timflow-org:dev Sep 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants