Skip to content

Commit 2a1c25c

Browse files
committed
Add math support, home page prototype, blank quick-start page
1 parent 503be89 commit 2a1c25c

File tree

4 files changed

+91
-22
lines changed

4 files changed

+91
-22
lines changed

docs/_config.yml

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ aux_links_new_tab: true
2525
# Color scheme supports "light" (default) and "dark"
2626
color_scheme: light
2727

28+
# Math support
29+
compress_html:
30+
- blanklines: true
31+
32+
# LaTeX rendering via "katex" (KaTeX, default) or "mathjax" (MathJax) or "none" / "off" (NO rendering)
33+
latex: mathjax
34+
2835
# Back to top link
2936
back_to_top: true
3037
back_to_top_text: "Back to top"

docs/_includes/head_custom.html

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{% if site.latex == "none" or site.latex == "off" %}
2+
<!-- LaTeX Rendering OFF in MarkDown -->
3+
{% elsif site.latex == "mathjax" %}
4+
<!-- Use MathJax to Render LaTeX in MarkDown -->
5+
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
6+
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
7+
{% elsif site.latex == "katex" %}
8+
<!-- Use KaTeX to Render LaTeX in MarkDown -->
9+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css"
10+
integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
11+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js"
12+
integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
13+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/auto-render.min.js"
14+
integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"></script>
15+
<script>
16+
document.addEventListener("DOMContentLoaded", function () {
17+
renderMathInElement(document.body, {
18+
// customised options
19+
// • auto-render specific keys, e.g.:
20+
delimiters: [
21+
{ left: '$$', right: '$$', display: true },
22+
{ left: '$', right: '$', display: false },
23+
{ left: '\\(', right: '\\)', display: false },
24+
{ left: '\\[', right: '\\]', display: true }
25+
],
26+
// • rendering keys, e.g.:
27+
throwOnError: false
28+
});
29+
});
30+
</script>
31+
{% endif %}

docs/index.md

+37-22
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,55 @@ layout: home
44
nav_order: 1
55
---
66

7-
Work in progress
8-
{: .label .label-red }
9-
107
<p align="center">
118
<img src="../assets/images/dae-cpp-01a.png" alt="dae-cpp logo" width="250"/>
129
</p>
1310

14-
This is a *bare-minimum* template to create a Jekyll site that uses the [Just the Docs] theme. You can easily set the created site to be published on [GitHub Pages] – the [README] file explains how to do that, along with other details.
1511

16-
If [Jekyll] is installed on your computer, you can also build and preview the created site *locally*. This lets you test changes before committing them, and avoids waiting for GitHub Pages.[^1] And you will be able to deploy your local build to a different platform than GitHub Pages.
12+
{: .note }
13+
This is a massively reworked and updated version of `dae-cpp`, which is incompatible with the previous version. If your project still relies on the old `dae-cpp`, it is archived in the [legacy](https://github.com/dae-cpp/dae-cpp/tree/legacy) branch.
14+
15+
## What is `dae-cpp`
16+
17+
`dae-cpp` is a cross-platform, header-only C++-17 library for solving stiff systems of [Differential-Algebraic Equations](https://en.wikipedia.org/wiki/Differential-algebraic_system_of_equations) (DAE). DAE systems can contain both differential and algebraic equations and can be written in the following matrix-vector form:
18+
19+
$$\mathbf{M}(t) \frac{\mathrm{d}\mathbf{x}}{\mathrm{d}t} = \mathbf{f}(\mathbf{x}, t),$$
20+
21+
to be solved in the interval $$t \in [0, t_\mathrm{end}]$$ with the initial condition $$\mathbf{x}\rvert_{t=0} = \mathbf{x}_0$$. Here $$\mathbf{M}(t)$$ is the mass matrix (can depend on time), $$\mathbf{x}(t)$$ is the state vector, and $$\mathbf{f}(\mathbf{x}, t)$$ is the (nonlinear) vector function of the state vector $$\mathbf{x}$$ and time $$t$$.
22+
23+
### How does it work
24+
25+
The DAE solver uses implicit Backward Differentiation Formulae (BDF) of orders I-IV with adaptive time stepping. Every time step, the BDF integrator reduces the original DAE system to a system of nonlinear equations, which is solved using iterative [Quasi-Newton](https://en.wikipedia.org/wiki/Quasi-Newton_method) root-finding algorithm. The Quasi-Newton method reduces the problem further down to a system of linear equations, which is solved using [Eigen](https://eigen.tuxfamily.org/index.php?title=Main_Page), a versatile and fast C++ template library for linear algebra.
26+
Eigen's sparse solver performs two steps: factorization (decomposition) of the Jacobian matrix and the linear system solving itself. This gives us the numerical solution of the entire DAE system at the current time step. Finally, depending on the convergence rate of the Quasi-Newton method, variability of the solution, and user-defined accuracy, the DAE solver adjusts the time step size and initiates a new iteration in time.
1727

18-
More specifically, the created site:
28+
### The main features of the solver
1929

20-
- uses a gem-based approach, i.e. uses a `Gemfile` and loads the `just-the-docs` gem
21-
- uses the [GitHub Pages / Actions workflow] to build and publish the site on GitHub Pages
30+
- Header only, no pre-compilation required.
31+
- Uses automatic (algorithmic, exact) differentiation ([autodiff](https://autodiff.github.io/)) to compute the Jacobian matrix, if it is not provided by the user.
32+
- Fourth-order implicit BDF time integrator that preserves accuracy even when the time step rapidly changes.
33+
- A very flexible and customizable variable time stepping algorithm based on the solution stability and variability.
34+
- Mass matrix can be non-static (can depend on time) and it can be singular.
35+
- The library is extremely easy to use. A simple DAE can be set up using just a few lines of code (see [Quick Start](#quick-start) example below).
2236

23-
Other than that, you're free to customize sites that you create with this template, however you like. You can easily change the versions of `just-the-docs` and Jekyll it uses, as well as adding further plugins.
37+
### Installation
2438

25-
[Browse our documentation][Just the Docs] to learn more about how to use this theme.
39+
This library is header only, no need to install, just copy `dae-cpp`, `Eigen`, and `autodiff` folders into your project.
2640

27-
To get started with creating a site, simply:
41+
Examples and tests can be compiled using CMake (see [Testing](#testing)).
2842

29-
1. click "[use this template]" to create a GitHub repository
30-
2. go to Settings > Pages > Build and deployment > Source, and select GitHub Actions
43+
### Testing
3144

32-
If you want to maintain your docs in the `docs` directory of an existing project repo, see [Hosting your docs from an existing project repo](https://github.com/just-the-docs/just-the-docs-template/blob/main/README.md#hosting-your-docs-from-an-existing-project-repo) in the template README.
45+
If you already have cloned the project without `--recurse-submodules` option, you can initialize and update `googletest` submodule by running
3346

34-
----
47+
```bash
48+
git submodule update --init
49+
```
3550

36-
[^1]: [It can take up to 10 minutes for changes to your site to publish after you push the changes to GitHub](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll#creating-your-site).
51+
Then build and run the tests:
3752

38-
[Just the Docs]: https://just-the-docs.github.io/just-the-docs/
39-
[GitHub Pages]: https://docs.github.com/en/pages
40-
[README]: https://github.com/just-the-docs/just-the-docs-template/blob/main/README.md
41-
[Jekyll]: https://jekyllrb.com
42-
[GitHub Pages / Actions workflow]: https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta/
43-
[use this template]: https://github.com/just-the-docs/just-the-docs-template/generate
53+
```bash
54+
mkdir build && cd build
55+
cmake ..
56+
make
57+
ctest
58+
```

docs/quick-start.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: Quick Start
3+
layout: default
4+
nav_order: 1.5
5+
---
6+
7+
Work in progress
8+
{: .label .label-red }
9+
10+
# Quick Start
11+
12+
Text
13+
14+
## Subtitle
15+
16+
Text

0 commit comments

Comments
 (0)