Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/feelpp/book.feelpp.org i…
Browse files Browse the repository at this point in the history
…nto develop
  • Loading branch information
prudhomm committed Aug 14, 2023
2 parents f8dbab5 + eea1686 commit d8cacea
Show file tree
Hide file tree
Showing 19 changed files with 206 additions and 37 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ jobs:
# python-version: '3.10'
# cache: 'pip' # caching pip dependencies
- name: Python install
run: pip install -r requirements.txt
run: |
python -m venv --system-site-packages .venv
source .venv/bin/activate
pip install -r requirements.txt
- name: Npm Install
run: |
npm i
Expand All @@ -27,7 +30,9 @@ jobs:
asciidoctor -v
- name: Build
run: npm run antora
run: |
source .venv/bin/activate
npm run antora
env:
FEELPP_GITHUB_TOKEN: ${{ secrets.DOCS_GITHUB_KEY }}
GITHUB_OAUTH: ${{ secrets.DOCS_GITHUB_KEY }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ jupyter/
/**/node_modules/
/**/build/
/**/feelppdb/
/**/toto/
/**/*DS_Store

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions docs/mor/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
* xref:toolboxmor.adoc[ToolboxMor]
** xref:toolboxmor.adoc#_creating_a_model_from_scratch[Creating a model from scratch]
** xref:toolboxmor.adoc#_creating_a_model_from_a_toolbox[Creating a model from a toolbox]
** xref:toolboxmor.adoc#_configuration[Configuration]
* xref:pbdw.adoc[PBDW]
** xref:pbdw.adoc#_sensors[Sensors]
** xref:pbdw.adoc#_using_pbdw[Using PBDW]
* xref:index.adoc#_cases[Cases]
** xref:opusheat:index.adoc[OpusHeat]
** xref:thermalfin:index.adoc[ThermalFin]
13 changes: 2 additions & 11 deletions docs/mor/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
= Model Order Reduction
:page-layout: case-study
:page-tags: toolbox

Welcome to the documentation of the Feel++ Model Order Reduction.

== Introduction

Feel++ provides a framework for model order reduction. +
One easy way to use it, is to use the xref:toolboxmor.adoc[ToolboxMor] class.

The Parametrized Background Data Weak (xref:pbdw.adoc[PBDW]) method has also been implemented in Feel++.

== Cases

- xref:opusheat:index.adoc[OpusHeat]
- xref:thermalfin:index.adoc[ThermalFin]
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
= Opus Heat
:page-tags: case
:page-illustration: opusheat/eads_geometry.png
:description: We consider a reduced 2D model of the surroundings of an electronic component submitted to a cooling air flow.


This test case has been proposed by mailto:[email protected][Annabelle Le-Hyaric] and
mailto:[email protected][Michel Fouquembergh] formerly at AIRBUS.
Expand Down Expand Up @@ -28,7 +32,7 @@ stem:[k_1] and stem:[k_2] are parameters of the model.

ICs dissipate heat, so the volumic heat dissipated stem:[Q_1] and stem:[Q_2] are also parameters of the model, while stem:[Q_3=Q_4=0].

image::eads_geometry.png[]
image::opusheat/eads_geometry.png[]

One should notice that the convection term in heat transfer equation
may lead to spatial oscillations which can be overcome by
Expand Down
3 changes: 3 additions & 0 deletions docs/mor/modules/ROOT/pages/pbdw.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
= Parametrized Background Data Weak
:page-tags: manual
:description: PBDW manual
:page-illustration: pass:[toolboxes::manual.svg]

== Sensors

Expand Down
135 changes: 135 additions & 0 deletions docs/mor/modules/ROOT/pages/thermalbuilding/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
= Thermal simulation of 3D building
:stem: latexmath
:page-tags: case
:page-illustration: thermalbuilding/3d_building.png
:description: We create a reduced order model for the thermal simulation of a 3D building using the stationary heat equation.
:uri-data: https://github.com/feelpp/feelpp/blob/develop/mor/examples/thermalbuilding/

== Description

Based on the solution of the stationary heat equation, we create a reduced order model for the simulation of heat exchanges in a 3D building.

The building is composed of a corridor and 5 rooms, each of which contains a heating unit. Internal walls and doors are modelled as having finite thickness, while external walls properties (thickness and insulation) are encoded in the boundary conditions of the problem.

// Image

=== Mathematical model

Let stem:[\Omega \subset \mathbb{R}^3] be the region occupied by the building, and denote stem:[\Omega_i], stem:[i=0,1,2] its subregions occupied by the air, the internal walls and the internal doors, such that stem:[\Omega = \cup_{i=0}^2 \Omega_i]. Let stem:[k_i] be the thermal conductivities associated with the subregions.

The external boundary of the domain stem:[\partial \Omega] is decomposed into two parts: stem:[\partial \Omega_{ext}], which corresponds to external walls, and stem:[\partial \Omega_D] which corresponds to the front door. We denote by stem:[\Gamma_i] the boundary of the stem:[i-]th heating unit, stem:[i=0,...,4]. The problem writes as

[stem]
++++
\begin{equation}
\begin{aligned}
- \nabla \cdot (k_i\nabla u) &= 0, \quad &\text{on }\Omega_i \\
u &= \mu_i \quad &\text{on }\Gamma_i, i=0,...,4, \\
- k_0 \nabla u \cdot \vec{n} &= \mu_6 (u - \mu_5), \quad &\text{on }\partial \Omega_{ext},\\
- k_0 \nabla u \cdot \vec{n} &= \sigma (u - \mu_5), \quad &\text{on }\partial \Omega_{D}.
\end{aligned}
\end{equation}
++++
where stem:[\sigma] is the convective heat exchange coefficient associated with the front door.

The parameters stem:[\mu_i] correspond to

* stem:[\mu_i \in (300,340)], for stem:[i=0,...,4], are the surface temperatures of the heating units (in Kelvin);
* stem:[\mu_5 \in (270,290)] is the external temperature (in Kelvin);
* stem:[\mu_6] is a function of the external wall thickness. The wall is composed of two layers: a cinder layer of thickness stem:[l_{cinder} \in (0.1,0.3) m] and an insulation layer of thickness stem:[l_{insulation} \in (0.1,0.2) m], and

[stem]
++++
\mu_6 = \frac{1}{0.06 + \frac{0.01}{0.5} + \frac{l_{cinder}}{0.8} + \frac{l_{insulation}}{0.032} + \frac{0.016}{0.313} + 0.14}.
++++

=== Construction of the affine decomposition

The problem presents an affine dependence on the parameters, hence we can explicity compute the terms of the correspondent affine decomposition

[stem]
++++
\sum_{i = 0}^{N_A} \theta^A_i(\mu) A_i(u,v) = \sum_{j = 0}^{N_F} \theta^F_j(\mu) F_j(v),
++++
where stem:[N_A = 1] and stem:[N_F = 6].

The first product on the left-hand side is given by stem:[\theta^A_0(\mu) = 1] and

[stem]
++++
\begin{equation}
\begin{aligned}
A_0(u,v) &= \sum_{i=0}^{N_m} \int_{\Omega_i} k_i \nabla u \cdot \nabla v + \\
& - \int_{\partial \Omega_{ext}} k_0 (\nabla u v + \nabla v u )\cdot \vec{n} + \\
& + \int_{\partial \Omega_{ext}} k_0 \frac{\gamma}{h} u v +\\
& + \int_{\partial \Omega_D} uv,
\end{aligned}
\end{equation}
++++

where stem:[\gamma] is the Nitsche penalty parameter and stem:[h] is the local mesh size.

The second product is given by stem:[\theta^A_1(\mu) = \mu_6] and

[stem]
++++
A_1(u,v) = \int_{\partial \Omega_{ext}} u v.
++++

The terms on the right-hand side are stem:[\theta^F_i(\mu) = \mu_i] for stem:[i=0,...,4], corresponding to the temperatures of the heating units, stem:[\theta^F_5(\mu) = \mu_5\mu_6], corresponding to the temperature on the internal surface of the external walls, and stem:[\theta^F_6(\mu) = \mu_5], corresponding to the external temperature. The corresponding linear forms are

[stem]
++++
\begin{equation}
\begin{aligned}
F_i (v) &= k_0 \int_{\Gamma_i} -\nabla v \cdot \vec{n} + \frac{\gamma}{h} v, \quad i = 0,...,4\\
F_5 (v) &= \int_{\partial \Omega_{ext}} v,\\
F_6 (v) &= \int_{\partial \Omega_D} \sigma v.
\end{aligned}
\end{equation}
++++

=== Geometry

image::thermalbuilding/heat_3d.png[]

The geometry file can be found in Github link:{uri-data}/thermalbuilding/thermalbuilding.geo[here].

== Output

The output corresponds to the air mean temperature, and it is computed as

[stem]
++++
\begin{equation}
s(\mu) = \frac{1}{|\Omega_0|} \int_{\Omega_0} u.
\end{equation}
++++

== Parameters

The table displays the various fixed and variables parameters of this test-case.

.Table of model order reduction parameters
[width="100%"]
|=======================================================================
| Name | Description | Range | Units
| stem:[\mu_0] | Heater temperature living room | stem:[[300,340]] | stem:[K]
| stem:[\mu_1] | Heater temperature kitchen | stem:[[300,340]] | stem:[K]
| stem:[\mu_2] | Heater temperature bedroom 1 | stem:[[300,340]] | stem:[K]
| stem:[\mu_3] | Heater temperature bedroom 2 | stem:[[300,340]] | stem:[K]
| stem:[\mu_4] | Heater temperature bathroom | stem:[[300,340]] | stem:[K]
| stem:[\mu_5] | External temperature | stem:[[270,290]] | stem:[K]
| stem:[\mu_6] | Exchange coefficient external walls | |
|=======================================================================

.Table of constant parameters
[width="100%"]
|=======================================================================
| Name | Description | Range | Units
| stem:[\gamma] | Boundary conditions using Nitsche method | stem:[[10]] |
| stem:[\k_0] | Air conductivity | stem:[1] |
| stem:[\k_1] | Conductivity - internal walls | stem:[0.25] |
| stem:[\k_2] | Conductivity - internal doors | stem:[0.13] |
| stem:[\sigma] | Heat transfer coefficient - front door | stem:[\frac{1.0}{0.06+\frac{0.06}{0.150}+\frac{0.1}{0.029}+0.14}] |
|=======================================================================
6 changes: 6 additions & 0 deletions docs/mor/modules/ROOT/pages/thermalfin/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
= Thermal fin
:page-tags: case
:page-illustration: pass:[toolboxes::wip/wip-1.svg]
:description: Work in progress.

The redaction of this page is in progress.
3 changes: 3 additions & 0 deletions docs/mor/modules/ROOT/pages/toolboxmor.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
= ToolboxMor
:page-tags: manual
:description: ToolboxMor manual
:page-illustration: pass:[toolboxes::manual.svg]

ToolboxMor is a class aiming to ease the use of the model order reduction framework of Feel++.
Usually, you would need to define a class which would handle the initialization of the model, its affine decomposition and possibly the use of the EIM methods.
Expand Down
1 change: 0 additions & 1 deletion docs/mor/modules/opusheat/nav.adoc

This file was deleted.

1 change: 0 additions & 1 deletion docs/mor/modules/thermalfin/nav.adoc

This file was deleted.

3 changes: 0 additions & 3 deletions docs/mor/modules/thermalfin/pages/index.adoc

This file was deleted.

35 changes: 31 additions & 4 deletions docs/user/modules/python/pages/pyfeelpp/filters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@ In this 2D and 3D example, we
[%dynamic,python]
----
import feelpp
import sys
import sys,os
import spdlog as spd
from feelpp.timing import tic, toc

logger = spd.ConsoleLogger('Logger', False, True, True)
logger.set_level(spd.LogLevel.TRACE)

tic()
app = feelpp.Environment(["myapp"],config=feelpp.localRepository("")) # <1>
toc("init Feel++")

logger.info(f"Feel++ version: {feelpp.Info.version()}")
----
<1> The {feelpp} environment is initiated with the name of the application and the path to the local repository where the results will be stored.

Expand All @@ -27,18 +37,23 @@ app = feelpp.Environment(["myapp"],config=feelpp.localRepository("")) # <1>
app.setLogVerbosityLevel(0) # <1>
geofilename=feelpp.download( "github:{repo:feelpp,path:feelpp/quickstart/laplacian/cases/feelpp2d/feelpp2d.geo}", worldComm=app.worldCommPtr() )[0]

tic()
mesh = feelpp.load(feelpp.mesh(dim=2,realdim=2), name=geofilename, h=0.1, verbose=1) # <2>
toc("load mesh")
logger.info(f"mesh loaded")

Xh=feelpp.functionSpace(mesh=mesh,space="Pch",order=1) # <3>
P0h=feelpp.functionSpace(mesh=mesh,space="Pdh",order=0) # <4>
u=Xh.element() # <5>
u.on(range=feelpp.elements(mesh), expr=feelpp.expr("sin(2*pi*x)*cos(pi*y):x:y")) # <6>
logger.info(f"functionspace built and u created")
e = feelpp.exporter(mesh=mesh) # <7>
e.add("a_scalar", 1.) # <8>
e.add("u",u) # <9>
e.add("pid",feelpp.pid( P0h )) # <10>
e.save() # <11>
logger.info(f"export done")
----
<1> The verbosity level is set to 0 (only `VLOG(level)` with `level <= 0` are displayed)
<2> The mesh is loaded from the {uri-github-feelpp} repository
Expand Down Expand Up @@ -70,12 +85,24 @@ def pv_get_mesh(mesh_path):
mesh = reader.read()
return mesh
def pv_plot(mesh, field="u", clim=None, cmap='viridis', cpos='xy', show_scalar_bar=True, show_edges=True):
mesh.plot(scalars=field, clim=clim, cmap=cmap, cpos=cpos, show_scalar_bar=show_scalar_bar, show_edges=show_edges)
plotter = pv.Plotter()
plotter.show_axes()
mesh = pv_get_mesh(f"exports/ensightgold/Exporter/Exporter.case")
plotter.add_mesh(mesh, scalars="u", clim=None, cmap="viridis", show_scalar_bar=True, show_edges=True)
plotter.camera_position = 'xy'
axes = pv.create_axes_marker(
line_width=4,
ambient=0.0,
x_color="#378df0",
y_color="#ab2e5d",
z_color="#f7fb9a",
xlabel="X Axis",
ylabel="Y Axis",
zlabel="Z Axis",
label_size=(0.1, 0.1), label_color="#aaaaaa",
)
plotter.add_actor(axes)
plotter.show()
----
Expand Down
1 change: 1 addition & 0 deletions lib/dynamic-notebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ sys.stdout.write(plotter.export_html(None).getvalue())`)
let source = response[index].stdout.toString('utf8')
if (block.isOption('raw')) {
if (block.getAttribute('output') === 'pyvista') {
logger.debug(source)
source = source.replace(pyvistaContainerRx, `var container = document.getElementById('pyvista-${index}')`)
source = source.replace(pyvistaFaviconRx, '')
const found = source.match(pyvistaScriptRx)
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ pyvista
xvfbwrapper
ipykernel
pythreejs
plotly
plotly
trame-vtk
trame
spdlog
9 changes: 6 additions & 3 deletions site-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ site:
title: Feel++ // Docs
url: https://docs.feelpp.org
start_page: home::index.adoc
runtime:
log:
level: debug
content:
sources:
- url: ./
Expand Down Expand Up @@ -74,9 +77,9 @@ content:
- url: ./
branches: develop
start_path: docs/salome/
- url: ../Antora/antora-ui
branches: mais
start_path: docs/
# - url: ../Antora/antora-ui
# branches: mais
# start_path: docs/
# - url: ./
# branches: mor-module
# start_path: docs/mor/
Expand Down

0 comments on commit d8cacea

Please sign in to comment.