From 82b9495e96b003be8ecdb84c18a83debdba556c0 Mon Sep 17 00:00:00 2001 From: Christophe Prud'homme Date: Wed, 17 Jul 2024 21:10:25 +0200 Subject: [PATCH] up manual ci --- .github/workflows/manual.yml | 2 +- .../ROOT/pages/taylor-green-vortex/index.adoc | 81 ++++++++++++++++++- 2 files changed, 78 insertions(+), 5 deletions(-) diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index fa8c54e84..c82688f2a 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -21,7 +21,7 @@ jobs: run: | python -m venv --system-site-packages .venv source .venv/bin/activate - pip install -r requirements.txt + pip install -I -r requirements.txt - name: Npm Install run: | npm i diff --git a/docs/mor/modules/ROOT/pages/taylor-green-vortex/index.adoc b/docs/mor/modules/ROOT/pages/taylor-green-vortex/index.adoc index f5c4b17d0..a5090391b 100644 --- a/docs/mor/modules/ROOT/pages/taylor-green-vortex/index.adoc +++ b/docs/mor/modules/ROOT/pages/taylor-green-vortex/index.adoc @@ -146,8 +146,7 @@ where stem:[\eta_1, \eta_2, \eta_3] are three Wendland functions stem:[\psi_{2,1 == Setup for the notebook simulation .Setup the variables for the notebook simulation -//[%dynamic,python] -[source,python] +[%dynamic,python] ---- import numpy as np girder_path = "https://girder.math.unistra.fr/api/v1/item/64c165a5b0e9570499e1cc3c/download" @@ -155,10 +154,84 @@ fpp_name = 'ad.fpp' time = np.linspace(start=0, stop=2.5, num=251) ---- +== Downloading the reduced order model from Girder + +The offline creation of the reduced basis has already been performed, and an archive is downloaded from Girder. It contains the basis, the model and the configuration files that are necessary for the online simulation. The following code snippet performs the download. + +.Download the archive from Girder +//[%dynamic,python] +[source,python] +---- +import requests +r=requests.get(girder_path) +with open(fpp_name,'wb') as f: + f.write(r.content) +---- + +//include::partial$online_notebook.adoc[] +// include do not work in asciidoctor-jupyter +== Running the case using a Jupyter notebook + +It is possible to download this page as a Jupyter notebook and run it in an environment that contains a local installation of {feelpp} and its Python wrappers. + + + +.Create the online model, choose randomly 4 parameter vectors and simulate them using a reduced basis of 10 elements +//[%dynamic,python] +[source,python] +---- +import feelpp as fppc +from feelpp.mor import * +ms=feelpp.mor.MORModels(fpp_name) +muspace = ms.parameterSpace() +sampling = muspace.sampling() +sampling.sample(4, "random") +r=ms.run(sampling,{"N":10}) +---- + +.Print the outputs and the associated parameter vector +//[%dynamic,python] +[source,python] +---- +from pandas import DataFrame as df +from pandas import options as op +from pandas import set_option +outputs={} +errors={} +output_dataframes = list() +errors_dataframes = list() +for i in range(len(r)): + outputs={} + errors={} + for o in range(len(r[i])): + str_time = "Time" + str_output = "Output "+str(o) + str_error = "Error "+str(o) + + outputs[str_time] = time + outputs[str_output] = np.array(r[i][o].outputs()) + outputs[str_error] = [np.array(r[i][o].errors())] + + + output_frame = df(data=outputs) + + + set_option('display.float_format', '{:.2E}'.format) + + output_dataframes.append(output_frame) + +op.display.max_colwidth = 100 + +i=0 +for frame in output_dataframes: + print("Parameters :",sampling[i]) + print(frame) + print("\n") + i=i+1 + +---- -include::partial$girder_fpp.adoc[] -include::partial$online_notebook.adoc[] .Show the values of the outputs for different parameters //[%dynamic,python]