diff --git a/models/igatools-cookies-problem/Dockerfile b/models/igatools-cookies-problem/Dockerfile deleted file mode 100644 index 8be924e..0000000 --- a/models/igatools-cookies-problem/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -FROM ubuntu:mantic - -RUN apt update -RUN DEBIAN_FRONTEND=noninteractive apt install -y autoconf automake autoconf-archive bash python3-pip pbzip2 wget clang-17 git cmake curl zip pkg-config gfortran lld libomp5-17 libomp-17-dev -RUN pip3 install --break-system-packages umbridge - - -RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null -RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list - -RUN apt update -RUN apt install -y intel-basekit -# RUN . /opt/intel/oneapi/setvars.sh - -RUN git clone https://gitlab.com/max.martinelli/igatools.git && \ - cd igatools && \ - git submodule init && \ - git submodule update && \ - git checkout fc6135ca63ed9062eefedfec5fda19eb3e3f4769 && \ - cd vcpkg && ./bootstrap-vcpkg.sh - -# git checkout 576316cfcec2be3212cba7a95f2b2df60a3f64c2 && \ -# git checkout a335daa3bf480cb6e57e2ea8522e3817e841a66d && \ - - -WORKDIR /build_igatools -RUN . /opt/intel/oneapi/setvars.sh && cd /build_igatools && \ - cmake /igatools \ - -G"Unix Makefiles" \ - -DIGATOOLS_COMPONENT_DOCUMENTATION=OFF \ - -DIGATOOLS_WITH_GMP=ON \ - -DIGATOOLS_WITH_MKL=ON \ - -DMKL_DIR=/opt/intel/oneapi/mkl/latest \ - -DIGATOOLS_WITH_QUADRUPLE_PRECISION=OFF \ - -DIGATOOLS_WITH_SERIALIZATION=OFF \ - -DIGATOOLS_WITH_SUITESPARSE=OFF \ - -DIGATOOLS_WITH_SUPERLU=OFF \ - -DIGATOOLS_WITH_TRILINOS=OFF \ - -DTBB_DIR=/opt/intel/oneapi/tbb/latest \ - -DTBB_LIBRARY_DIR=/opt/intel/oneapi/tbb/latest/lib/intel64/gcc4.8/ \ - -DTRILINOS_DIR=/opt/trilinos/current \ - -DIGATOOLS_WITH_THREADS=ON \ - -Wno-dev \ - -DCMAKE_INSTALL_PREFIX=igatools \ - -DCMAKE_BUILD_TYPE=Release \ - -DIGATOOLS_STATIC_EXECUTABLE=OFF \ - -DCMAKE_C_COMPILER=clang-17 \ - -DCMAKE_CXX_COMPILER=clang++-17 \ - -DBUILD_SHARED_LIBS=ON - -RUN make -j4 && \ - make setup_tests && \ - cd tests/ && \ - make poisson_lorenzo.release - -WORKDIR / - -COPY umbridge-server.py / - -CMD python3 umbridge-server.py diff --git a/models/igatools-cookies-problem/README.md b/models/igatools-cookies-problem/README.md deleted file mode 100644 index d40471c..0000000 --- a/models/igatools-cookies-problem/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# The cookies model - -## Overview -This model implements the so-called 'cookies problem' or 'cookies in the oven problem' (see for reference [[Bäck et al.,2011]](https://doi.org/10.1007/978-3-642-15337-2_3), [[Ballani et al.,2015]](https://doi.org/10.1137/140960980), [[Kressner et al., 2011]](https://doi.org/10.1137/100799010)), i.e., a simplified thermal equation in which the conductivity coefficient is uncertain in 8 circular subdomains ('the cookies'), whereas it is known (and constant) in the remaining of the domain ('the oven'). The PDE is solved by an isogeometric solver with maximum continuity splines, whose degree can be set by the user. See below for full description. - - -## Authors -- [Massimiliano Martinelli](mailto:martinelli@imati.cnr.it) -- [Lorenzo Tamellini](mailto:tamellini@imati.cnr.it) - -## Run -``` -docker run -it -p 4242:4242 linusseelinger/cookies-problem -``` - -## Properties - -Model | Description ---- | --- -forward | Forward evaluation of the cookies model, all config options can be modified by the user (see below) -benchmark | Sets the config options for the forward UQ benchmark [(see benchmark page)](https://github.com/UM-Bridge/benchmarks/tree/main/benchmarks/cookies-problem/README.md) - -### forward - -Mapping | Dimensions | Description ---- |--- |--- -input | [8] | These values modify the conductivity coefficient in the 8 cookies, each of them must be greater than -1 (software does not check that input values are valid) -output | [1] | The integral of the solution over the central subdomain (see definition of $\Psi$ below) - -Feature | Supported ---- |--- -Evaluate | True -Gradient | False -ApplyJacobian | False -ApplyHessian | False - -Config | Type | Default | Description ---- |--- |--- |--- -NumThreads | integer | 1 | Number of physical cores to be used by the solver -BasisDegree | integer | 4 | Default degree of spline basis (must be a positive integer) -Fidelity | integer | 2 | Controls the number of mesh elements (must be a positive integer, see below for details) - - -## Mount directories -Mount directory | Purpose ---- |--- -None | - -## Source code - -[Model sources here.](https://github.com/UM-Bridge/benchmarks/tree/main/models/cookies-problem) - -## Description - -![cookies-problem](https://raw.githubusercontent.com/UM-Bridge/benchmarks/main/models/cookies-problem/cookies_domain.png "geometry of the cookies problem") - -The model implements the version of the cookies problem in [[Bäck et al.,2011]](https://doi.org/10.1007/978-3-642-15337-2_3), see also e.g. [[Ballani et al.,2015]](https://doi.org/10.1137/140960980), [[Kressner et al., 2011]](https://doi.org/10.1137/100799010) for slightly different versions. With reference to the computational domain $D=[0,1]^2$ in the figure above, the cookies model consists in the thermal diffusion problem below, where $\mathbf{y}$ are the uncertain parameters discussed in the following and $\mathrm{x}$ are physical coordinates - -$$-\mathrm{div}\Big[ a(\mathbf{x},\mathbf{y}) \nabla u(\mathbf{x},\mathbf{y}) \Big] = f(\mathrm{x}), \quad \mathbf{x}\in D$$ - -with homogeneous Dirichlet boundary conditions and forcing term defined as - -$$f(\mathrm{x}) = \begin{cases} -100 &\text{if } \, \mathrm{x} \in F \\ -0 &\text{otherwise} -\end{cases}$$ - -where $F$ is the square $[0.4, 0.6]^2$. The 8 subdomains with uncertain diffusion coefficient (the cookies) are circles with radius 0.13 and the following center coordinates: - -cookie | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | --- | -- | -- | -- | -- | -- | -- | -- | -- | -x | 0.2 | 0.5 | 0.8 | 0.2 | 0.8 | 0.2 | 0.5 | 0.8 | -y | 0.2 | 0.2 | 0.2 | 0.5 | 0.5 | 0.8 | 0.8 | 0.8 | - -The uncertain diffusion coefficient is defined as - -$$a = 1 + \sum_{n=1}^8 y_n \chi_n(\mathrm{x})$$ - - -where $y_n>-1$ and - -$$\chi_n(\mathrm{x}) = \begin{cases} 1 &\text{inside the n-th cookie} \\ 0 &\text{otherwise} \end{cases}$$ - - -The output of the simulation is the integral of the solution over $F$, i.e. $\Psi = \int_F u(\mathrm{x}) d \mathrm{x}$ - - -The PDE is solved with an IGA solver (see e.g. [[Da Veiga et al., 2014]](https://doi.org/10.1017/S096249291400004X)) that uses as basis splines of degree $p$ (tunable by the user, default $p=4$) of maximal regularity, i.e. of continuity $p-1$. The computational mesh is an $N\times N$ quadrilateral mesh (cartesian product of knot lines) with square elements, with $N=100 \times \mathrm{Fidelity}$. The implementation is done using the C++ library IGATools [[Pauletti et al., 2015]](https://doi.org/10.1137/140955252), available at [gitlab.com/max.martinelli/igatools](https://gitlab.com/max.martinelli/igatools). diff --git a/models/igatools-cookies-problem/cookies_domain.png b/models/igatools-cookies-problem/cookies_domain.png deleted file mode 100644 index cec9d4e..0000000 Binary files a/models/igatools-cookies-problem/cookies_domain.png and /dev/null differ diff --git a/models/igatools-cookies-problem/draw_geometry.m b/models/igatools-cookies-problem/draw_geometry.m deleted file mode 100644 index fdae0c9..0000000 --- a/models/igatools-cookies-problem/draw_geometry.m +++ /dev/null @@ -1,28 +0,0 @@ -clear - -% basic domain - -% circles -xc = [0.2 0.5 0.8 0.2 0.8 0.2 0.5 0.8]; -yc = [0.2 0.2 0.2 0.5 0.5 0.8 0.8 0.8]; -N = length(xc); - -radius = 0.13; -theta = linspace(0,2*pi,200); - -for n=1:N - plot(xc(n) + radius*cos(theta), yc(n) + radius*sin(theta),'-k','LineWidth',2); - hold on - text(xc(n)-0.05,yc(n)+0.01,strcat('# ',num2str(n)),'FontSize',15) -end - -% central square -xsquare = [0.4 0.6 0.6 0.4 0.4]; -ysquare = [0.4 0.4 0.6 0.6 0.4]; -plot(xsquare,ysquare,'-k','LineWidth',2); -text(0.485,0.5,'F','FontSize',15) - -axis square - -saveas(gcf,'cookies_domain','png') - diff --git a/models/igatools-cookies-problem/test_output.py b/models/igatools-cookies-problem/test_output.py deleted file mode 100644 index 7764c18..0000000 --- a/models/igatools-cookies-problem/test_output.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env python3 - -# first run the container as -# -# docker run -it -p 4242:4242 -# -# then run this script as python3 test_output.py http://localhost:4242 - -import argparse -import umbridge -import pytest - -parser = argparse.ArgumentParser(description='Minimal HTTP model demo.') -parser.add_argument('url', metavar='url', type=str, help='the ULR on which the model is running, for example http://localhost:4242') -args = parser.parse_args() -print(f"Connecting to host URL {args.url}") - -# Set up a model by connecting to URL -model = umbridge.HTTPModel(args.url, "forward") - -#test get methods -output = model.get_input_sizes() -print("get_input_sizes() returns "+str(output[0])) -assert pytest.approx(output[0]) == 8, "get_input_sizes() returns wrong value" - - -output = model.get_output_sizes() -print("get_output_sizes() returns "+str(output[0])) -assert pytest.approx(output[0]) == 1, "get input sizes returns wrong value" - - -#test output for default config (thread=1, p=4, fid=2) -param = [[-2.3939786473373e-01, -8.6610045659126e-01, -2.1086275315687e-01, -9.2604304103162e-01, -6.0002531612112e-01, -5.5677423053456e-01, -7.7546408441658e-01, -7.6957620518706e-01]] -output = model(param) -print("model output (quantity of interest) for default config values = "+str(output[0][0])) -assert pytest.approx(output[0][0]) == 0.0693282746248043, "Output not as expected" - -#test output for another config -output = model(param,{"BasisDegree": 3, "Fidelity": 3}) -print("model output (quantity of interest) = "+str(output[0][0])) -assert pytest.approx(output[0][0]) == 0.06934748547844366, "Output not as expected" - - -#another test, this time for the benchmark version (i.e. p=4, fid=2 again, same as model default) -model_B = umbridge.HTTPModel(args.url, "benchmark") - -param = [[-0.2,-0.2,-0.3,-0.4,-0.5,-0.6,-0.7,-0.8]] -output = model_B(param) -print("model output (quantity of interest) in benchmark configuration = "+str(output[0][0])) -assert pytest.approx(output[0][0]) == 0.05725269745090122, "Output not as expected" - diff --git a/models/igatools-cookies-problem/umbridge-server.py b/models/igatools-cookies-problem/umbridge-server.py deleted file mode 100644 index 927a665..0000000 --- a/models/igatools-cookies-problem/umbridge-server.py +++ /dev/null @@ -1,81 +0,0 @@ -import umbridge -import os - -class TestModel(umbridge.Model): - - def __init__(self): - super().__init__("forward") - - def get_input_sizes(self, config): - return [8] - - def get_output_sizes(self, config): - return [1] - - def __call__(self, parameters, config): - arguments = " ".join([str(x) for x in parameters[0]]); - - num_threads = str(config.get("NumThreads",1)); - basis_degree = str(config.get("BasisDegree",4)); - fidelity = str(config.get("Fidelity",2)); - - arguments = arguments + " " + basis_degree + " " + fidelity - - # System call, cd into working directory and call model binary - os.system('. /opt/intel/oneapi/setvars.sh && export IGATOOLS_NUM_THREADS=' + num_threads + ' && /build_igatools/tests/models/poisson_lorenzo/poisson_lorenzo.release ' + arguments) - - # Read second line of output file - with open('/poisson_results.dat', 'r') as f: - line = f.readline() # Read first line - - return [[float(line)]] - - - def supports_evaluate(self): - return True - - - - -class TestBenchmark(umbridge.Model): - - def __init__(self): - super().__init__("benchmark") - - def get_input_sizes(self, config): - return [8] - - def get_output_sizes(self, config): - return [1] - - def __call__(self, parameters, config): - arguments = " ".join([str(x) for x in parameters[0]]); - - num_threads = str(config.get("NumThreads",1)); - basis_degree = str(4); - fidelity = str(2); - - arguments = arguments + " " + basis_degree + " " + fidelity - - # System call, cd into working directory and call model binary - os.system('. /opt/intel/oneapi/setvars.sh && export IGATOOLS_NUM_THREADS=' + num_threads + ' && /build_igatools/tests/models/poisson_lorenzo/poisson_lorenzo.release ' + arguments) - - # Read second line of output file - with open('/poisson_results.dat', 'r') as f: - line = f.readline() # Read first line - - return [[float(line)]] - - - def supports_evaluate(self): - return True - - - - - -testmodel = TestModel() -testbenchmark = TestBenchmark() - - -umbridge.serve_models([testmodel,testbenchmark], 4242)