From f8dbab572d94baa104cdd08e873b11dab4d5f4da Mon Sep 17 00:00:00 2001 From: Christophe Prud'homme Date: Mon, 14 Aug 2023 07:01:41 +0200 Subject: [PATCH] up pyfeelpp notebooks and up site for components order --- .gitignore | 1 + config.json | 14 +-- .../modules/python/pages/pyfeelpp/discr.adoc | 38 +----- .../python/pages/pyfeelpp/integrals.adoc | 15 +-- .../python/pages/pyfeelpp/interpolator.adoc | 4 +- .../modules/python/pages/pyfeelpp/mesh.adoc | 114 +++--------------- site-dev.yml | 2 +- site.yml | 2 +- supplemental-ui/layouts/home.hbs | 74 ------------ 9 files changed, 37 insertions(+), 227 deletions(-) delete mode 100644 supplemental-ui/layouts/home.hbs diff --git a/.gitignore b/.gitignore index b33ef9b35..40a2d0b99 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ jupyter/ /.bundle /**/node_modules/ /**/build/ +/**/feelppdb/ diff --git a/config.json b/config.json index 4ef356ee7..f2ac79b1e 100644 --- a/config.json +++ b/config.json @@ -7,15 +7,16 @@ "component": [ "dev", "mor", - "cases", "user", "toolboxes", - "tutorial-dev" + "feelpp-tutorial-dev" ], "version": [ + "latest", + "0.111", + "0.110", "0.109", - "0.108", - "0.107" + "0.108" ] } }, @@ -23,10 +24,7 @@ "url": "https://docs.feelpp.org/(?P.*?)/", "variables": { "component": [ - "feelpp", - "contribute", - "data", - "math" + "feelpp-project", "data", "math", "contribute" ] }, "selectors_key": "versionless" diff --git a/docs/user/modules/python/pages/pyfeelpp/discr.adoc b/docs/user/modules/python/pages/pyfeelpp/discr.adoc index 4d856f97f..9d38947c6 100644 --- a/docs/user/modules/python/pages/pyfeelpp/discr.adoc +++ b/docs/user/modules/python/pages/pyfeelpp/discr.adoc @@ -5,7 +5,7 @@ include::user:ROOT:partial$header-macros.adoc[] We start with setting the {feelpp} environment and loading the {feelpp} library. We download a 2D and 3D geometry from the {feelpp} github repository. -[source,python] +[%dynamic,python] ---- import feelpp import sys @@ -21,14 +21,6 @@ print(" . 2D geometry file: {}".format(geo['2'])) print(" . 3D geometry file: {}".format(geo['3'])) ---- -[%collapsible.result] -==== ----- - . 2D geometry file: /scratch/jupyter/feelppdb/downloads/feelpp2d.geo - . 3D geometry file: /scratch/jupyter/feelppdb/downloads/feelpp3d.geo ----- -==== - == Notations The domain stem:[\Omega] is discretized using a mesh of triangles or tetrahedra. @@ -38,7 +30,7 @@ Scalar functions stem:[f \Omega \rightarrow \mathbb{R}] are defined on the mesh == Scalar function spaces -[source,python] +[%dynamic,python] .2D mesh and function space example ---- def run( m, geo ): @@ -65,34 +57,10 @@ def run( m, geo ): run( feelpp.mesh(dim=2), geo['2'] ) ---- -[%collapsible.result] -.Results -==== ----- -Xh basisname: lagrange -Xh nDof: 2867 -Xh nLocalDof: 2867 -Xh nLocalDofWithGhost: 2867 -Xh nLocalDofWithoutGhost: 2867 ----- -==== - Finally, we can do the same in 3D -[source,python] +[%dynamic,python] .3D mesh and function space example ---- run( feelpp.mesh(dim=3,realdim=3), geo['3'] ) ---- - -[%collapsible.result] -.Results -==== ----- -Xh basisname: lagrange -Xh nDof: 21739 -Xh nLocalDof: 21739 -Xh nLocalDofWithGhost: 21739 -Xh nLocalDofWithoutGhost: 21739 ----- -==== \ No newline at end of file diff --git a/docs/user/modules/python/pages/pyfeelpp/integrals.adoc b/docs/user/modules/python/pages/pyfeelpp/integrals.adoc index f677b699f..c831e7033 100644 --- a/docs/user/modules/python/pages/pyfeelpp/integrals.adoc +++ b/docs/user/modules/python/pages/pyfeelpp/integrals.adoc @@ -5,7 +5,7 @@ include::user:ROOT:partial$header-macros.adoc[] We start with setting the {feelpp} environment and loading the {feelpp} library. .Set the {feelpp} environment with local repository -[source,python] +[%dynamic,python] ---- import feelpp import sys @@ -23,7 +23,7 @@ The integral over each element is computed using a quadrature formula. We first load a mesh .Load a mesh stem:[\mathcal{T}] -[source,python] +[%dynamic,python] ---- geo=feelpp.download( "github:{repo:feelpp,path:feelpp/quickstart/laplacian/cases/feelpp2d/feelpp2d.geo}", worldComm=app.worldCommPtr() )[0] print("geo file: {}".format(geo)) @@ -32,24 +32,17 @@ mesh = feelpp.load(feelpp.mesh(dim=2,realdim=2), geo, 0.1) Then we can define functions stem:[f] and compute the integral of stem:[f] over the mesh stem:[\mathcal{T}]. -[source,python] .Compute integrals +[%dynamic,python] ---- from feelpp.integrate import integrate i1 = integrate(range=feelpp.elements(mesh),expr="sin(x+y):x:y") i2 = integrate(range=feelpp.boundaryfaces(mesh),expr="x*nx+y*ny+z*nz:x:y:z:nx:ny:nz") i3 = integrate(range=feelpp.markedelements(mesh, "marker"), expr="1") -print("i1 = {}, i2 = {}, i3 = {}".format(i1,i2,i3)) ----- -[%collapsible.result] -.Results -==== ----- -i1 = [3.24282386], i2 = [149.465], i3 = [0.] +print(f"i1 = {i1}, i2 = {i2}, i3 = {i3}") ---- -==== == Next steps diff --git a/docs/user/modules/python/pages/pyfeelpp/interpolator.adoc b/docs/user/modules/python/pages/pyfeelpp/interpolator.adoc index 332ddbca7..e87aa742f 100644 --- a/docs/user/modules/python/pages/pyfeelpp/interpolator.adoc +++ b/docs/user/modules/python/pages/pyfeelpp/interpolator.adoc @@ -3,7 +3,7 @@ include::user:ROOT:partial$header-macros.adoc[] == Import the package -[source,python] +[%dynamic,python] ---- from feelpp.interpolation import * ---- @@ -11,7 +11,7 @@ from feelpp.interpolation import * == Create an interpolator -[source, python] +[%dynamic, python] ---- I = interpolator(_domain = , _image = , diff --git a/docs/user/modules/python/pages/pyfeelpp/mesh.adoc b/docs/user/modules/python/pages/pyfeelpp/mesh.adoc index 026708769..b35218834 100644 --- a/docs/user/modules/python/pages/pyfeelpp/mesh.adoc +++ b/docs/user/modules/python/pages/pyfeelpp/mesh.adoc @@ -5,7 +5,7 @@ include::user:ROOT:partial$header-macros.adoc[] We start with setting the {feelpp} environment and loading the {feelpp} library. .Set the {feelpp} environment with local repository -[source,python] +[%dynamic,python] ---- import feelpp import sys @@ -34,54 +34,13 @@ Keyword arguments: .Example -[source,python] +[%dynamic,python] ---- geo=feelpp.download( "github:{repo:feelpp,path:feelpp/quickstart/laplacian/cases/feelpp2d/feelpp2d.geo}", worldComm=app.worldCommPtr() )[0] print("geo file: {}".format(geo)) mesh = feelpp.load(feelpp.mesh(dim=2,realdim=2), geo, 0.1) ---- -[%collapsible.result] -.Results -==== ----- -[ Starting Feel++ ] application myapp version 0.1 date 2022-Nov-07 - . myapp files are stored in /scratch/jupyter/feelppdb/np_1 - .. logfiles :/scratch/jupyter/feelppdb/np_1/logs -Output exceeds the size limit. Open the full output data in a text editor -geo file: /scratch/jupyter/feelppdb/downloads/feelpp2d.geo -[loadMesh] Loading mesh in format geo+msh: "/scratch/jupyter/feelppdb/downloads/feelpp2d.geo" -[loadMesh] Use default geo desc: /scratch/jupyter/feelppdb/downloads/feelpp2d.geo 0.1 -Info : Reading 'feelpp2d.geo'... -Info : Done reading 'feelpp2d.geo' -Info : Meshing 1D... -Info : [ 0%] Meshing curve 1 (Line) -Info : [ 10%] Meshing curve 2 (Line) -Info : [ 10%] Meshing curve 3 (Line) -Info : [ 10%] Meshing curve 4 (Line) -Info : [ 10%] Meshing curve 5 (Line) -Info : [ 10%] Meshing curve 6 (Line) -Info : [ 10%] Meshing curve 7 (Line) -Info : [ 20%] Meshing curve 8 (Line) -Info : [ 20%] Meshing curve 9 (Line) -Info : [ 20%] Meshing curve 10 (Line) -Info : [ 20%] Meshing curve 11 (Line) -Info : [ 20%] Meshing curve 12 (Line) -Info : [ 20%] Meshing curve 13 (Line) -Info : [ 20%] Meshing curve 14 (Line) -Info : [ 30%] Meshing curve 15 (Line) -Info : [ 30%] Meshing curve 16 (Line) -Info : [ 30%] Meshing curve 17 (Line) -Info : [ 30%] Meshing curve 18 (Line) -Info : [ 30%] Meshing curve 19 (Line) -... -Info : Done meshing 2D (Wall 0.106645s, CPU 0.106853s) -Info : 2867 nodes 5812 elements -Info : Writing 'feelpp2d.msh'... -Info : Done writing 'feelpp2d.msh' ----- -==== - == Usage The `mesh` provides the {feelpp} data structures in Python: @@ -105,33 +64,18 @@ The following methods are to use on the mesh object (`mesh` in the previous exam Here is an example of how to use the mesh information: -[source,python] +[%dynamic,python] .Query the mesh information ---- -print("dimention: {}".format(mesh.dimension())) -print("number of elements: {}".format(mesh.numGlobalElements())) -print("number of faces: {}".format(mesh.numGlobalFaces())) -print("hmin: {}".format(mesh.hMin())) -print("havg: {}".format(mesh.hAverage())) -print("hmax: {}".format(mesh.hMax())) -print("measure: {}".format(mesh.measure())) -print("measure of boundary: {}".format(mesh.measureBoundary())) ----- - -[%collapsible.result] -.Results -==== ----- -dimention: 2 -number of elements: 5134 -number of faces: 8006 -hmin: 0.0763352613189128 -havg: 0.10274873094289755 -hmax: 0.13695416558140516 -measure: 20.79999999999997 -measure of boundary: 1497.0959239128888 +print(f"dimention: {mesh.dimension()}") +print(f"number of elements: {mesh.numGlobalElements()}") +print(f"number of faces: {mesh.numGlobalFaces()}") +print(f"hmin: {mesh.hMin()}") +print(f"havg: {mesh.hAverage()}") +print(f"hmax: {mesh.hMax()}") +print(f"measure: {mesh.measure()}") +print(f"measure of boundary: {mesh.measureBoundary()}") ---- -==== === Test relation between meshes : @@ -146,28 +90,23 @@ measure of boundary: 1497.0959239128888 * `saveHDF5(self, name: str) -> None` : save mesh to H5 file * `loadHDF5(self, name: str) -> None` : load mesh from H5 file -[source,python] ----- -mesh.saveHDF5("mesh.h5") -mesh.loadHDF5("mesh.h5") ----- == Ranges -* `elements` : `feelpp.elements(mesh)` : get iterator over the elements of the mesh -* `markedelements` : +`elements`:: `feelpp.elements(mesh)` : get iterator over the elements of the mesh +`markedelements`:: 1. `feelpp.markedelements(mesh, tag: str)` : get iterator over the marked elements of the mesh 2. `feelpp.markedelements(mesh, marker: str)` : return the range of elements of the mesh with marker 3. `feelpp.markedelements(mesh, markers: List[str])` : return the range of elements of the mesh with markers -* `faces` (???) -* `markedfaces` : +`faces`:: `feelpp.faces(mesh)` : get iterator over the faces of the mesh +`markedfaces`:: 1. `feelpp.markedfaces(mesh, marker: str)` : return the range of facets of the mesh with marker 2. `markedfaces(mesh, markers: List[str])` : return the range of facets of the mesh with marker -* `boundaryfaces` : `feelpp.boundaryfaces(mesh)`: get iterator over the boundary faces of the mesh +`boundaryfaces`:: `feelpp.boundaryfaces(mesh)`: get iterator over the boundary faces of the mesh A first example with ranges: -[source,python] +[%dynamic,python] ---- r = feelpp.elements(mesh) print("mesh elts:", feelpp.nelements(r)) @@ -175,35 +114,20 @@ r = feelpp.boundaryfaces(mesh) print("mesh boundary faces:", feelpp.nelements(r)) ---- -[%collapsible.result] -.Results -==== ----- -mesh elts: 5134 -mesh boundary faces: 610 ----- -==== A second more interesting example with ranges uses integrate to compute integrals of expressions over the mesh: .Example : compute integrals -[source,python] +[%dynamic,python] ---- from feelpp.integrate import integrate i1 = integrate(range=feelpp.elements(mesh),expr="sin(x+y):x:y") i2 = integrate(range=feelpp.boundaryfaces(mesh),expr="x*nx+y*ny+z*nz:x:y:z:nx:ny:nz") i3 = integrate(range=feelpp.markedelements(mesh, "marker"), expr="1") -print("i1 = {}, i2 = {}, i3 = {}".format(i1,i2,i3)) ----- -[%collapsible.result] -.Results -==== ----- -i1 = [3.24282386], i2 = [149.465], i3 = [0.] +print(f"i1 = {i1}, i2 = {i2}, i3 = {i3}") ---- -==== == Next steps diff --git a/site-dev.yml b/site-dev.yml index 7c4d687ef..9ec6fae66 100644 --- a/site-dev.yml +++ b/site-dev.yml @@ -93,7 +93,7 @@ antora: - '@antora/collector-extension' asciidoc: attributes: - page-component-order: '!home, !ROOT, user, toolboxes, feelpp-project, dev, data, math, *' + page-component-order: '!home, !ROOT, user, toolboxes, feelpp-project, dev, data, math, mor, contribute' dynamic-blocks@: '' # soft enable version: 0.110 feelpp-git-tag: develop diff --git a/site.yml b/site.yml index 20aa64dc2..e026c0a58 100644 --- a/site.yml +++ b/site.yml @@ -98,7 +98,7 @@ antora: - '@antora/collector-extension' asciidoc: attributes: - page-component-order: '!home, !ROOT, user, toolboxes, feelpp-project, dev, data, math, *' + page-component-order: '!home, !ROOT, user, toolboxes, feelpp-project, dev, data, math, mor, contribute' dynamic-blocks@: '' # soft enable page-pagination: '' kroki-fetch-diagram: true diff --git a/supplemental-ui/layouts/home.hbs b/supplemental-ui/layouts/home.hbs deleted file mode 100644 index 523ddaa40..000000000 --- a/supplemental-ui/layouts/home.hbs +++ /dev/null @@ -1,74 +0,0 @@ - - - - - {{> head defaultPageTitle='Untitled'}} - - - - {{> header}} - -
- {{> nav componentOrder=page.attributes.component-order}} -
- {{!-- toolbar for responsive nav --}} - - -
- {{> article}} -
- -
- -
- -
-
-

Recommended Resources

-
- {{#each (get-recommended-resources)}} - {{> book-cover this}} - {{/each}} -
-
-
- -
- -
- -
- -
- - {{> footer}} - - - \ No newline at end of file