Skip to content

Commit

Permalink
up manual ci
Browse files Browse the repository at this point in the history
  • Loading branch information
prudhomm committed Jul 17, 2024
1 parent f94ebf4 commit 82b9495
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
81 changes: 77 additions & 4 deletions docs/mor/modules/ROOT/pages/taylor-green-vortex/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,92 @@ 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"
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]
Expand Down

0 comments on commit 82b9495

Please sign in to comment.