Skip to content

Commit

Permalink
Cookies problem (#93)
Browse files Browse the repository at this point in the history
* Rename cookies-problem to igatools-cookies-problem

* Add fenics-cookie-problem

* Updated README

* ensure N (mesh size) is integer

* change docker location in readme

* Rename folder to fenics-cookies-problem

* add source code subsection to README for CI

* updated readme for model and benchmark

* added back original readmes by ben

* going over changes with Ben

* removing parabolic benchmark

* deleted temporary test output files

* removed igatools cookies version

* removed time benchmark class

* fixed links to other files in the repo

---------

Co-authored-by: Ben Kent <[email protected]>
Co-authored-by: Lorenzo Tamellini <[email protected]>
  • Loading branch information
3 people authored Aug 1, 2024
1 parent 1d0d4e1 commit 06a3cf0
Show file tree
Hide file tree
Showing 13 changed files with 1,044 additions and 284 deletions.
36 changes: 21 additions & 15 deletions benchmarks/cookies-problem-propagation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

## Overview

This benchmark runs a forward uncertainty quantification problem for the [cookies model](https://github.com/UM-Bridge/benchmarks/tree/main/models/cookies-problem/README.md) using the [Sparse Grids Matlab Kit](https://github.com/lorenzo-tamellini/sparse-grids-matlab-kit) interface to UM-Bridge. See below for full description.
This benchmark runs a forward uncertainty quantification problem for the [cookies model](https://github.com/UM-Bridge/benchmarks/tree/main/models/fenics-cookies-problem/README.md) using the [Sparse Grids Matlab Kit](https://github.com/lorenzo-tamellini/sparse-grids-matlab-kit) interface to UM-Bridge. See below for full description.

## Authors
- [Benjamin Kent]([email protected])
- [Massimiliano Martinelli](mailto:[email protected])
- [Lorenzo Tamellini](mailto:[email protected])

## Run
```
docker run -it -p 4242:4242 linusseelinger/cookies-problem
docker run -it -p 4242:4242 linusseelinger/cookiebenchmark
```

## Properties
Expand All @@ -24,7 +25,7 @@ benchmark | Sets the config options for the forward UQ benchmark (see below)
Mapping | Dimensions | Description
--- |--- |---
input | [8] | These values modify the conductivity coefficient in the 8 cookies. They are i.i.d. uniform random variables in the range [-0.99, -0.2] (software does not check that inputs are within the bound)
output | \[1\] | The integral of the solution over the central subdomain (see definition of $\Psi$ at [cookies model](https://github.com/UM-Bridge/benchmarks/tree/main/models/cookies-problem/README.md) for info)
output | \[1\] | The integral of the solution over the central subdomain (see definition of $$\Psi$$ at [cookies model](https://github.com/UM-Bridge/benchmarks/tree/main/models/fenics-cookies-problem/README.md) for info)

Feature | Supported
--- |---
Expand All @@ -33,11 +34,9 @@ Gradient | False
ApplyJacobian | False
ApplyHessian | False

Config | Type | Default value | Can be changed in benchmark model | Description
--- |--- |--- |--- | ---
NumThreads | integer | 1 | yes | Number of physical cores to be used by the solver
BasisDegree | integer | 4 | no | Default degree of spline basis (must be a positive integer)
Fidelity | integer | 2 | no | Controls the number of mesh elements (must be a positive integer, see below for details)
Config | Type | Default value | Description
--- |--- |--- | ---
None |


## Mount directories
Expand All @@ -47,18 +46,25 @@ None |

## Source code

[Benchmark sources available at this folder.](https://github.com/UM-Bridge/benchmarks/tree/main/benchmarks/cookies-problem)
[Benchmark sources available at this folder.](https://github.com/UM-Bridge/benchmarks/tree/main/benchmarks/cookies-problem-propagation)

## Description

![cookies-problem](https://raw.githubusercontent.com/UM-Bridge/benchmarks/main/models/cookies-problem/cookies_domain.png "geometry of the cookies problem")
![cookies-problem](https://raw.githubusercontent.com/UM-Bridge/benchmarks/main/models/fenics-cookies-problem/cookies_domain.png "geometry of the cookies problem")

The benchmark implements a forward uncertainty quantification problem for the [cookies model](https://github.com/UM-Bridge/benchmarks/tree/main/models/cookies-problem/README.md). More specifically, we assume that the uncertain parameters $y_n$ appearing in the definition of the diffusion coefficient are uniform i.i.d. random variables on the range $[-0.99, -0.2]$ and we aim at computing the expected value of the quantity of interest (i.e., output of the model) $\Psi$, which is defined as the integral of the solution over $F$.
The benchmark implements a forward uncertainty quantification problem for the elliptic version of the [cookies model](https://github.com/UM-Bridge/benchmarks/tree/main/models/fenics-cookies-problem/README.md). More specifically, we assume that the uncertain parameters $$y_n$$ appearing in the definition of the diffusion coefficient are uniform i.i.d. random variables on the range $$[-0.99, -0.2]$$ and we aim at computing the expected value of the quantity of interest (i.e., output of the model) $$\Psi$$, which is defined as the integral of the solution over $$F$$.

The PDE is solved with an IGA solver that uses as basis splines of degree $p=4$ and maximal regularity, i.e. of continuity $3$, and the mesh has $200 \times 200$ elements (i.e., the fidelity config parameter is set to $2$). The structure of this benchmark is identical to the one discussed in [[Bäck et al.,2011]](https://doi.org/10.1007/978-3-642-15337-2_3); however, raw numbers are different since in [[Bäck et al.,2011]](https://doi.org/10.1007/978-3-642-15337-2_3) the PDE solver employed was different (standard FEM with piecewise linear basis) and the mesh was also different.
The benchmark configuration of the docker uses all config options set to their default values, see againg the [cookies model page](https://github.com/UM-Bridge/benchmarks/tree/main/models/fenics-cookies-problem/README.md). The structure of this benchmark thus is identical to the one discussed in [[Bäck et al.,2011]](https://doi.org/10.1007/978-3-642-15337-2_3); however, raw numbers are different since in [[Bäck et al.,2011]](https://doi.org/10.1007/978-3-642-15337-2_3) a different mesh was used.

As a reference value, we provide the approximation of the expected value computed with a standard Smolyak sparse grid, based on Clenshaw--Curtis points, for levels $$w=0,1,\ldots,5$$, see e.g. [[Piazzola et al.,2024]](https://doi.org/10.1145/3630023).

As a reference value, we provide the approximation of the expected value computed with a standard Smolyak sparse grid, based on Clenshaw--Curtis points, for level $w=5$, see e.g. [[Piazzola et al.,2023]](https://doi.org/10.48550/arXiv.2203.09314). The resulting sparse grid has 15713 points, and the corresponding approximation of the expected value is $0.064196096847169$.
Sparse grid $$w$$ | number of collocation points | Estimate of $$\Psi$$
---------------- |-------------------------------- |-------------------
0 | 1 | 0.062255257529767
1 | 17 | 0.064176316082952
2 | 145 | 0.064206407272061
3 | 849 | 0.064202639076811
4 | 3937 | 0.064202350667514
5 | 15713 | 0.064202367186117


The script available [here](https://github.com/UM-Bridge/benchmarks/tree/main/benchmarks/cookies-problem/run_forward_benchmark_in_matlab.m) generates the results, using the Sparse Grids Matlab Kit [[Piazzola et al.,2023]](https://doi.org/10.48550/arXiv.2203.09314) for generating sparse grids. The Grids Matlab Kit is available on Github [here](https://github.com/lorenzo-tamellini/sparse-grids-matlab-kit) and a dedicated website with full resources including user manual is available [here](https://sites.google.com/view/sparse-grids-kit).
The script available [here](https://github.com/UM-Bridge/benchmarks/tree/main/benchmarks/cookies-problem-propagation/run_forward_benchmark_in_matlab.m) generates the results, using the Sparse Grids Matlab Kit [[Piazzola et al.,2024]](https://doi.org/10.1145/3630023) for generating sparse grids. The Grids Matlab Kit is available on Github [here](https://github.com/lorenzo-tamellini/sparse-grids-matlab-kit) and a dedicated website with full resources including user manual is available [here](https://sites.google.com/view/sparse-grids-kit).
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
% 2) add sparse grids matlab kit and um-bridge matlab client to path
% addpath(genpath('~/GIT_projects/Github/sparse-grids-matlab-kit/')) % this is version 23.5 Robert
% addpath(genpath('~/GIT_projects/Github/umbridge/matlab/'))

addpath(genpath('../../../sparse-grids-matlab-kit/'))
addpath(genpath('../../../umbridge'))

% 3) to save results on file (sparse grids in .txt / .mat, results in .txt / .mat), set the flag below to true
saving_stuff = true;
Expand All @@ -31,7 +32,7 @@
model = HTTPModel(uri,'benchmark');

% config cookie solver with num threades
config = struct('NumThreads',4);
config = struct();


% wrap model in an @-function too
Expand All @@ -50,7 +51,7 @@
knots = @(n) knots_CC(n,-0.99,-0.2);
lev2knots = @lev2knots_doubling;
idxset_rule = @(i) sum(i-1);
idxset_level_max = 1; % <--- controls max size of sparse grid
idxset_level_max = 5; % <--- controls max size of sparse grid


% To recycle evaluations from one grid to the next, we need some containers
Expand Down
60 changes: 0 additions & 60 deletions models/cookies-problem/Dockerfile

This file was deleted.

88 changes: 0 additions & 88 deletions models/cookies-problem/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions models/cookies-problem/draw_geometry.m

This file was deleted.

81 changes: 0 additions & 81 deletions models/cookies-problem/umbridge-server.py

This file was deleted.

19 changes: 19 additions & 0 deletions models/fenics-cookies-problem/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:mantic

# Install fenics and python packages
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y bash fenics python3-pip
RUN pip3 install --break-system-packages umbridge

# Expose port for UM-BRIDGE server
EXPOSE 4242

RUN apt update

# Set up internal folders and files
WORKDIR /
COPY umbridge-server.py /
COPY cookiepde.py /

# Start Python UM-BRDIGE server
CMD python3 umbridge-server.py
Loading

0 comments on commit 06a3cf0

Please sign in to comment.