Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JSchoeberl committed Jun 7, 2024
1 parent dda3ec6 commit 1364c8b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 453 deletions.
257 changes: 18 additions & 239 deletions TEAM-7/team7.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions _sources/TEAM-7/team7.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@
" # f.Assemble()\n",
" # inv = solvers.CGSolver(mat=a.mat, pre=pre, printrates='\\r', maxiter=200)\n",
" # A.vec[:] = inv*f.vec\n",
" solvers.BVP(bf=a, lf=f, gf=A, pre=pre, tol=1e-12, solver_flags={\"printrates\": \"\\r\"})\n",
" solvers.BVP(bf=a, lf=f, gf=A, pre=pre, \\\n",
" solver=solvers.CGSolver, solver_flags={\"plotrates\": True, \"tol\" : 1e-12})\n",
" \n",
" B = curl(A)\n",
" J = -1j*omega*sigma * A\n",
Expand Down Expand Up @@ -486,7 +487,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "89253db5-a884-4038-aff4-6261d7bccd35",
"id": "c26b1568-4a46-4e03-8a42-5f30db8f7b01",
"metadata": {},
"outputs": [],
"source": []
Expand Down
109 changes: 13 additions & 96 deletions _sources/intro.md
Original file line number Diff line number Diff line change
@@ -1,108 +1,25 @@
# Compumag TEAM-problems

The international Compumag Societey provides a
set of problems for Testing Electromagnetic Analsysi Methods (TEAM),
well known as [TEAM problems](https://www.compumag.org/wp/team/).

OLD OLD OLD OLD TEXT
This repository collects solutions obtained from simulations with the open source
finite element tool [Netgen/NGSolve](ngsolve.org)


[Joachim Schöberl](https://www.asc.tuwien.ac.at/~schoeberl)
This website is generated from executing a set of ipython notebooks by the jupyter tool family.

TU Wien, [Institute of Analysis and Scientific Computing](https://www.tuwien.at/en/mg/asc)
The NGSolve software and additional packages can by easily installed for the
Python system using

The finite element method is a powerful tool for computer simulation of problems in engineering and sciences.
Such problems are often described mathematically by means of partial
differential equations, which are then discretized on a mesh.
python -m pip ngsolve jupyter numpy scipy matplotlib

Finite element methods are in the intersection of mathematics,
engineering, and scientific computing. Thus it is natural that there
are very different courses teaching finite elements, from very
theoretical courses never touching the computer, to very applied
classes running commercial programmes without teaching the methods
behind.

In this class we follow an approach in between: We aim explaining the
mathematical theory, and giving students the possibility to try all
methods on the computer. For this we are using the open source finite
element package [Netgen/NGSolve](https://www.ngsolve.org), which can be conveniently used via its
Python frontend in jupyter-notebooks.

This lecture is given in this form the first time in summer term 24.
If you have suggestions for improvements, or found some errors, please send them per mail
to the author.
Many section are still in draft version, and will be cleaned as the class proceeds.

If you like the material, show it by giving a star on github.


## Literature

* Lecture notes [Schöberl](numpde.pdf) and Faustmann+Schöberl (available in TU-Wien TUWEL)

Books:

* D.Braess: Finite Elements. Theory, Fast Solvers, and Applications in Solid Mechanics
* C. Johnson: Numerical solution of partial differential equations by the finite element method
* D.Boffi, F.Brezzi, M.Fortin: Mixed Finite Element Methods and Applications
* S.Brenner, R.Scott: The Mathematical Theory of Finite Element Methods
* A. Ern, J.-L.Guermond: Finite Elements I-III


## Installing NGSolve

Install a recent Python. Then it should be easy to install NGSolve using

pip install jupyter numpy scipy matplotlib
pip install --pre ngsolve
pip install webgui_jupyter_widgets


To check the installation of NGSolve run in the console:

python3 -c "import ngsolve; print(ngsolve.__version__)"

Then, open jupyter-notebook (or jupyter-lab or VS Code), create a new notebook, create and execute a cell with

from ngsolve import *
from ngsolve.webgui import Draw
Draw (unit_cube.shape);


Known issues are
- Use pip3 instead of pip if there is no pip
- If you get an error like `externally-managed-environment`, then either use
virtual environments, or add the flag `--break-system-packages` to the pip command, see [explanation](https://veronneau.org/python-311-pip-and-breaking-system-packages.html)

- If you have conflicts with other packages, you may install NGSolve in a [virtual environment](https://docs.python.org/3/library/venv.html#creating-virtual-environments). For example I did

python3 -m venv /Users/joachim/numpde
source /Users/joachim/numpde/bin/activate

- If NGSolve compuatations are working, but you don't get the rendering: For jupyter notebook version < 7.0.0 you have to run additionally

jupyter nbextension install --user --py webgui_jupyter_widgets
jupyter nbextension enable --user --py webgui_jupyter_widgets



If local installation does not work, there are alternatives:

- login to a jupyter server from your browser:

[jupyterhub.cerbsim.com](https://jupyterhub.cerbsim.com) <br>
user: **ngshub_xx** <br>
pwd: **solve!xx** <br>
with xx number from 01 to 31



- run NGSolve online within jupyter-lite:

[![lite-badge](https://jupyterlite.rtfd.io/en/latest/_static/badge.svg)](https://jschoeberl.github.io/iFEM-lite/lab?path=iFEM.ipynb)

[https://jschoeberl.github.io/iFEM-lite/lab?path=iFEM.ipynb](https://jschoeberl.github.io/iFEM-lite/lab?path=iFEM.ipynb)

The first time it might take a few minutes to start, and then again to import ngsolve.


The models were setup jointly by the NGSolve-team lead by Joachim Schöberl (TU Wien)
and Chrisopher Lackner (CERBSim GmbH), with a leading role taken by
Valentin Hanser (TU Wien). Significant contributions by Karl Hollaus, Michael Leumüller
and Markus Schöbinger (TU Wien) and Matthias Hochsteger (CERBSim GmbH) are acknowledged.


```{tableofcontents}
Expand Down
2 changes: 1 addition & 1 deletion genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
129 changes: 16 additions & 113 deletions intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down Expand Up @@ -319,9 +319,7 @@
</button>
`);
</script>
<label class="sidebar-toggle secondary-toggle btn btn-sm" for="__secondary"title="Toggle secondary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-list"></span>
</label>

</div></div>

</div>
Expand All @@ -337,15 +335,6 @@ <h1>Compumag TEAM-problems</h1>
<div id="print-main-content">
<div id="jb-print-toc">

<div>
<h2> Contents </h2>
</div>
<nav aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#literature">Literature</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#installing-ngsolve">Installing NGSolve</a></li>
</ul>
</nav>
</div>
</div>
</div>
Expand All @@ -357,92 +346,21 @@ <h2> Contents </h2>

<section class="tex2jax_ignore mathjax_ignore" id="compumag-team-problems">
<h1>Compumag TEAM-problems<a class="headerlink" href="#compumag-team-problems" title="Link to this heading">#</a></h1>
<p>OLD OLD OLD OLD TEXT</p>
<p><a class="reference external" href="https://www.asc.tuwien.ac.at/~schoeberl">Joachim Schöberl</a></p>
<p>TU Wien, <a class="reference external" href="https://www.tuwien.at/en/mg/asc">Institute of Analysis and Scientific Computing</a></p>
<p>The finite element method is a powerful tool for computer simulation of problems in engineering and sciences.
Such problems are often described mathematically by means of partial
differential equations, which are then discretized on a mesh.</p>
<p>Finite element methods are in the intersection of mathematics,
engineering, and scientific computing. Thus it is natural that there
are very different courses teaching finite elements, from very
theoretical courses never touching the computer, to very applied
classes running commercial programmes without teaching the methods
behind.</p>
<p>In this class we follow an approach in between: We aim explaining the
mathematical theory, and giving students the possibility to try all
methods on the computer. For this we are using the open source finite
element package <a class="reference external" href="https://www.ngsolve.org">Netgen/NGSolve</a>, which can be conveniently used via its
Python frontend in jupyter-notebooks.</p>
<p>This lecture is given in this form the first time in summer term 24.
If you have suggestions for improvements, or found some errors, please send them per mail
to the author.
Many section are still in draft version, and will be cleaned as the class proceeds.</p>
<p>If you like the material, show it by giving a star on github.</p>
<section id="literature">
<h2>Literature<a class="headerlink" href="#literature" title="Link to this heading">#</a></h2>
<ul class="simple">
<li><p>Lecture notes <a class="reference internal" href="#numpde.pdf"><span class="xref myst">Schöberl</span></a> and Faustmann+Schöberl (available in TU-Wien TUWEL)</p></li>
</ul>
<p>Books:</p>
<ul class="simple">
<li><p>D.Braess: Finite Elements. Theory, Fast Solvers, and Applications in Solid Mechanics</p></li>
<li><p>C. Johnson: Numerical solution of partial differential equations by the finite element method</p></li>
<li><p>D.Boffi, F.Brezzi, M.Fortin: Mixed Finite Element Methods and Applications</p></li>
<li><p>S.Brenner, R.Scott: The Mathematical Theory of Finite Element Methods</p></li>
<li><p>A. Ern, J.-L.Guermond: Finite Elements I-III</p></li>
</ul>
</section>
<section id="installing-ngsolve">
<h2>Installing NGSolve<a class="headerlink" href="#installing-ngsolve" title="Link to this heading">#</a></h2>
<p>Install a recent Python. Then it should be easy to install NGSolve using</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>pip install jupyter numpy scipy matplotlib
pip install --pre ngsolve
pip install webgui_jupyter_widgets
</pre></div>
</div>
<p>To check the installation of NGSolve run in the console:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -c &quot;import ngsolve; print(ngsolve.__version__)&quot;
<p>The international Compumag Societey provides a
set of problems for Testing Electromagnetic Analsysi Methods (TEAM),
well known as <a class="reference external" href="https://www.compumag.org/wp/team/">TEAM problems</a>.</p>
<p>This repository collects solutions obtained from simulations with the open source
finite element tool <a class="reference internal" href="#ngsolve.org"><span class="xref myst">Netgen/NGSolve</span></a></p>
<p>This website is generated from executing a set of ipython notebooks by the jupyter tool family.</p>
<p>The NGSolve software and additional packages can by easily installed for the
Python system using</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python -m pip ngsolve jupyter numpy scipy matplotlib
</pre></div>
</div>
<p>Then, open jupyter-notebook (or jupyter-lab or VS Code), create a new notebook, create and execute a cell with</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>from ngsolve import *
from ngsolve.webgui import Draw
Draw (unit_cube.shape);
</pre></div>
</div>
<p>Known issues are</p>
<ul>
<li><p>Use pip3 instead of pip if there is no pip</p></li>
<li><p>If you get an error like <code class="docutils literal notranslate"><span class="pre">externally-managed-environment</span></code>, then either use
virtual environments, or add the flag <code class="docutils literal notranslate"><span class="pre">--break-system-packages</span></code> to the pip command, see <a class="reference external" href="https://veronneau.org/python-311-pip-and-breaking-system-packages.html">explanation</a></p></li>
<li><p>If you have conflicts with other packages, you may install NGSolve in a <a class="reference external" href="https://docs.python.org/3/library/venv.html#creating-virtual-environments">virtual environment</a>. For example I did</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>python3 -m venv /Users/joachim/numpde
source /Users/joachim/numpde/bin/activate
</pre></div>
</div>
</li>
<li><p>If NGSolve compuatations are working, but you don’t get the rendering: For jupyter notebook version &lt; 7.0.0 you have to run additionally</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>jupyter nbextension install --user --py webgui_jupyter_widgets
jupyter nbextension enable --user --py webgui_jupyter_widgets
</pre></div>
</div>
</li>
</ul>
<p>If local installation does not work, there are alternatives:</p>
<ul>
<li><p>login to a jupyter server from your browser:</p>
<p><a class="reference external" href="https://jupyterhub.cerbsim.com">jupyterhub.cerbsim.com</a> <br>
user: <strong>ngshub_xx</strong> <br>
pwd: <strong>solve!xx</strong> <br>
with xx number from 01 to 31</p>
</li>
<li><p>run NGSolve online within jupyter-lite:</p>
<p><a class="reference external" href="https://jschoeberl.github.io/iFEM-lite/lab?path=iFEM.ipynb"><img alt="lite-badge" src="https://jupyterlite.rtfd.io/en/latest/_static/badge.svg" /></a></p>
<p><a class="reference external" href="https://jschoeberl.github.io/iFEM-lite/lab?path=iFEM.ipynb">https://jschoeberl.github.io/iFEM-lite/lab?path=iFEM.ipynb</a></p>
<p>The first time it might take a few minutes to start, and then again to import ngsolve.</p>
</li>
</ul>
<p>The models were setup jointly by the NGSolve-team lead by Joachim Schöberl (TU Wien)
and Chrisopher Lackner (CERBSim GmbH), with a leading role taken by
Valentin Hanser (TU Wien). Significant contributions by Karl Hollaus, Michael Leumüller
and Markus Schöbinger (TU Wien) and Matthias Hochsteger (CERBSim GmbH) are acknowledged.</p>
<div class="toctree-wrapper compound">
<p aria-level="2" class="caption" role="heading"><span class="caption-text">the first few</span></p>
<ul>
Expand All @@ -452,7 +370,6 @@ <h2>Installing NGSolve<a class="headerlink" href="#installing-ngsolve" title="Li
<li class="toctree-l1"><a class="reference internal" href="TEAM-24/team24.html#material-parameters">4. Material Parameters</a></li>
</ul>
</div>
</section>
</section>

<script type="text/x-thebe-config">
Expand Down Expand Up @@ -501,21 +418,7 @@ <h2>Installing NGSolve<a class="headerlink" href="#installing-ngsolve" title="Li



<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">


<div class="sidebar-secondary-item">
<div class="page-toc tocsection onthispage">
<i class="fa-solid fa-list"></i> Contents
</div>
<nav class="bd-toc-nav page-toc">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#literature">Literature</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#installing-ngsolve">Installing NGSolve</a></li>
</ul>
</nav></div>

</div></div>
<div class="bd-sidebar-secondary bd-toc"></div>


</div>
Expand Down
2 changes: 1 addition & 1 deletion search.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<link rel="stylesheet" type="text/css" href="_static/styles/sphinx-book-theme.css?v=384b581d" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css?v=13237357" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css?v=76b2166b" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.4510f1fc1dee50b3e5859aac5469c37c29e427902b24a333a5f9fcb2f0b3ac41.css?v=be8a1c11" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css?v=4fa983c6" />
<link rel="stylesheet" type="text/css" href="_static/design-style.1e8bd061cd6da7fc9cf755528e8ffc24.min.css?v=0a3b3ea7" />

Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 1364c8b

Please sign in to comment.