Skip to content

add random darcy flow using MLMC#246

Merged
bangerth merged 1 commit into
dealii:masterfrom
SanojKnalp:mlmc_random_darcy_flow
May 12, 2026
Merged

add random darcy flow using MLMC#246
bangerth merged 1 commit into
dealii:masterfrom
SanojKnalp:mlmc_random_darcy_flow

Conversation

@SanojKnalp
Copy link
Copy Markdown
Contributor

@SanojKnalp SanojKnalp commented May 5, 2026

This example adds a relatively simple MLMC code, i wrote for my seminar on MLMC, that solves darcy flow with hydraulic permeability modeled by a random field.
This is currently WIP, but will be finished soon.

@SanojKnalp SanojKnalp force-pushed the mlmc_random_darcy_flow branch from f44a283 to ce5db29 Compare May 5, 2026 19:08
@bangerth
Copy link
Copy Markdown
Member

bangerth commented May 5, 2026

Nice. I look forward to seeing the final version. Please leave a comment if you want us to look at it once you're done!

@SanojKnalp SanojKnalp marked this pull request as ready for review May 6, 2026 14:23
@SanojKnalp
Copy link
Copy Markdown
Contributor Author

@bangerth I think it is ready now. In case I find any minor issues I'll fix them in the future.

Copy link
Copy Markdown
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Nice! Is there a publication, or a thesis, that shows further details and that you might want to link to?

Comment thread MLMC_random_darcy_flow/doc/author Outdated
@@ -0,0 +1 @@
Jonas Plank <jonas.plank@tum.de> No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For historical reasons, UNIX typically asks that every file ends in a newline. If you go to the github page of your pull request and click on the "Changes" tab, you'll see that most files are missing a newline at the end. Could you fix this?

Comment thread MLMC_random_darcy_flow/doc/builds-on Outdated
@@ -0,0 +1 @@
step 5 No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
step 5
step-5

Comment thread MLMC_random_darcy_flow/doc/entry-name Outdated
@@ -0,0 +1 @@
mlmc for random darcy flow No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be useful to spell mlmc out -- not everyone might know what it stands for.

Comment thread MLMC_random_darcy_flow/README.md Outdated
# Multilevel Monte Carlo for random Darcy flow

## Motivation
Numerical simulations rely on input parameters such as material data, boundary conditions, and geometry. These parameters are almost always derived from measurements and are therefore subject to uncertainty. Some PDEs, such as the Kardar-Parisi-Zhang equation [1], even incorporate uncertainty directly into the governing equation. This uncertainty propagates through the simulation; consequently, quantifying its impact on the solution is of great interest.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Numerical simulations rely on input parameters such as material data, boundary conditions, and geometry. These parameters are almost always derived from measurements and are therefore subject to uncertainty. Some PDEs, such as the Kardar-Parisi-Zhang equation [1], even incorporate uncertainty directly into the governing equation. This uncertainty propagates through the simulation; consequently, quantifying its impact on the solution is of great interest.
Numerical simulations rely on input parameters such as material data, boundary conditions, and geometry. These parameters are almost always derived from measurements and are therefore subject to uncertainty. Some PDEs, such as the [Kardar-Parisi-Zhang equation](https://en.wikipedia.org/wiki/Kardar%E2%80%93Parisi%E2%80%93Zhang_equation) [1], even incorporate uncertainty directly into the governing equation. This uncertainty propagates through the simulation; consequently, quantifying its impact on the solution is of great interest.

Comment thread MLMC_random_darcy_flow/README.md Outdated
## Motivation
Numerical simulations rely on input parameters such as material data, boundary conditions, and geometry. These parameters are almost always derived from measurements and are therefore subject to uncertainty. Some PDEs, such as the Kardar-Parisi-Zhang equation [1], even incorporate uncertainty directly into the governing equation. This uncertainty propagates through the simulation; consequently, quantifying its impact on the solution is of great interest.

However, this can be a costly undertaking. The standard Monte Carlo estimator converges at a rate of @f[ \mathcal{O}(N^{-\frac{1}{2}}) @f], potentially requiring tens of thousands of samples for a reasonable estimate of the mean. This is often unfeasible for complex problems where computing a single sample on a fine mesh may take hours.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
However, this can be a costly undertaking. The standard Monte Carlo estimator converges at a rate of @f[ \mathcal{O}(N^{-\frac{1}{2}}) @f], potentially requiring tens of thousands of samples for a reasonable estimate of the mean. This is often unfeasible for complex problems where computing a single sample on a fine mesh may take hours.
However, this can be a costly undertaking. The standard Monte Carlo estimator, which simply solves the equation $N$ times with different realizations of the random noise and then averages the $N$ solutions, converges at a rate of @f[ \mathcal{O}(N^{-\frac{1}{2}}) @f], potentially requiring tens of thousands of samples for a reasonable estimate of the mean. This is often infeasible for complex problems where computing a single sample on a fine mesh may take hours.

Comment thread MLMC_random_darcy_flow/README.md Outdated

We approximate this random field using a Karhunen-Loève Expansion and set a pressure difference of 1 between the left and right boundaries.

It is easy to observe that the actual PDE code is very similar to the one demonstrated in Step-5. This is on purpose. In recent years, invasive techniques have fallen out of favor since they, as the name suggests, require reprogramming of existing finite element codes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
It is easy to observe that the actual PDE code is very similar to the one demonstrated in Step-5. This is on purpose. In recent years, invasive techniques have fallen out of favor since they, as the name suggests, require reprogramming of existing finite element codes.
It is easy to observe that the actual PDE code is very similar to the one demonstrated in step-5. This is on purpose. In recent years, invasive techniques have fallen out of favor since they, as the name suggests, require reprogramming of existing finite element codes.

Comment thread MLMC_random_darcy_flow/README.md Outdated

## Results
The following plots illustrate the convergence rate of our MLMC implementation.
![Screenshot](./doc/images/convergence_mlmc.png)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps give it a better name? Same below.

@bangerth
Copy link
Copy Markdown
Member

bangerth commented May 7, 2026

Let me know when you have the final version and we can merge!

@SanojKnalp SanojKnalp force-pushed the mlmc_random_darcy_flow branch from 3bcfd36 to d2a6657 Compare May 8, 2026 12:19
@SanojKnalp
Copy link
Copy Markdown
Contributor Author

@bangerth I've incorporated all the feedback and squashed the commits into one. This should be fine now.

Copy link
Copy Markdown
Member

@bangerth bangerth left a comment

Choose a reason for hiding this comment

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

Thank you!

@bangerth bangerth merged commit 90a4fb2 into dealii:master May 12, 2026
5 checks passed
@SanojKnalp SanojKnalp deleted the mlmc_random_darcy_flow branch May 12, 2026 05:59
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.

2 participants