<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://e6.ijs.si/medusa/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mitjajancic</id>
		<title>Medusa: Coordinate Free Mehless Method implementation - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://e6.ijs.si/medusa/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mitjajancic"/>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php/Special:Contributions/Mitjajancic"/>
		<updated>2026-04-17T02:12:53Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.1</generator>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Solving_sparse_systems&amp;diff=3547</id>
		<title>Solving sparse systems</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Solving_sparse_systems&amp;diff=3547"/>
				<updated>2023-02-15T07:42:37Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many methods available for solving sparse systems. We compare some of them here.&lt;br /&gt;
&amp;lt;figure id=&amp;quot;fig:matrix1&amp;quot;&amp;gt;&lt;br /&gt;
[[File:matrix.png|300px|thumb|upright=2|alt=Matrix of the discretized PDE.|&amp;lt;caption&amp;gt;Matrix of the discretized PDE. &amp;lt;/caption&amp;gt;]]&lt;br /&gt;
&amp;lt;/figure&amp;gt;&lt;br /&gt;
Mathematica has the following methods available (https://reference.wolfram.com/language/ref/LinearSolve.html#DetailsAndOptions)&lt;br /&gt;
* direct: banded, cholesky, multifrontal (direct sparse LU)&lt;br /&gt;
* iterative: Krylov&lt;br /&gt;
&lt;br /&gt;
Matlab has the following methods:&lt;br /&gt;
* direct: https://www.mathworks.com/help/matlab/ref/mldivide.html#bt42omx_head&lt;br /&gt;
* iterative: https://www.mathworks.com/help/matlab/math/systems-of-linear-equations.html#brzoiix, including bicgstab, gmres &lt;br /&gt;
&lt;br /&gt;
Eigen has the following methods: (https://eigen.tuxfamily.org/dox-devel/group__TopicSparseSystems.html)&lt;br /&gt;
* direct: sparse LU&lt;br /&gt;
* iterative: bicgstab, cg&lt;br /&gt;
&lt;br /&gt;
Solving a simple sparse system $A x = b$ for steady space of heat equation in 1d with $n$ nodes, results in a matrix shown in &amp;lt;xr id=&amp;quot;fig:matrix1&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following timings of solvers are given in seconds:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! $n = 10^6$&lt;br /&gt;
! Matlab&lt;br /&gt;
! Mathematica&lt;br /&gt;
! Eigen&lt;br /&gt;
|-&lt;br /&gt;
! Banded&lt;br /&gt;
| 0.16&lt;br /&gt;
| 0.28&lt;br /&gt;
| 0.04&lt;br /&gt;
|-&lt;br /&gt;
! SparseLU&lt;br /&gt;
| /&lt;br /&gt;
| 1.73&lt;br /&gt;
| 0.82&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Incomplete LU preconditioner was used for BICGStab.&lt;br /&gt;
Without the preconditioner BICGStab does not converge.&lt;br /&gt;
&lt;br /&gt;
==Parallel execution ==&lt;br /&gt;
BICGStab can be run in parallel, as explain in the general parallelism: https://eigen.tuxfamily.org/dox/TopicMultiThreading.html, and specifically&lt;br /&gt;
&lt;br /&gt;
'''&amp;quot;When using sparse matrices, best performance is achied for a row-major sparse matrix format.&amp;lt;br&amp;gt;Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled&amp;quot;.'''&lt;br /&gt;
&lt;br /&gt;
Eigen uses number of threads specified my OopenMP, unless &amp;lt;code&amp;gt;Eigen::setNbThreads(n);&amp;lt;/code&amp;gt; was called.&lt;br /&gt;
Minimal working example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;figure id=&amp;quot;fig:eigen_par&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eigen_parallel_2.png|1200px|thumb|upright=2|alt=Matrix of the discretized PDE.|&amp;lt;caption&amp;gt;Memory and CPU usage. C stands for construction of the system, L stands for the calculation of ILUT preconditioner and S for BICGStab iteration.&amp;lt;/caption&amp;gt;]]&lt;br /&gt;
&amp;lt;/figure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;quot;Eigen/Sparse&amp;quot;&lt;br /&gt;
#include &amp;quot;Eigen/IterativeLinearSolvers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
using namespace Eigen;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[]) {&lt;br /&gt;
&lt;br /&gt;
    assert(argc == 2 &amp;amp;&amp;amp; &amp;quot;Second argument is size of the system.&amp;quot;);&lt;br /&gt;
    stringstream ss(argv[1]);&lt;br /&gt;
    int n;&lt;br /&gt;
    ss &amp;gt;&amp;gt; n;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;n = &amp;quot; &amp;lt;&amp;lt; n &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    // Fill the matrix&lt;br /&gt;
    VectorXd b = VectorXd::Ones(n) / n / n;&lt;br /&gt;
    b(0) = b(n-1) = 1;&lt;br /&gt;
    SparseMatrix&amp;lt;double, RowMajor&amp;gt; A(n, n);&lt;br /&gt;
    A.reserve(vector&amp;lt;int&amp;gt;(n, 3));  // 3 per row&lt;br /&gt;
    for (int i = 0; i &amp;lt; n-1; ++i) {&lt;br /&gt;
        A.insert(i, i) = -2;&lt;br /&gt;
        A.insert(i, i+1) = 1;&lt;br /&gt;
        A.insert(i+1, i) = 1;&lt;br /&gt;
    }&lt;br /&gt;
    A.coeffRef(0, 0) = 1;&lt;br /&gt;
    A.coeffRef(0, 1) = 0;&lt;br /&gt;
    A.coeffRef(n-1, n-2) = 0;&lt;br /&gt;
    A.coeffRef(n-1, n-1) = 1;&lt;br /&gt;
&lt;br /&gt;
    // Solve the system&lt;br /&gt;
    BiCGSTAB&amp;lt;SparseMatrix&amp;lt;double, RowMajor&amp;gt;, IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.setTolerance(1e-10);&lt;br /&gt;
    solver.setMaxIterations(1000);&lt;br /&gt;
    solver.compute(A);&lt;br /&gt;
    VectorXd x = solver.solve(b);&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;#iterations:     &amp;quot; &amp;lt;&amp;lt; solver.iterations() &amp;lt;&amp;lt; endl;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;estimated error: &amp;quot; &amp;lt;&amp;lt; solver.error()      &amp;lt;&amp;lt; endl;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;sol: &amp;quot; &amp;lt;&amp;lt; x.head(6).transpose() &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
was compiled with &amp;lt;code&amp;gt;g++ -o parallel_solve -O3 -fopenmp solver_test_parallel.cpp&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;xr id=&amp;quot;fig:eigen_par&amp;quot;/&amp;gt; was produced when the program above was run as &amp;lt;code&amp;gt;./parallel_solve 10000000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==ILUT factorization==&lt;br /&gt;
This is a method to compute a general algebraic preconditioner which has the ability to control (to some degree) the memory and time complexity of the solution.&lt;br /&gt;
It is described in a paper by  &lt;br /&gt;
&lt;br /&gt;
  Saad, Yousef. &amp;quot;ILUT: A dual threshold incomplete LU factorization.&amp;quot; Numerical linear algebra with applications 1.4 (1994): 387-402.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It has two parameters, tolerance $\tau$ and fill factor $f$. Elements in $L$ and $U$ factors that would be below relative tolerance $\tau$ (say, to 2-norm of this row) are dropped. &lt;br /&gt;
Then, only $f$ elements per row in $L$ and $U$ are allowed and the maximum $f$ (if they exist) are taken. The diagonal elements are always kept. This means that the number of non-zero&lt;br /&gt;
elements in the rows of the preconditioner can not exceed $2f+1$. &lt;br /&gt;
&lt;br /&gt;
Greater parameter $f$ means slover but better $ILUT$ factorization. If $\tau$ is small, having a very large $f$ means getting a complete $LU$ factorization. Typical values are $5, 10, 20, 50$.&lt;br /&gt;
Lower $\tau$ values mean that move small elements are kept, resulting in a more precise, but longer computation. With a large $f$, the factorization approaches the direct $LU$ factorization as $\tau \to 0$. Typical values are from 1e-2 &lt;br /&gt;
to 1e-6.&lt;br /&gt;
&lt;br /&gt;
Whether the method converges or diverges for given parameters is very sudden and should be determined for each apllication separately. An example of &lt;br /&gt;
such a convergence graph for the diffusion equation is presented in figures below:&lt;br /&gt;
&lt;br /&gt;
[[File:bicgstab_err.png|400px]][[File:bicgstab_conv.png|400px]][[File:bicgstab_iter.png|400px]]&lt;br /&gt;
&lt;br /&gt;
We can see that low BiCGSTAB error estimate coincides with the range of actual small error compared to the analytical solution as well as with the range of lesser number of iterations.&lt;br /&gt;
&lt;br /&gt;
==Pardiso library==&lt;br /&gt;
[[Pardiso]]&lt;br /&gt;
&lt;br /&gt;
==Herzian contact ==&lt;br /&gt;
The matrix of the [[Hertzian contact]] problem is shown below:&lt;br /&gt;
 [[File:matrix_hertzian.png|500px]]&lt;br /&gt;
&lt;br /&gt;
The condition number iz arther large and grows superlinearly with size in the example below.&lt;br /&gt;
 [[File:cond.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Discussion based on practical observations =&lt;br /&gt;
&lt;br /&gt;
In this section we analyse different solvers, all available as part of&lt;br /&gt;
the [https://eigen.tuxfamily.org/dox/group__TopicSparseSystems.html Eigen library] supported by&lt;br /&gt;
the [https://e6.ijs.si/medusa/ Medusa]. Namely we analyse the performance&lt;br /&gt;
of two direct solvers&lt;br /&gt;
&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1SparseLU.html SparseLU]&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1SparseQR.html SparseQR]&lt;br /&gt;
&lt;br /&gt;
three combinations of general purpose iterative&lt;br /&gt;
solver [https://eigen.tuxfamily.org/dox/classEigen_1_1BiCGSTAB.html BiCGSTAB]&lt;br /&gt;
&lt;br /&gt;
* BiCGSTAB&lt;br /&gt;
* BiCGSTAB with ILUT preconditioner&lt;br /&gt;
* BiCGSTAB with ILUT preconditioner and exploited '''[https://eigen.tuxfamily.org/dox/classEigen_1_1SolveWithGuess.html solveWithGuess()]''' functionality&lt;br /&gt;
&lt;br /&gt;
and a wrapper to external direct solver&lt;br /&gt;
&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1PardisoLU.html PardisoLU].&lt;br /&gt;
&lt;br /&gt;
The performance tests are focused on the accuracy of the numerical solution, number of iterations and time required to solve the final sparse system. We also comment on the amount of RAM required by a specific solver. If required, the [https://gitlab.com/e62Lab/Medusa-disucssions/-/tree/master/eigen_solvers gitlab repository] with the implementation is also provided.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
NOTE: Although the SparseQR has been included in our tests, significantly larger solve times compared to other solvers have been observed. For that reason, the SparseQR is discarded from further analyses even though it was able to obtain a solution of comparable accuracy.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
Computational times: To obtain the computational times the code was run on a single CPU with assured CPU affinity using the ''taskset'' command.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The two-dimensional Poisson problem ==&lt;br /&gt;
&lt;br /&gt;
First, we solve the Poisson problem&lt;br /&gt;
$$\nabla ^2 u(\boldsymbol x) = f(\boldsymbol x),$$&lt;br /&gt;
&lt;br /&gt;
for $\boldsymbol x \in \Omega $ where the domain $\Omega$ is a unit $d=2$ dimensional circle with radius $R=1$.&lt;br /&gt;
We use mixed boundary conditions, i.e., Dirichlet boundary for all $x &amp;lt; 0$ and Neumann boundary for all $x \geq 0$. Additionally, ghost or fictitious nodes were added to the Neumann boundary.&lt;br /&gt;
&lt;br /&gt;
We perform analyses on two scenarios, i.e., two definitions of $f(\boldsymbol x)$:&lt;br /&gt;
&lt;br /&gt;
* $f(\boldsymbol x) = -d\pi ^2 \prod_{i = 1}^d \sin(\pi x_i)$ yielding&lt;br /&gt;
** $f_d(\boldsymbol x) = \prod_{i = 1}^d \sin(\pi x_i)$ on the Dirichlet boundary and&lt;br /&gt;
** $ \boldsymbol f_n(\boldsymbol x) = \pi \sum_{i = 1}^d \cos(\pi x_i) \prod_{j=1, j\neq i}^d \sin (\pi x_j)&lt;br /&gt;
      \boldsymbol e_i$ with unit vectors $\boldsymbol e_i$ on the Neumann boundary.&lt;br /&gt;
* $f(\boldsymbol x) = 2a e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}(2a\left \| \boldsymbol x -&lt;br /&gt;
  \boldsymbol x_s \right \| - d)$ for width $a=10^2$ of the exponential source positioned at $\boldsymbol x_s=\boldsymbol 0$ yielding&lt;br /&gt;
** $f_d(\boldsymbol x) = e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$ yielding on Dirichlet boundary and&lt;br /&gt;
** $\boldsymbol f_n (\boldsymbol x) = -2a(\boldsymbol x - \boldsymbol x_s)e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$ on Neumann boundary.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example numerical solutions to both scenarios are shown in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:solution_poisson.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Solver performance ===&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a two-dimensional Poisson problem. The first column shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of iterations a given solver required (direct solvers were assigned a value 1) and the third column shows the total time required to solve the system and obtain the numerical solution $\widehat u$.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_poisson_sin.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_poisson_exp.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
In terms of accuracy, all solvers under consideration perform equally good, with an exception of BiCGSTAB with ILUT preconditioner, who failed to obtain a solution of sufficient accuracy at the finest domain discretization with approximately $2\cdot 10^6$ nodes. The reason is most likely in the ILUT preconditioner, set to limit solver iterations to 200 with fill factor 40, drop tolerance $10^{-5}$ and global tolerance $10^{-15}$. A different ILUT setup would most probably yield a more desirable behaviour, but it nevertheless shows that when using a ILUT preconditioner one must be careful before making conclusions. It is also important to note that the SparseLU ran out of the available 11.5 Gb RAM and, therefore, failed to obtain a numerical solution. Other solvers had no issues with the available RAM space.&lt;br /&gt;
&lt;br /&gt;
It is perhaps more interesting to study the number of iterations required by the solvers. Obviously, direct solvers require a &amp;quot;single iteration&amp;quot;. Iterative solvers, on the other hand, require multiple iterations. Generally speaking, we observe that the number of solver iterations increases with the number of discretization points. However, it is interesting to see that the pure BiCGSTAB shows the most stable and predictable behaviour. Despite the fact that the guess provided to the BiCGSTAB is in fact the analytical solution to the problem, we do not observe significantly lower number of solver iterations.&lt;br /&gt;
&lt;br /&gt;
Nevertheless, from a practical point of view, solve time is more important than the number of iterations required to obtain a numerical solution. The last column of the above figures clearly shows that the two direct solvers significantly outperform the iterative BiCGSTAB solver. On the other hand, employing BiCGSTAB with a ILUT preconditioner or providing guess to it, seems to have marginal effect on the required time.&lt;br /&gt;
&lt;br /&gt;
== The three-dimensional Poisson problem ==&lt;br /&gt;
&lt;br /&gt;
Next, we test the solvers on a three-dimensional Poisson problem. The governing problem is exactly the same as in the previous case, except that the domain is a $d=3$ dimensional unit sphere.&lt;br /&gt;
&lt;br /&gt;
=== Solver performance ===&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a two-dimensional Poisson problem. The first column shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of iterations a given solver required (direct solvers were assigned a value 1) and the third column shows the total time required to solve the system and obtain the numerical solution $\widehat u$.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_3d_poisson_sin.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_3d_poisson_exp.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
In terms of accuracy, we again observe some unexpected behaviour when ILUT preconditioner is used. This time, the ILUT preconditioner was used to limit the solver iterations to 300 with fill factor 40, drop tolerance $10^{-5}$ and global tolerance $10^{-15}$. Although 100 more iterations were allowed than in the previous two-dimensional case, this clearly was not enough for the finest domain discretizations. Additionally, providing BiCGSTAB with the analytical guess yields even more confusing results as it yielded a sudden improve of the solution accuracy. This is, of course, wrong. It is important to note that we provide '''analytical solution''' as the guess. Therefore, as soon as the solver hits the maximum allowed iterations threshold it returns the best solution currently available - largely consisting out of the analytical guess provided.&lt;br /&gt;
&lt;br /&gt;
In fact, the most reliable results are again yielded by the pure BiCGSTAB and the two direct solvers. However, the two direct solvers both ran out of the available 11.5 Gb RAM space available. The SparseLU was still able to obtain a solution with $10^5$ discretization nodes, while PardisoLU seems to be more efficient since it was still able to obtain a solution with $4\cdot 10^5$ discretization points.&lt;br /&gt;
&lt;br /&gt;
From the time perspective, it is clear that the two direct solvers were again significantly faster than the iterative solver - that is, of course, until they ran out of RAM. We did not come across any RAM related&lt;br /&gt;
issues with the BiCGSTAB, even when the domain was discretized with more than a million nodes.&lt;br /&gt;
&lt;br /&gt;
== The linear elasticity: Boussinesq's problem ==&lt;br /&gt;
&lt;br /&gt;
As a final problem we solve the three-dimensional Boussinesq's problem, where a concentrated normal traction acts on an isotropic half-space &amp;lt;ref name=&amp;quot;slaughter&amp;quot;&amp;gt;Slaughter, William S. The linearized theory of elasticity. Springer Science &amp;amp; Business Media, 2012.&amp;lt;/ref&amp;gt;. The same problem has also just recently been solved by employing $h$-adaptive solution procedure &amp;lt;ref name=&amp;quot;slak&amp;quot;&amp;gt;J. Slak and G. Kosec, Adaptive radial basis function-generated finite differences method for contact problems, International Journal for Numerical Methods in Engineering, 2019. DOI: 10.1002/nme.6067.&amp;lt;/ref&amp;gt;, to demonstrate the performance of a hybrid mesh-free approximation method&amp;lt;ref name=&amp;quot;hybrid&amp;quot;&amp;gt;M. Jančič and G. Kosec, &amp;quot;A hybrid RBF-FD and WLS mesh-free strong-form approximation method,&amp;quot; 2022 7th International Conference on Smart and Sustainable Technologies (SpliTech), 2022, pp. 1-6, doi: 10.23919/SpliTech55088.2022.9854278.&amp;lt;/ref&amp;gt; also to test the performance of $hp$-adaptive solution procedures &amp;lt;ref name=&amp;quot;hp&amp;quot;&amp;gt;Jančič, Mitja, and Gregor Kosec. &amp;quot;Strong form mesh-free $ hp $-adaptive solution of linear elasticity problem.&amp;quot; arXiv preprint arXiv:2210.07073 (2022).&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The problem has a closed form solution given in cylindrical coordinates $r$, $\theta$ and $z$ as&lt;br /&gt;
&lt;br /&gt;
$$u_r = \frac{Pr}{4\pi \mu} \left(\frac{z}{R^3} - \frac{1-2\nu}{R(z+R)} \right), \qquad u_\theta = 0, \qquad u_z =&lt;br /&gt;
\frac{P}{4\pi \mu} \left(\frac{2(1-\nu)}{R} + \frac{z^2}{R^3} \right)$$&lt;br /&gt;
&lt;br /&gt;
with stress tensor components&lt;br /&gt;
&lt;br /&gt;
$$ \sigma_{rr} = \frac{P}{2\pi} \left( \frac{1-2\nu}{R(z+R)} - \frac{3r^2z}{R^5} \right), \qquad \sigma_{\theta\theta} =&lt;br /&gt;
\frac{P(1-2\nu)}{2\pi} \left( \frac{z}{R^3} - \frac{1}{R(z+R)} \right), \qquad \sigma_{zz} = -\frac{3Pz^3}{2 \pi R^5},$$&lt;br /&gt;
&lt;br /&gt;
$$ \sigma_{rz} = -\frac{3Prz^2}{2 \pi R^5} , \quad \sigma_{r\theta} = 0 , \qquad\sigma_{\theta z} = 0$$&lt;br /&gt;
&lt;br /&gt;
where $P$ is the magnitude of the concentrated force, $\nu$ is the Poisson's ratio, $\mu$ is the Lame parameter&lt;br /&gt;
and $R$ is the Eucledian distance to the origin. The solution has a singularity at the origin, which makes the problem ideal for treatment with adaptive procedures. Furthermore, the closed form solution also allows us to evaluate the accuracy of the numerical solution.&lt;br /&gt;
&lt;br /&gt;
In our setup, we consider only a small part of the problem, i.e., $\varepsilon = 0.1$ away from the singularity, as schematically shown in figure below. From a numerical point of view, we solve the Navier-Cauchy Equation with Dirichlet boundary conditions described in the sketch, where the domain $\Omega$ is defined as a box, i.e., $\Omega = [-1, -\varepsilon] \times [-1, -\varepsilon] \times [-1, -\varepsilon]$.&lt;br /&gt;
&lt;br /&gt;
[[File:boussinesq_sketch.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Example solution with approximately $2\cdot 10^5$ nodes is shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:solution_boussinesq.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Solver performance ===&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a three-dimensional Boussinesq's problem. The first column shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of iterations a given solver required (direct solvers were assigned a value 1) and the third column shows the total time required to solve the system and obtain the numerical solution $\widehat u$.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_3d_boussinesq.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
Similarly to previous studies on Poisson problems, we observe that in terms of accuracy of the numerical solution, all chosen solvers are in good agreement. However, this time we observe some desirable effects of the ILUT and guess on the performance of BiCGSTAB. Using ILUT preconditioner (and) guess reduces the number of iterations required - however, this does not notably improve the times required to obtain a numerical solution. Therefore, considering the fact that a badly-thought-out preconditioner orguess definition can notably affect the solver's performance, one is probably safer using the general purpose BiCGSTAB without the guess and without the preconditioner.&lt;br /&gt;
&lt;br /&gt;
The two direct solvers were again able to solve the linear sparse system notably faster than the iterative BiCGSTAB. Unfortunately, using direct solvers we again ran into RAM space related issues.&lt;br /&gt;
&lt;br /&gt;
= Further literature =&lt;br /&gt;
&lt;br /&gt;
To read more about the solvers, we propose:&lt;br /&gt;
* [https://users.fmf.uni-lj.si/plestenjak/Vaje/INMLA/Predavanja/Skripta.pdf Slovenian script by Bor Plestenjak]&lt;br /&gt;
* Matrix Algorithms: Volume II: Eigensystems&amp;lt;ref name=&amp;quot;gilbert1&amp;quot;&amp;gt;Stewart, Gilbert W. Matrix Algorithms: Volume II: Eigensystems. Society for Industrial and Applied Mathematics, 2001.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Matrix algorithms: volume 1: basic decompositions&amp;lt;ref name=&amp;quot;gilbert2&amp;quot;&amp;gt;Stewart, Gilbert W. Matrix algorithms: volume 1: basic decompositions. Society for Industrial and Applied Mathematics, 1998.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Solving_sparse_systems&amp;diff=3546</id>
		<title>Solving sparse systems</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Solving_sparse_systems&amp;diff=3546"/>
				<updated>2023-02-14T12:56:57Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Added some observations.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many methods available for solving sparse systems. We compare some of them here.&lt;br /&gt;
&amp;lt;figure id=&amp;quot;fig:matrix1&amp;quot;&amp;gt;&lt;br /&gt;
[[File:matrix.png|300px|thumb|upright=2|alt=Matrix of the discretized PDE.|&amp;lt;caption&amp;gt;Matrix of the discretized PDE. &amp;lt;/caption&amp;gt;]]&lt;br /&gt;
&amp;lt;/figure&amp;gt;&lt;br /&gt;
Mathematica has the following methods available (https://reference.wolfram.com/language/ref/LinearSolve.html#DetailsAndOptions)&lt;br /&gt;
* direct: banded, cholesky, multifrontal (direct sparse LU)&lt;br /&gt;
* iterative: Krylov&lt;br /&gt;
&lt;br /&gt;
Matlab has the following methods:&lt;br /&gt;
* direct: https://www.mathworks.com/help/matlab/ref/mldivide.html#bt42omx_head&lt;br /&gt;
* iterative: https://www.mathworks.com/help/matlab/math/systems-of-linear-equations.html#brzoiix, including bicgstab, gmres &lt;br /&gt;
&lt;br /&gt;
Eigen has the following methods: (https://eigen.tuxfamily.org/dox-devel/group__TopicSparseSystems.html)&lt;br /&gt;
* direct: sparse LU&lt;br /&gt;
* iterative: bicgstab, cg&lt;br /&gt;
&lt;br /&gt;
Solving a simple sparse system $A x = b$ for steady space of heat equation in 1d with $n$ nodes, results in a matrix shown in &amp;lt;xr id=&amp;quot;fig:matrix1&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following timings of solvers are given in seconds:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! $n = 10^6$&lt;br /&gt;
! Matlab&lt;br /&gt;
! Mathematica&lt;br /&gt;
! Eigen&lt;br /&gt;
|-&lt;br /&gt;
! Banded&lt;br /&gt;
| 0.16&lt;br /&gt;
| 0.28&lt;br /&gt;
| 0.04&lt;br /&gt;
|-&lt;br /&gt;
! SparseLU&lt;br /&gt;
| /&lt;br /&gt;
| 1.73&lt;br /&gt;
| 0.82&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Incomplete LU preconditioner was used for BICGStab.&lt;br /&gt;
Without the preconditioner BICGStab does not converge.&lt;br /&gt;
&lt;br /&gt;
==Parallel execution ==&lt;br /&gt;
BICGStab can be run in parallel, as explain in the general parallelism: https://eigen.tuxfamily.org/dox/TopicMultiThreading.html, and specifically&lt;br /&gt;
&lt;br /&gt;
'''&amp;quot;When using sparse matrices, best performance is achied for a row-major sparse matrix format.&amp;lt;br&amp;gt;Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled&amp;quot;.'''&lt;br /&gt;
&lt;br /&gt;
Eigen uses number of threads specified my OopenMP, unless &amp;lt;code&amp;gt;Eigen::setNbThreads(n);&amp;lt;/code&amp;gt; was called.&lt;br /&gt;
Minimal working example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;figure id=&amp;quot;fig:eigen_par&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eigen_parallel_2.png|1200px|thumb|upright=2|alt=Matrix of the discretized PDE.|&amp;lt;caption&amp;gt;Memory and CPU usage. C stands for construction of the system, L stands for the calculation of ILUT preconditioner and S for BICGStab iteration.&amp;lt;/caption&amp;gt;]]&lt;br /&gt;
&amp;lt;/figure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;quot;Eigen/Sparse&amp;quot;&lt;br /&gt;
#include &amp;quot;Eigen/IterativeLinearSolvers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
using namespace Eigen;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[]) {&lt;br /&gt;
&lt;br /&gt;
    assert(argc == 2 &amp;amp;&amp;amp; &amp;quot;Second argument is size of the system.&amp;quot;);&lt;br /&gt;
    stringstream ss(argv[1]);&lt;br /&gt;
    int n;&lt;br /&gt;
    ss &amp;gt;&amp;gt; n;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;n = &amp;quot; &amp;lt;&amp;lt; n &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    // Fill the matrix&lt;br /&gt;
    VectorXd b = VectorXd::Ones(n) / n / n;&lt;br /&gt;
    b(0) = b(n-1) = 1;&lt;br /&gt;
    SparseMatrix&amp;lt;double, RowMajor&amp;gt; A(n, n);&lt;br /&gt;
    A.reserve(vector&amp;lt;int&amp;gt;(n, 3));  // 3 per row&lt;br /&gt;
    for (int i = 0; i &amp;lt; n-1; ++i) {&lt;br /&gt;
        A.insert(i, i) = -2;&lt;br /&gt;
        A.insert(i, i+1) = 1;&lt;br /&gt;
        A.insert(i+1, i) = 1;&lt;br /&gt;
    }&lt;br /&gt;
    A.coeffRef(0, 0) = 1;&lt;br /&gt;
    A.coeffRef(0, 1) = 0;&lt;br /&gt;
    A.coeffRef(n-1, n-2) = 0;&lt;br /&gt;
    A.coeffRef(n-1, n-1) = 1;&lt;br /&gt;
&lt;br /&gt;
    // Solve the system&lt;br /&gt;
    BiCGSTAB&amp;lt;SparseMatrix&amp;lt;double, RowMajor&amp;gt;, IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.setTolerance(1e-10);&lt;br /&gt;
    solver.setMaxIterations(1000);&lt;br /&gt;
    solver.compute(A);&lt;br /&gt;
    VectorXd x = solver.solve(b);&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;#iterations:     &amp;quot; &amp;lt;&amp;lt; solver.iterations() &amp;lt;&amp;lt; endl;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;estimated error: &amp;quot; &amp;lt;&amp;lt; solver.error()      &amp;lt;&amp;lt; endl;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;sol: &amp;quot; &amp;lt;&amp;lt; x.head(6).transpose() &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
was compiled with &amp;lt;code&amp;gt;g++ -o parallel_solve -O3 -fopenmp solver_test_parallel.cpp&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;xr id=&amp;quot;fig:eigen_par&amp;quot;/&amp;gt; was produced when the program above was run as &amp;lt;code&amp;gt;./parallel_solve 10000000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==ILUT factorization==&lt;br /&gt;
This is a method to compute a general algebraic preconditioner which has the ability to control (to some degree) the memory and time complexity of the solution.&lt;br /&gt;
It is described in a paper by  &lt;br /&gt;
&lt;br /&gt;
  Saad, Yousef. &amp;quot;ILUT: A dual threshold incomplete LU factorization.&amp;quot; Numerical linear algebra with applications 1.4 (1994): 387-402.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It has two parameters, tolerance $\tau$ and fill factor $f$. Elements in $L$ and $U$ factors that would be below relative tolerance $\tau$ (say, to 2-norm of this row) are dropped. &lt;br /&gt;
Then, only $f$ elements per row in $L$ and $U$ are allowed and the maximum $f$ (if they exist) are taken. The diagonal elements are always kept. This means that the number of non-zero&lt;br /&gt;
elements in the rows of the preconditioner can not exceed $2f+1$. &lt;br /&gt;
&lt;br /&gt;
Greater parameter $f$ means slover but better $ILUT$ factorization. If $\tau$ is small, having a very large $f$ means getting a complete $LU$ factorization. Typical values are $5, 10, 20, 50$.&lt;br /&gt;
Lower $\tau$ values mean that move small elements are kept, resulting in a more precise, but longer computation. With a large $f$, the factorization approaches the direct $LU$ factorization as $\tau \to 0$. Typical values are from 1e-2 &lt;br /&gt;
to 1e-6.&lt;br /&gt;
&lt;br /&gt;
Whether the method converges or diverges for given parameters is very sudden and should be determined for each apllication separately. An example of &lt;br /&gt;
such a convergence graph for the diffusion equation is presented in figures below:&lt;br /&gt;
&lt;br /&gt;
[[File:bicgstab_err.png|400px]][[File:bicgstab_conv.png|400px]][[File:bicgstab_iter.png|400px]]&lt;br /&gt;
&lt;br /&gt;
We can see that low BiCGSTAB error estimate coincides with the range of actual small error compared to the analytical solution as well as with the range of lesser number of iterations.&lt;br /&gt;
&lt;br /&gt;
==Pardiso library==&lt;br /&gt;
[[Pardiso]]&lt;br /&gt;
&lt;br /&gt;
==Herzian contact ==&lt;br /&gt;
The matrix of the [[Hertzian contact]] problem is shown below:&lt;br /&gt;
 [[File:matrix_hertzian.png|500px]]&lt;br /&gt;
&lt;br /&gt;
The condition number iz arther large and grows superlinearly with size in the example below.&lt;br /&gt;
 [[File:cond.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Discussion based on practical observations =&lt;br /&gt;
&lt;br /&gt;
In this section we analyse different solvers, all available as part of&lt;br /&gt;
the [https://eigen.tuxfamily.org/dox/group__TopicSparseSystems.html Eigen library] supported by&lt;br /&gt;
the [https://e6.ijs.si/medusa/ Medusa]. Namely we analyse the performance&lt;br /&gt;
of two direct solvers&lt;br /&gt;
&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1SparseLU.html SparseLU]&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1SparseQR.html SparseQR]&lt;br /&gt;
&lt;br /&gt;
three combinations of general purpose iterative&lt;br /&gt;
solver [https://eigen.tuxfamily.org/dox/classEigen_1_1BiCGSTAB.html BiCGSTAB]&lt;br /&gt;
&lt;br /&gt;
* BiCGSTAB&lt;br /&gt;
* BiCGSTAB with ILUT preconditioner&lt;br /&gt;
* BiCGSTAB with ILUT preconditioner and exploited '''[https://eigen.tuxfamily.org/dox/classEigen_1_1SolveWithGuess.html solveWithGuess()]''' functionality&lt;br /&gt;
&lt;br /&gt;
and a wrapper to external direct solver&lt;br /&gt;
&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1PardisoLU.html PardisoLU].&lt;br /&gt;
&lt;br /&gt;
The performance tests are focused on the accuracy of the numerical solution, number of iterations and time required to solve the final sparse system. We also comment on the amount of RAM required by a specific solver. If required, the [https://gitlab.com/e62Lab/eigen_solvers_analysis gitlab repository] with the implementation is also provided.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
NOTE: Although the SparseQR has been included in our tests, significantly larger solve times compared to other solvers have been observed. For that reason, the SparseQR is discarded from further analyses even though it was able to obtain a solution of comparable accuracy.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The two-dimensional Poisson problem ==&lt;br /&gt;
&lt;br /&gt;
First, we solve the Poisson problem&lt;br /&gt;
$$\nabla ^2 u(\boldsymbol x) = f(\boldsymbol x),$$&lt;br /&gt;
&lt;br /&gt;
for $\boldsymbol x \in \Omega $ where the domain $\Omega$ is a unit $d=2$ dimensional circle with radius $R=1$.&lt;br /&gt;
We use mixed boundary conditions, i.e., Dirichlet boundary for all $x &amp;lt; 0$ and Neumann boundary for all $x \geq 0$. Additionally, ghost or fictitious nodes were added to the Neumann boundary.&lt;br /&gt;
&lt;br /&gt;
We perform analyses on two scenarios, i.e., two definitions of $f(\boldsymbol x)$:&lt;br /&gt;
&lt;br /&gt;
* $f(\boldsymbol x) = -d\pi ^2 \prod_{i = 1}^d \sin(\pi x_i)$ yielding&lt;br /&gt;
** $f_d(\boldsymbol x) = \prod_{i = 1}^d \sin(\pi x_i)$ on the Dirichlet boundary and&lt;br /&gt;
** $ \boldsymbol f_n(\boldsymbol x) = \pi \sum_{i = 1}^d \cos(\pi x_i) \prod_{j=1, j\neq i}^d \sin (\pi x_j)&lt;br /&gt;
      \boldsymbol e_i$ with unit vectors $\boldsymbol e_i$ on the Neumann boundary.&lt;br /&gt;
* $f(\boldsymbol x) = 2a e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}(2a\left \| \boldsymbol x -&lt;br /&gt;
  \boldsymbol x_s \right \| - d)$ yielding&lt;br /&gt;
** $f_d(\boldsymbol x) = e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$ yielding on Dirichlet boundary and&lt;br /&gt;
** $\boldsymbol f_n (\boldsymbol x) = -2a(\boldsymbol x - \boldsymbol x_s)e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$ on Neumann boundary.&lt;br /&gt;
&lt;br /&gt;
for width $a=10^2$ of the exponential source positioned at $\boldsymbol x_s=\boldsymbol 0$.&lt;br /&gt;
&lt;br /&gt;
Example solutions to both scenarios are shown in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:solution_poisson.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Solver performance ===&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a two-dimensional Poisson problem. The first column shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of iterations a given solver required (direct solvers were assigned a value 1) and the third column shows the total time required to solve the system and obtain the numerical solution $\widehat u$.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
Computational times: To obtain the computational times the code was run on a single CPU with assured CPU affinity using the ''taskset'' command.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_poisson_sin.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_poisson_exp.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
In terms of accuracy, all solvers under consideration perform equally good, with an exception of BiCGSTAB with ILUT preconditioner, who failed to obtain a solution of sufficient accuracy at the finest domain discretization with approximately $2\cdot 10^6$ nodes. The reason is most likely in the ILUT preconditioner, set to limit solver iterations to 200 with fill factor 40, drop tolerance $10^{-5}$ and global tolerance $10^{-15}$. A different ILUT setup would most probably yield a more desirable behaviour, but it nevertheless shows that when using a ILUT preconditioner one must be careful before making conclusions. It is also important to note that the SparseLU ran out of the available 11.5 Gb RAM and, therefore, failed to obtain a numerical solution. Other solvers had no issues with the available RAM space.&lt;br /&gt;
&lt;br /&gt;
It is perhaps more interesting to study the number of iterations required by the solvers. Obviously, direct solvers require a &amp;quot;single iteration&amp;quot;. Iterative solvers, on the other hand, require multiple iterations. Generally speaking, we observe that the number of solver iterations increases with the number of discretization points. However, it is interesting to see that the pure BiCGSTAB shows the most stable and predictable behaviour. Despite the fact that the guess provided to the BiCGSTAB is in fact the analytical solution to the problem, we do not observe significantly lower number of solver iterations.&lt;br /&gt;
&lt;br /&gt;
Nevertheless, from a practical point of view, solve time is more important than the number of iterations required to obtain a numerical solution. The last column of the above figures clearly shows that the two direct solvers significantly outperform the iterative BiCGSTAB solver. On the other hand, employing BiCGSTAB with a ILUT preconditioner or providing guess to it, seems to have marginal effect on the required time.&lt;br /&gt;
&lt;br /&gt;
== The three-dimensional Poisson problem ==&lt;br /&gt;
&lt;br /&gt;
Next, we test the solvers on a three-dimensional Poisson problem. The governing problem is exactly the same as in the previous case, except that the domain is a $d=3$ dimensional unit sphere.&lt;br /&gt;
&lt;br /&gt;
=== Solver performance ===&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a two-dimensional Poisson problem. The first column shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of iterations a given solver required (direct solvers were assigned a value 1) and the third column shows the total time required to solve the system and obtain the numerical solution $\widehat u$.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_3d_poisson_sin.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_3d_poisson_exp.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
In terms of accuracy, we again observe some unexpected behaviour when ILUT preconditioner is used. This time, the ILUT preconditioner was used to limit the solver iterations to 300 with fill factor 40, drop tolerance $10^{-5}$ and global tolerance $10^{-15}$. Although 100 more iterations were allowed than in the previous two-dimensional case, this clearly was not enough for the finest domain discretizations. Additionally, providing BiCGSTAB with the analytical guess yields even more confusing results as it yielded a sudden improve of the solution accuracy. This is, of course, wrong. It is important to note that we provide '''analytical solution''' as the guess. Therefore, as soon as the solver hits the maximum allowed iterations threshold it returns the best solution currently available - largely consisting out of the analytical guess provided.&lt;br /&gt;
&lt;br /&gt;
In fact, the most reliable results are again yielded by the pure BiCGSTAB and the two direct solvers. However, the two direct solvers both ran out of the available 11.5 Gb RAM space available. The SparseLU was still able to obtain a solution with $10^5$ discretization nodes, while PardisoLU seems to be more efficient since it was still able to obtain a solution with $4\cdot 10^5$ discretization points.&lt;br /&gt;
&lt;br /&gt;
From the time perspective, it is clear that the two direct solvers were again significantly faster than the iterative solver - that is, of course, until they ran out of RAM. We did not come across any RAM related&lt;br /&gt;
issues with the BiCGSTAB, even when the domain was discretized with more than a million nodes.&lt;br /&gt;
&lt;br /&gt;
== The linear elasticity: Boussinesq's problem ==&lt;br /&gt;
&lt;br /&gt;
As a final problem we solve the three-dimensional Boussinesq's problem, where a concentrated normal traction acts on an isotropic half-space &amp;lt;ref name=&amp;quot;slaughter&amp;quot;&amp;gt;Slaughter, William S. The linearized theory of elasticity. Springer Science &amp;amp; Business Media, 2012.&amp;lt;/ref&amp;gt;. The same problem has also just recently been solved by employing $h$-adaptive solution procedure &amp;lt;ref name=&amp;quot;slak&amp;quot;&amp;gt;J. Slak and G. Kosec, Adaptive radial basis function-generated finite differences method for contact problems, International Journal for Numerical Methods in Engineering, 2019. DOI: 10.1002/nme.6067.&amp;lt;/ref&amp;gt;, to demonstrate the performance of a hybrid mesh-free approximation method&amp;lt;ref name=&amp;quot;hybrid&amp;quot;&amp;gt;M. Jančič and G. Kosec, &amp;quot;A hybrid RBF-FD and WLS mesh-free strong-form approximation method,&amp;quot; 2022 7th International Conference on Smart and Sustainable Technologies (SpliTech), 2022, pp. 1-6, doi: 10.23919/SpliTech55088.2022.9854278.&amp;lt;/ref&amp;gt; also to test the performance of $hp$-adaptive solution procedures &amp;lt;ref name=&amp;quot;hp&amp;quot;&amp;gt;Jančič, Mitja, and Gregor Kosec. &amp;quot;Strong form mesh-free $ hp $-adaptive solution of linear elasticity problem.&amp;quot; arXiv preprint arXiv:2210.07073 (2022).&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The problem has a closed form solution given in cylindrical coordinates $r$, $\theta$ and $z$ as&lt;br /&gt;
&lt;br /&gt;
$$u_r = \frac{Pr}{4\pi \mu} \left(\frac{z}{R^3} - \frac{1-2\nu}{R(z+R)} \right), \qquad u_\theta = 0, \qquad u_z =&lt;br /&gt;
\frac{P}{4\pi \mu} \left(\frac{2(1-\nu)}{R} + \frac{z^2}{R^3} \right)$$&lt;br /&gt;
&lt;br /&gt;
with stress tensor components&lt;br /&gt;
&lt;br /&gt;
$$ \sigma_{rr} = \frac{P}{2\pi} \left( \frac{1-2\nu}{R(z+R)} - \frac{3r^2z}{R^5} \right), \qquad \sigma_{\theta\theta} =&lt;br /&gt;
\frac{P(1-2\nu)}{2\pi} \left( \frac{z}{R^3} - \frac{1}{R(z+R)} \right), \qquad \sigma_{zz} = -\frac{3Pz^3}{2 \pi R^5},$$&lt;br /&gt;
&lt;br /&gt;
$$ \sigma_{rz} = -\frac{3Prz^2}{2 \pi R^5} , \quad \sigma_{r\theta} = 0 , \qquad\sigma_{\theta z} = 0$$&lt;br /&gt;
&lt;br /&gt;
where $P$ is the magnitude of the concentrated force, $\nu$ is the Poisson's ratio, $\mu$ is the Lame parameter&lt;br /&gt;
and $R$ is the Eucledian distance to the origin. The solution has a singularity at the origin, which makes the problem ideal for treatment with adaptive procedures. Furthermore, the closed form solution also allows us to evaluate the accuracy of the numerical solution.&lt;br /&gt;
&lt;br /&gt;
In our setup, we consider only a small part of the problem, i.e., $\varepsilon = 0.1$ away from the singularity, as schematically shown in figure below. From a numerical point of view, we solve the Navier-Cauchy Equation with Dirichlet boundary conditions described in the sketch, where the domain $\Omega$ is defined as a box, i.e., $\Omega = [-1, -\varepsilon] \times [-1, -\varepsilon] \times [-1, -\varepsilon]$.&lt;br /&gt;
&lt;br /&gt;
[[File:boussinesq_sketch.png|400px]]&lt;br /&gt;
&lt;br /&gt;
Example solution with approximately $2\cdot 10^5$ nodes is shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:solution_boussinesq.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Solver performance ===&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a three-dimensional Boussinesq's problem. The first column shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of iterations a given solver required (direct solvers were assigned a value 1) and the third column shows the total time required to solve the system and obtain the numerical solution $\widehat u$.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_3d_boussinesq.png|1200px]]&lt;br /&gt;
&lt;br /&gt;
Similarly to previous studies on Poisson problems, we observe that in terms of accuracy of the numerical solution, all chosen solvers are in good agreement. However, this time we observe some desirable effects of the ILUT and guess on the performance of BiCGSTAB. Using ILUT preconditioner (and) guess reduces the number of iterations required - however, this does not notably improve the times required to obtain a numerical solution. Therefore, considering the fact that a badly-thought-out preconditioner orguess definition can notably affect the solver's performance, one is probably safer using the general purpose BiCGSTAB without the guess and without the preconditioner.&lt;br /&gt;
&lt;br /&gt;
The two direct solvers were again able to solve the linear sparse system notably faster than the iterative BiCGSTAB. Unfortunately, using direct solvers we again ran into RAM space related issues.&lt;br /&gt;
&lt;br /&gt;
= Further literature =&lt;br /&gt;
&lt;br /&gt;
To read more about the solvers, we propose:&lt;br /&gt;
* [https://users.fmf.uni-lj.si/plestenjak/Vaje/INMLA/Predavanja/Skripta.pdf Slovenian script by Bor Plestenjak]&lt;br /&gt;
* Matrix Algorithms: Volume II: Eigensystems&amp;lt;ref name=&amp;quot;gilbert1&amp;quot;&amp;gt;Stewart, Gilbert W. Matrix Algorithms: Volume II: Eigensystems. Society for Industrial and Applied Mathematics, 2001.&amp;lt;/ref&amp;gt;&lt;br /&gt;
* Matrix algorithms: volume 1: basic decompositions&amp;lt;ref name=&amp;quot;gilbert2&amp;quot;&amp;gt;Stewart, Gilbert W. Matrix algorithms: volume 1: basic decompositions. Society for Industrial and Applied Mathematics, 1998.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_3d_boussinesq.png&amp;diff=3545</id>
		<title>File:Convergence 3d boussinesq.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_3d_boussinesq.png&amp;diff=3545"/>
				<updated>2023-02-14T12:36:47Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Solution_boussinesq.png&amp;diff=3543</id>
		<title>File:Solution boussinesq.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Solution_boussinesq.png&amp;diff=3543"/>
				<updated>2023-02-14T12:35:53Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Boussinesq_sketch.png&amp;diff=3544</id>
		<title>File:Boussinesq sketch.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Boussinesq_sketch.png&amp;diff=3544"/>
				<updated>2023-02-14T12:35:53Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_3d_poisson_sin.png&amp;diff=3541</id>
		<title>File:Convergence 3d poisson sin.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_3d_poisson_sin.png&amp;diff=3541"/>
				<updated>2023-02-14T12:32:30Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_3d_poisson_exp.png&amp;diff=3542</id>
		<title>File:Convergence 3d poisson exp.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_3d_poisson_exp.png&amp;diff=3542"/>
				<updated>2023-02-14T12:32:30Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_poisson_exp.png&amp;diff=3539</id>
		<title>File:Convergence poisson exp.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_poisson_exp.png&amp;diff=3539"/>
				<updated>2023-02-14T12:30:17Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_poisson_sin.png&amp;diff=3540</id>
		<title>File:Convergence poisson sin.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_poisson_sin.png&amp;diff=3540"/>
				<updated>2023-02-14T12:30:17Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Solution_poisson.png&amp;diff=3538</id>
		<title>File:Solution poisson.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Solution_poisson.png&amp;diff=3538"/>
				<updated>2023-02-14T12:28:19Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic uploaded a new version of File:Solution poisson.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Solution_poisson.png&amp;diff=3537</id>
		<title>File:Solution poisson.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Solution_poisson.png&amp;diff=3537"/>
				<updated>2023-02-14T12:27:47Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Solving_sparse_systems&amp;diff=3536</id>
		<title>Solving sparse systems</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Solving_sparse_systems&amp;diff=3536"/>
				<updated>2023-02-14T12:27:34Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are many methods available for solving sparse systems. We compare some of them here.&lt;br /&gt;
&amp;lt;figure id=&amp;quot;fig:matrix1&amp;quot;&amp;gt;&lt;br /&gt;
[[File:matrix.png|300px|thumb|upright=2|alt=Matrix of the discretized PDE.|&amp;lt;caption&amp;gt;Matrix of the discretized PDE. &amp;lt;/caption&amp;gt;]]&lt;br /&gt;
&amp;lt;/figure&amp;gt;&lt;br /&gt;
Mathematica has the following methods available (https://reference.wolfram.com/language/ref/LinearSolve.html#DetailsAndOptions)&lt;br /&gt;
* direct: banded, cholesky, multifrontal (direct sparse LU)&lt;br /&gt;
* iterative: Krylov&lt;br /&gt;
&lt;br /&gt;
Matlab has the following methods:&lt;br /&gt;
* direct: https://www.mathworks.com/help/matlab/ref/mldivide.html#bt42omx_head&lt;br /&gt;
* iterative: https://www.mathworks.com/help/matlab/math/systems-of-linear-equations.html#brzoiix, including bicgstab, gmres &lt;br /&gt;
&lt;br /&gt;
Eigen has the following methods: (https://eigen.tuxfamily.org/dox-devel/group__TopicSparseSystems.html)&lt;br /&gt;
* direct: sparse LU&lt;br /&gt;
* iterative: bicgstab, cg&lt;br /&gt;
&lt;br /&gt;
Solving a simple sparse system $A x = b$ for steady space of heat equation in 1d with $n$ nodes, results in a matrix shown in &amp;lt;xr id=&amp;quot;fig:matrix1&amp;quot;/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The following timings of solvers are given in seconds:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! $n = 10^6$&lt;br /&gt;
! Matlab&lt;br /&gt;
! Mathematica&lt;br /&gt;
! Eigen&lt;br /&gt;
|-&lt;br /&gt;
! Banded&lt;br /&gt;
| 0.16&lt;br /&gt;
| 0.28&lt;br /&gt;
| 0.04&lt;br /&gt;
|-&lt;br /&gt;
! SparseLU&lt;br /&gt;
| /&lt;br /&gt;
| 1.73&lt;br /&gt;
| 0.82&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Incomplete LU preconditioner was used for BICGStab.&lt;br /&gt;
Without the preconditioner BICGStab does not converge.&lt;br /&gt;
&lt;br /&gt;
==Parallel execution ==&lt;br /&gt;
BICGStab can be run in parallel, as explain in the general parallelism: https://eigen.tuxfamily.org/dox/TopicMultiThreading.html, and specifically&lt;br /&gt;
&lt;br /&gt;
'''&amp;quot;When using sparse matrices, best performance is achied for a row-major sparse matrix format.&amp;lt;br&amp;gt;Moreover, in this case multi-threading can be exploited if the user code is compiled with OpenMP enabled&amp;quot;.'''&lt;br /&gt;
&lt;br /&gt;
Eigen uses number of threads specified my OopenMP, unless &amp;lt;code&amp;gt;Eigen::setNbThreads(n);&amp;lt;/code&amp;gt; was called.&lt;br /&gt;
Minimal working example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;figure id=&amp;quot;fig:eigen_par&amp;quot;&amp;gt;&lt;br /&gt;
[[File:eigen_parallel_2.png|1200px|thumb|upright=2|alt=Matrix of the discretized PDE.|&amp;lt;caption&amp;gt;Memory and CPU usage. C stands for construction of the system, L stands for the calculation of ILUT preconditioner and S for BICGStab iteration.&amp;lt;/caption&amp;gt;]]&lt;br /&gt;
&amp;lt;/figure&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; line&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;quot;Eigen/Sparse&amp;quot;&lt;br /&gt;
#include &amp;quot;Eigen/IterativeLinearSolvers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
using namespace std;&lt;br /&gt;
using namespace Eigen;&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char* argv[]) {&lt;br /&gt;
&lt;br /&gt;
    assert(argc == 2 &amp;amp;&amp;amp; &amp;quot;Second argument is size of the system.&amp;quot;);&lt;br /&gt;
    stringstream ss(argv[1]);&lt;br /&gt;
    int n;&lt;br /&gt;
    ss &amp;gt;&amp;gt; n;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;n = &amp;quot; &amp;lt;&amp;lt; n &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    // Fill the matrix&lt;br /&gt;
    VectorXd b = VectorXd::Ones(n) / n / n;&lt;br /&gt;
    b(0) = b(n-1) = 1;&lt;br /&gt;
    SparseMatrix&amp;lt;double, RowMajor&amp;gt; A(n, n);&lt;br /&gt;
    A.reserve(vector&amp;lt;int&amp;gt;(n, 3));  // 3 per row&lt;br /&gt;
    for (int i = 0; i &amp;lt; n-1; ++i) {&lt;br /&gt;
        A.insert(i, i) = -2;&lt;br /&gt;
        A.insert(i, i+1) = 1;&lt;br /&gt;
        A.insert(i+1, i) = 1;&lt;br /&gt;
    }&lt;br /&gt;
    A.coeffRef(0, 0) = 1;&lt;br /&gt;
    A.coeffRef(0, 1) = 0;&lt;br /&gt;
    A.coeffRef(n-1, n-2) = 0;&lt;br /&gt;
    A.coeffRef(n-1, n-1) = 1;&lt;br /&gt;
&lt;br /&gt;
    // Solve the system&lt;br /&gt;
    BiCGSTAB&amp;lt;SparseMatrix&amp;lt;double, RowMajor&amp;gt;, IncompleteLUT&amp;lt;double&amp;gt;&amp;gt; solver;&lt;br /&gt;
    solver.setTolerance(1e-10);&lt;br /&gt;
    solver.setMaxIterations(1000);&lt;br /&gt;
    solver.compute(A);&lt;br /&gt;
    VectorXd x = solver.solve(b);&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;#iterations:     &amp;quot; &amp;lt;&amp;lt; solver.iterations() &amp;lt;&amp;lt; endl;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;estimated error: &amp;quot; &amp;lt;&amp;lt; solver.error()      &amp;lt;&amp;lt; endl;&lt;br /&gt;
    cout &amp;lt;&amp;lt; &amp;quot;sol: &amp;quot; &amp;lt;&amp;lt; x.head(6).transpose() &amp;lt;&amp;lt; endl;&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
was compiled with &amp;lt;code&amp;gt;g++ -o parallel_solve -O3 -fopenmp solver_test_parallel.cpp&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;xr id=&amp;quot;fig:eigen_par&amp;quot;/&amp;gt; was produced when the program above was run as &amp;lt;code&amp;gt;./parallel_solve 10000000&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==ILUT factorization==&lt;br /&gt;
This is a method to compute a general algebraic preconditioner which has the ability to control (to some degree) the memory and time complexity of the solution.&lt;br /&gt;
It is described in a paper by  &lt;br /&gt;
&lt;br /&gt;
  Saad, Yousef. &amp;quot;ILUT: A dual threshold incomplete LU factorization.&amp;quot; Numerical linear algebra with applications 1.4 (1994): 387-402.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It has two parameters, tolerance $\tau$ and fill factor $f$. Elements in $L$ and $U$ factors that would be below relative tolerance $\tau$ (say, to 2-norm of this row) are dropped. &lt;br /&gt;
Then, only $f$ elements per row in $L$ and $U$ are allowed and the maximum $f$ (if they exist) are taken. The diagonal elements are always kept. This means that the number of non-zero&lt;br /&gt;
elements in the rows of the preconditioner can not exceed $2f+1$. &lt;br /&gt;
&lt;br /&gt;
Greater parameter $f$ means slover but better $ILUT$ factorization. If $\tau$ is small, having a very large $f$ means getting a complete $LU$ factorization. Typical values are $5, 10, 20, 50$.&lt;br /&gt;
Lower $\tau$ values mean that move small elements are kept, resulting in a more precise, but longer computation. With a large $f$, the factorization approaches the direct $LU$ factorization as $\tau \to 0$. Typical values are from 1e-2 &lt;br /&gt;
to 1e-6.&lt;br /&gt;
&lt;br /&gt;
Whether the method converges or diverges for given parameters is very sudden and should be determined for each apllication separately. An example of &lt;br /&gt;
such a convergence graph for the diffusion equation is presented in figures below:&lt;br /&gt;
&lt;br /&gt;
[[File:bicgstab_err.png|400px]][[File:bicgstab_conv.png|400px]][[File:bicgstab_iter.png|400px]]&lt;br /&gt;
&lt;br /&gt;
We can see that low BiCGSTAB error estimate coincides with the range of actual small error compared to the analytical solution as well as with the range of lesser number of iterations.&lt;br /&gt;
&lt;br /&gt;
==Pardiso library==&lt;br /&gt;
[[Pardiso]]&lt;br /&gt;
&lt;br /&gt;
==Herzian contact ==&lt;br /&gt;
The matrix of the [[Hertzian contact]] problem is shown below:&lt;br /&gt;
 [[File:matrix_hertzian.png|500px]]&lt;br /&gt;
&lt;br /&gt;
The condition number iz arther large and grows superlinearly with size in the example below.&lt;br /&gt;
 [[File:cond.png|600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Discussion based on practical observations =&lt;br /&gt;
&lt;br /&gt;
In this section we analyse different solvers, all available as part of&lt;br /&gt;
the [https://eigen.tuxfamily.org/dox/group__TopicSparseSystems.html Eigen library] supported by&lt;br /&gt;
the [https://e6.ijs.si/medusa/ Medusa]. Namely we analyse the performance&lt;br /&gt;
of two direct solvers&lt;br /&gt;
&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1SparseLU.html SparseLU]&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1SparseQR.html SparseQR]&lt;br /&gt;
&lt;br /&gt;
three combinations of general purpose iterative&lt;br /&gt;
solver [https://eigen.tuxfamily.org/dox/classEigen_1_1BiCGSTAB.html BiCGSTAB]&lt;br /&gt;
&lt;br /&gt;
* BiCGSTAB&lt;br /&gt;
* BiCGSTAB with ILUT preconditioner&lt;br /&gt;
* BiCGSTAB with ILUT preconditioner and exploited '''[https://eigen.tuxfamily.org/dox/classEigen_1_1SolveWithGuess.html solveWithGuess()]''' functionality&lt;br /&gt;
&lt;br /&gt;
and a wrapper to external direct solver&lt;br /&gt;
&lt;br /&gt;
* [https://eigen.tuxfamily.org/dox/classEigen_1_1PardisoLU.html PardisoLU].&lt;br /&gt;
&lt;br /&gt;
The performance tests are focused on the accuracy of the numerical solution, number of iterations and time required to solve the final sparse system. We also comment on the amount of RAM required by a specific solver.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
NOTE: Although the SparseQR has been included in our tests, significantly larger solve times compared to other solvers have been observed. For that reason, the SparseQR is discarded from further analyses even though it was able to obtain a solution of comparable accuracy.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The two-dimensional Poisson problem ==&lt;br /&gt;
&lt;br /&gt;
First, we solve the Poisson problem&lt;br /&gt;
$$\nabla ^2 u(\boldsymbol x) = f(\boldsymbol x),$$&lt;br /&gt;
&lt;br /&gt;
for $\boldsymbol x \in \Omega $ where the domain $\Omega$ is a unit $d=2$ dimensional circle with radius $R=1$.&lt;br /&gt;
We use mixed boundary conditions, i.e., Dirichlet boundary for all $x &amp;lt; 0$ and Neumann boundary for all $x \geq 0$. Additionally, ghost or fictitious nodes were added to the Neumann boundary.&lt;br /&gt;
&lt;br /&gt;
We perform analyses on two scenarios, i.e., two definitions of $f(\boldsymbol x)$:&lt;br /&gt;
&lt;br /&gt;
* $f(\boldsymbol x) = -d\pi ^2 \prod_{i = 1}^d \sin(\pi x_i)$ yielding&lt;br /&gt;
** $f_d(\boldsymbol x) = \prod_{i = 1}^d \sin(\pi x_i)$ on the Dirichlet boundary and&lt;br /&gt;
** $ \boldsymbol f_n(\boldsymbol x) = \pi \sum_{i = 1}^d \cos(\pi x_i) \prod_{j=1, j\neq i}^d \sin (\pi x_j)&lt;br /&gt;
      \boldsymbol e_i$ with unit vectors $\boldsymbol e_i$ on the Neumann boundary.&lt;br /&gt;
* $f(\boldsymbol x) = 2a e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}(2a\left \| \boldsymbol x -&lt;br /&gt;
  \boldsymbol x_s \right \| - d)$ yielding&lt;br /&gt;
** $f_d(\boldsymbol x) = e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$ yielding on Dirichlet boundary and&lt;br /&gt;
** $\boldsymbol f_n (\boldsymbol x) = -2a(\boldsymbol x - \boldsymbol x_s)e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$ on Neumann boundary.&lt;br /&gt;
&lt;br /&gt;
for width $a=10^2$ of the exponential source positioned at $\boldsymbol x_s=\boldsymbol 0$.&lt;br /&gt;
&lt;br /&gt;
Example solutions to both scenarios are shown in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:solution_poisson.jpg]]&lt;br /&gt;
&lt;br /&gt;
### Solver performance&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a two-dimensional Poisson problem. The first column&lt;br /&gt;
shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of&lt;br /&gt;
iterations a given solver required (direct solvers were assigned a value 1) and the third column shows&lt;br /&gt;
the total time required to solve the system and obtain the numerical solution $'\widehat u'$.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; **Computational times:**&lt;br /&gt;
&amp;gt;&lt;br /&gt;
&amp;gt;To obtain the computational times the code was run on a single CPU with assured CPU affinity using the *taskset*&lt;br /&gt;
&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
![](../results/convergence_poisson_sin.png)&lt;br /&gt;
![](../results/convergence_poisson_exp.png)&lt;br /&gt;
&lt;br /&gt;
In terms of accuracy, all solvers under consideration perform equally good, with an exception of BiCGSTAB with ILUT&lt;br /&gt;
preconditioner,&lt;br /&gt;
who failed to obtain a solution of sufficient accuracy at the finest domain discretization with approximately $'2\cdot&lt;br /&gt;
10^6'$ nodes. The reason is most likely&lt;br /&gt;
in the ILUT preconditioner, set to limit solver iterations to 200 with fill factor 40, drop tolerance $'10^{-5}'$ and&lt;br /&gt;
global tolerance $'10^{-15}'$. A different ILUT setup would most probably yield a more desirable behaviour, but it&lt;br /&gt;
nevertheless shows that when using a ILUT preconditioner one must be careful before making conclusions. It is also&lt;br /&gt;
important to note that the SparseLU ran out of the available 11.5 Gb RAM and, therefore, failed to obtain a numerical&lt;br /&gt;
solution. Other solvers had no issues with the available RAM space.&lt;br /&gt;
&lt;br /&gt;
It is perhaps more interesting to study the number of iterations required by the solvers. Obviously, direct solvers&lt;br /&gt;
require a &amp;quot;single iteration&amp;quot;. Iterative solvers, on the other hand, require multiple iterations. Generally speaking, we&lt;br /&gt;
observe that the number of solver iterations increases with the number of discretization points. However, it is&lt;br /&gt;
interesting to see that the pure BiCGSTAB shows the most stable and predictable behaviour. Despite the fact that the&lt;br /&gt;
guess provided to the BiCGSTAB is in fact the analytical solution to the problem, we do not observe significantly lower&lt;br /&gt;
number of solver iterations.&lt;br /&gt;
&lt;br /&gt;
Nevertheless, from a practical point of view, solve time is more important than the number of iterations required to&lt;br /&gt;
obtain a numerical solution. The last column of the above figures clearly shows that the two direct solvers&lt;br /&gt;
significantly outperform the iterative BiCGSTAB solver. On the other hand, employing BiCGSTAB with a ILUT preconditioner&lt;br /&gt;
or providing guess to it, seems to have marginal effect on the required time.&lt;br /&gt;
&lt;br /&gt;
## The three-dimensional Poisson problem&lt;br /&gt;
&lt;br /&gt;
Next, we test the solvers on a three-dimensional Poisson problem. The governing problem is exactly the same as in the&lt;br /&gt;
previous case, except that the domain is a $'d=3'$ dimensional unit sphere.&lt;br /&gt;
&lt;br /&gt;
### Solver performance&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a two-dimensional Poisson problem. The first column&lt;br /&gt;
shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of&lt;br /&gt;
iterations a given solver required (direct solvers were assigned a value 1) and the third column shows&lt;br /&gt;
the total time required to solve the system and obtain the numerical solution $'\widehat u'$.&lt;br /&gt;
&lt;br /&gt;
![](../results/convergence_3d_poisson_sin.png)&lt;br /&gt;
![](../results/convergence_3d_poisson_exp.png)&lt;br /&gt;
&lt;br /&gt;
In terms of accuracy, we again observe some unexpected behaviour when ILUT preconditioner is used. This time, the ILUT&lt;br /&gt;
preconditioner was used to limit the solver iterations to 300 with fill factor 40, drop tolerance $'10^{-5}'$ and global&lt;br /&gt;
tolerance $'10^{-15}'$. Although 100 more iterations were allowed than in the previous two-dimensional case, this&lt;br /&gt;
clearly was not enough for the finest domain discretizations. Additionally, providing BiCGSTAB with the analytical guess&lt;br /&gt;
yields even more confusing results as it yielded a sudden improve of the solution accuracy. This is, of&lt;br /&gt;
course, wrong. It is important to note that we provide **analytical solution** as the guess. Therefore, as soon as the&lt;br /&gt;
solver hits the&lt;br /&gt;
maximum allowed iterations threshold it returns the best solution currently available - largely consisting out of the&lt;br /&gt;
analytical guess provided.&lt;br /&gt;
&lt;br /&gt;
In fact, the most reliable results are again yielded by the pure BiCGSTAB and the two direct solvers. However, the two&lt;br /&gt;
direct solvers both ran out of the available 11.5&lt;br /&gt;
Gb RAM space available. The SparseLU was still able to obtain a solution with $'10^5'$ discretization nodes, while&lt;br /&gt;
PardisoLU seems to be more efficient since it was still able to obtain a solution with $'4\cdot 10^5'$ discretization&lt;br /&gt;
points.&lt;br /&gt;
&lt;br /&gt;
From the time perspective, it is clear that the two direct solvers were again significantly&lt;br /&gt;
faster than the iterative solver - that is, of course, until they ran out of RAM. We did not come across any RAM related&lt;br /&gt;
issues with the BiCGSTAB, even when the domain was discretized with more than a million nodes.&lt;br /&gt;
&lt;br /&gt;
## The linear elasticity: Boussinesq's problem&lt;br /&gt;
&lt;br /&gt;
As a final problem we solve the three-dimensional Boussinesq's problem, where a concentrated normal traction acts on an&lt;br /&gt;
isotropic half-space~\cite{Slaughter_2002}. The same problem has also just recently been solved by employing $'h'&lt;br /&gt;
$-adaptive&lt;br /&gt;
solution procedure~\cite{slak2019adaptive}, to demonstrate the performance of a hybrid mesh-free approximation&lt;br /&gt;
method~\cite{jancichybrid} also to test the performance of $'hp'$-adaptive solution procedures~\cite{hp}.&lt;br /&gt;
&lt;br /&gt;
The problem has a closed form solution given in cylindrical coordinates $'r'$, $'\theta'$ and $'z'$ as&lt;br /&gt;
&lt;br /&gt;
$'u_r = \frac{Pr}{4\pi \mu} \left(\frac{z}{R^3} - \frac{1-2\nu}{R(z+R)} \right), \qquad u_\theta = 0, \qquad u_z =&lt;br /&gt;
\frac{P}{4\pi \mu} \left(\frac{2(1-\nu)}{R} + \frac{z^2}{R^3} \right)'$&lt;br /&gt;
&lt;br /&gt;
with stress tensor components&lt;br /&gt;
&lt;br /&gt;
$' \sigma_{rr} = \frac{P}{2\pi} \left( \frac{1-2\nu}{R(z+R)} - \frac{3r^2z}{R^5} \right), \qquad \sigma_{\theta\theta} =&lt;br /&gt;
\frac{P(1-2\nu)}{2\pi} \left( \frac{z}{R^3} - \frac{1}{R(z+R)} \right), \qquad \sigma_{zz} = -\frac{3Pz^3}{2 \pi R^5}'$&lt;br /&gt;
&lt;br /&gt;
$' \sigma_{rz} = -\frac{3Prz^2}{2 \pi R^5} , \quad \sigma_{r\theta} = 0 , \qquad\sigma_{\theta z} = 0'$&lt;br /&gt;
&lt;br /&gt;
where $'P'$ is the magnitude of the concentrated force, $'\nu'$ is the Poisson's ratio, $'\mu'$ is the Lame parameter&lt;br /&gt;
and $R$ is the Eucledian distance to the origin. The solution has a singularity at the origin, which makes the problem&lt;br /&gt;
ideal for treatment with adaptive procedures. Furthermore, the closed form solution also allows us to evaluate the&lt;br /&gt;
accuracy of the numerical solution.&lt;br /&gt;
&lt;br /&gt;
In our setup, we consider only a small part of the problem, i.e., $'\varepsilon = 0.1'$ away from the singularity, as&lt;br /&gt;
schematically shown in figure below. From a numerical point of view, we solve the Navier-Cauchy Equation with Dirichlet&lt;br /&gt;
boundary conditions described in the sketch, where the domain $'\Omega'$ is defined as a box, i.e., $'\Omega&lt;br /&gt;
= [-1, -\varepsilon] \times [-1, -\varepsilon] \times [-1, -\varepsilon]'$.&lt;br /&gt;
&lt;br /&gt;
![](../results/boussinesq_sketch.png)&lt;br /&gt;
&lt;br /&gt;
Example solution with approximately $'2\cdot 10^5'$ nodes is shown below.&lt;br /&gt;
&lt;br /&gt;
![](../results/solution_boussinesq.png)&lt;br /&gt;
&lt;br /&gt;
### Solver performance&lt;br /&gt;
&lt;br /&gt;
Below, we show the performance of the selected solvers in case of a three-dimensional Boussinesq's problem. The first&lt;br /&gt;
column&lt;br /&gt;
shows the accuracy of the numerical solution in terms of the infinity norm, the second column shows the number of&lt;br /&gt;
iterations a given solver required (direct solvers were assigned a value 1) and the third column shows&lt;br /&gt;
the total time required to solve the system and obtain the numerical solution $'\widehat u'$.&lt;br /&gt;
&lt;br /&gt;
![](../results/convergence_3d_boussinesq.png)&lt;br /&gt;
&lt;br /&gt;
Similarly to previous studies on Poisson problems, we observe that in terms of accuracy of the numerical solution, all&lt;br /&gt;
chosen solvers are in good agreement.&lt;br /&gt;
However, this time we observe some desirable effects of the ILUT and guess on the performance of BiCGSTAB. Using ILUT&lt;br /&gt;
preconditioner (and) guess reduces the number of iterations required - however, this does not notably improve the times&lt;br /&gt;
required to obtain a numerical solution. Therefore, considering the fact that a badly-thought-out preconditioner or&lt;br /&gt;
guess definition can notably affect the solver's performance, one is probably safer using the general purpose&lt;br /&gt;
BiCGSTAB without the guess and without the preconditioner.&lt;br /&gt;
&lt;br /&gt;
The two direct solvers were again able to solve the linear sparse system notably faster than the iterative BiCGSTAB.&lt;br /&gt;
Unfortunately, using direct solvers we again ran into RAM space related issues.&lt;br /&gt;
&lt;br /&gt;
# More on solvers&lt;br /&gt;
&lt;br /&gt;
- According to our observations, Pardiso is the fastest and most reliable, given the available RAM is large enough.&lt;br /&gt;
- https://eigen.tuxfamily.org/dox/classEigen_1_1ConjugateGradient.html&lt;br /&gt;
&lt;br /&gt;
# Further literature:&lt;br /&gt;
&lt;br /&gt;
Script: https://users.fmf.uni-lj.si/plestenjak/Vaje/INMLA/Predavanja/Skripta.pdf&lt;br /&gt;
&lt;br /&gt;
Stewart, Gilbert W. Matrix Algorithms: Volume II: Eigensystems. Society for Industrial and Applied Mathematics, 2001.&lt;br /&gt;
&lt;br /&gt;
Stewart, Gilbert W. Matrix algorithms: volume 1: basic decompositions. Society for Industrial and Applied Mathematics,&lt;br /&gt;
1998.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Fwo_abaqus.png&amp;diff=3246</id>
		<title>File:Fwo abaqus.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Fwo_abaqus.png&amp;diff=3246"/>
				<updated>2022-10-13T13:30:41Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic uploaded a new version of File:Fwo abaqus.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Error_indicator_convergence.png&amp;diff=3245</id>
		<title>File:Error indicator convergence.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Error_indicator_convergence.png&amp;diff=3245"/>
				<updated>2022-10-13T13:30:07Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic uploaded a new version of File:Error indicator convergence.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_demonstration_2d.png&amp;diff=3244</id>
		<title>File:Refinement demonstration 2d.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_demonstration_2d.png&amp;diff=3244"/>
				<updated>2022-10-13T13:28:48Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic uploaded a new version of File:Refinement demonstration 2d.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_workflow.png&amp;diff=3243</id>
		<title>File:Refinement workflow.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_workflow.png&amp;diff=3243"/>
				<updated>2022-10-13T13:26:41Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic uploaded a new version of File:Refinement workflow.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3235</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3235"/>
				<updated>2022-09-25T07:51:08Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Adaptive solution procedures are essential in problems where the accuracy of the numerical solution varies spatially and are currently subject of intensive studies. Two conceptually different adaptive approaches have been proposed, namely $p$-adaptivity or $h$-, $r$-adaptivity. In $p$-adaptivity, the accuracy of the numerical solution is varied by changing the order of approximation, while in $h$- and $r$-adaptivity the resolution of the spatial discretization is adjusted for the same purpose. In the $h$-adaptive approach, nodes are added or removed from the domain as needed, while in the $r$-adaptive approach, the total number of nodes remains constant - the nodes are only repositioned with respect to the desired accuracy. Ultimately, $h$- and $p$-adaptivities can be combined to form the so-called $hp$-adaptivity, where the accuracy of the solution is controlled with the order of the method and the resolution of the spatial discretization.&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
==  Basic concept ==&lt;br /&gt;
&lt;br /&gt;
The proposed $hp$-adaptive solution procedure follows the well-established paradigm based on an iterative loop, where each iteration step consists of four modules:&lt;br /&gt;
* '''Solve''' - A numerical solution $\widehat{u}$ is obtained.&lt;br /&gt;
* '''Estimate''' - An estimate of the spatial accuracy of the numerical solution is calculated using error indicators.&lt;br /&gt;
* '''Mark''' - Depending on the error indicator values $\eta _i$, a marking strategy is used to mark the computational nodes for (de)refinement.&lt;br /&gt;
* '''Refine''' - Refinement strategy is employed to define the amount of the (de)refinement.&lt;br /&gt;
&lt;br /&gt;
Expected result is drafted in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_workflow.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The implementation of $hp$-adaptive solution procedure can be found [https://gitlab.com/e62Lab/public/2022_p_hp-adaptivity here].&lt;br /&gt;
&lt;br /&gt;
== Solution procedure ==&lt;br /&gt;
=== Solve ===&lt;br /&gt;
&lt;br /&gt;
First a numerical solution $\widehat{u}$ to the governing problem must be obtained. In general, the numerical treatment of a system of PDEs is done in several steps. First, the domain is discretized by positioning the nodes, then the linear differential operators in each computational node are approximated, and, finally, the system of PDEs is discretized and assembled into a large sparse linear system. To obtain a numerical solution $\widehat{u}$, the sparse system is solved.&lt;br /&gt;
&lt;br /&gt;
=== Estimate (IMEX error indicator) ===&lt;br /&gt;
In the estimation step, critical areas with high error of the numerical solution are identified. Identifying such areas is not a trivial task. In rare cases, where a closed form solution to the governing system of PDEs exists, we can not only indicate such areas but also estimate the accuracy of the numerical solution. However, for real-world problems, which are often subject of numerical simulations, closed form solutions do not exist. Therefore, other objective metrics are needed to indicate the computational nodes with high error of the numerical solution. Numerical tools used in such cases are commonly referred to as ''error indicators''.&lt;br /&gt;
&lt;br /&gt;
We have chosen to use our own error indication algorithm IMEX &amp;lt;ref name=&amp;quot;imex&amp;quot;&amp;gt; Jančič, Mitja, Filip Strniša, and Gregor Kosec. &amp;quot;Implicit-Explicit Error Indicator based on Approximation Order.&amp;quot; arXiv preprint arXiv:2204.01022 (2022).&amp;lt;/ref&amp;gt; for implementation-related convenience reasons. This error indicator makes use of the implicitly obtained numerical solution and explicit operators (approximated by higher-order basis) to reconstruct the right-hand side of the governing problem.&lt;br /&gt;
&lt;br /&gt;
To further explain basic idea of IMEX, let us define a PDE of type:&lt;br /&gt;
$$&lt;br /&gt;
    \mathcal L u = f_{RHS},&lt;br /&gt;
$$&lt;br /&gt;
where $\mathcal L$ is a differential operator applied to the scalar field $u$ and $f_{RHS}$ is a function. To obtain an error indicator field $\eta$, the problem is first solved implicitly by using a lower order approximation of operators $\mathcal L$, $\mathcal L^{(lo)}_{im}$, obtaining the solution $u^{(im)}$ in the process. The implicitly computed field $u^{(im)}$ is then used to explicitly reconstruct the right-hand side of the governing problem, but this time using a higher order approximation of $\mathcal L$, $\mathcal L^{(hi)}_{ex}$, obtaining $f_{RHS}^{(ex)}$ in the process.&lt;br /&gt;
Finally, $f_{RHS}^{(ex)}$ and $f_{RHS}$ are compared $\eta = \left | f_{RHS} - f_{RHS}^{(ex)} \right |$ to indicate the error of the numerical solution.&lt;br /&gt;
&lt;br /&gt;
=== Mark ===&lt;br /&gt;
&lt;br /&gt;
After the error indicator $\eta$ had been obtained for each computational point in $\Omega$, a marking strategy is employed. The main objective of this step is to flag the nodes with too high or too low error indicator values in order to achieve a uniformly distributed precision of the numerical solution and reduce computational costs - by avoiding fine local field descriptions and high order approximations where this is not required. Furthermore, the marking strategy not only decides whether or not (de)refinement should take place at a given computational node, but also defines the type of the refinement procedure in cases where there are multiple to choose from.&lt;br /&gt;
&lt;br /&gt;
In each adaptivity iteration, the marking strategy starts by checking the error indicator values $\eta _i$ for all computational nodes in the domain. If $\eta _i$ is greater than $\alpha \eta_{max}$ for a free model parameter $\alpha \in (0, 1)$, the node is marked for refinement. If $\eta _i$ is less than $\beta \eta_{max}$ for a free model parameter $\beta \in (0,1) \land \beta \leq \alpha$, the node is marked for derefinement. Otherwise, the node is left unmarked meaning no refinement should take place. The marking strategy can be summarized with a single equation&lt;br /&gt;
$$&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
        \eta _i &amp;gt; \alpha \eta_{max},                          &amp;amp; \text{ refine}     \\&lt;br /&gt;
        \beta \eta_{max} \leq \eta _i \leq \alpha \eta_{max}, &amp;amp; \text{ do nothing} \\&lt;br /&gt;
        \eta _i &amp;lt; \beta \eta_{max},                           &amp;amp; \text{ derefine}&lt;br /&gt;
    \end{cases}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
In the context of mesh-based methods, it has already been observed, that this strategy is indeed simple to implement, however, far from optimal in terms of achieving good convergence rates. Our studies have shown that a slight modification to the originally proposed strategy can significantly improve the performance of an $hp$-adaptive solution procedure in the context of mesh-free methods, but at the cost of higher number of free parameters - making it more difficult to understand. Nevertheless, the strategy is modified by introducing parameters $\left \{ \alpha_h, \beta_h \right \}$ and $\left \{ \alpha_p, \beta_p \right \}$ for separate treatment of $h$- and $p$-refinements respectively. A schematic is shown in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot from 2022-09-20 08-25-34.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Refine ===&lt;br /&gt;
&lt;br /&gt;
After obtaining the list of nodes marked for modification, the refinement module is initialized. In this module, the local field description and local approximation order for the unmarked nodes are left unchanged, while the rest are further processed to determine other refinement-type-specific details - such as the amount of the (de)refinement. &lt;br /&gt;
&lt;br /&gt;
We use the following $h$-refinement rule&lt;br /&gt;
$$&lt;br /&gt;
    \label{eq:refinement}&lt;br /&gt;
    h_i^{new}(\b p) = \frac{h_i^{old}}{\frac{\eta_i - \alpha \eta _{max}}{\eta_{max} - \alpha\eta_{max}}\big(\lambda - 1\big) + 1}&lt;br /&gt;
$$&lt;br /&gt;
for the dimensionless parameter $\lambda \in [1, \infty)$ allowing us to control the aggressiveness of the refinement - the larger the value, the greater the change. This refinement rule also conveniently refines the areas with higher error indicator values more than the ones that are closer to the upper refinement threshold $\alpha_h \eta_{max}$. Similarly, a derefinement rule is proposed&lt;br /&gt;
$$&lt;br /&gt;
    \label{eq:derefinement}&lt;br /&gt;
    h_i^{new}(\b p) = \frac{h_i^{old}}{\frac{\beta \eta _{max} - \eta_i}{\beta\eta_{max} - \eta_{min}}\big(\frac{1}{\vartheta} - 1\big) + 1},&lt;br /&gt;
$$&lt;br /&gt;
where parameter $\vartheta \in [1, \infty)$ allows us to control the aggressiveness of derefinement.&lt;br /&gt;
&lt;br /&gt;
The same refinement and derefinement strategies were applied to control the local approximation order, except this time the value is rounded to the nearest integer. Similarly and for the same reasons as we did with the marking strategy, we consider a separate treatment of $h$- and $p$-adaptive procedures, by introducing (de)refinement aggressiveness parameters $\left \{\lambda_h, \vartheta_h \right \}$ and $\left \{\lambda_p, \vartheta_p \right \}$ for $h$- and $p$-refinement types respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_rules.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Finalization step ===&lt;br /&gt;
&lt;br /&gt;
Before the 4 modules can be iteratively repeated, the domain is rediscretized taking into account the newly computed local internodal distances $h_i^{new}(\b p)$ and the local approximation orders $m_i^{new}(\b p)$. However, both are only known in the computational nodes, while global functions $\widehat{h}^{new}(\b p)$ and $\widehat{m}^{new}(\b p)$ over our entire domain space $\Omega$ are required. These are obtained by employing the Sheppard's inverse distance weighting interpolation.&lt;br /&gt;
&lt;br /&gt;
Figure below schematically demonstrates 3 examples of $hp$-refinements. For the sake of demonstration, the refinement parameters for $h$- and $p$-adaptivity are the same, i.e. $\left \{ \alpha, \beta, \lambda, \vartheta \right \} = \left \{ \alpha_h, \beta_h, \lambda_h, \vartheta_h \right \} = \left \{ \alpha_p, \beta_p, \lambda_p, \vartheta_p \right \}$. Additionally, the derefinement aggressiveness $\vartheta$ and the upper threshold $\beta$ are kept constant, so, effectively, only the upper bound of refinement $\alpha$ and refinement aggressiveness $\lambda$ are altered. We observe that the effect refinement parameters is somewhat intuitive. The larger the aggressiveness $\lambda$ the better the local field description and the larger the number of nodes with high approximation order. Similar effect is observed with manipulating the upper refinement threshold $\alpha$, except the effect comes at a smoother manner. Also observe that all refined states were able to increase the accuracy of the numerical solution from the initial state.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_demonstration.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Example peak problem ===&lt;br /&gt;
&lt;br /&gt;
The proposed $hp$-adaptive solution procedure is demonstrated on a synthetical example. We chose a 2-dimensional Poisson problem with exponentially strong source positioned at $\boldsymbol x_s = \Big (\frac{1}{2}, \frac{1}{3}\Big )$. This example is categorized as a difficult problem and is commonly used to test the performance of adaptive solution procedures. The problem has a tractable solution $u(\boldsymbol x)=e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$, which allows us to evaluate the precision of the numerical solution $\widehat{u}$, e.g.\ in terms of the infinity norm.&lt;br /&gt;
&lt;br /&gt;
Governing equations are&lt;br /&gt;
$$&lt;br /&gt;
    \nabla^2 u (\boldsymbol x)   = 2a e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}(2a\left \| \boldsymbol x - \boldsymbol x_s \right \| - d) \quad \quad \text{in } \Omega,   \\&lt;br /&gt;
    u (\boldsymbol x)        = e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}                                       \quad \quad  \text{on } \Gamma_d, \\&lt;br /&gt;
    \nabla u (\boldsymbol x) = -2a(\boldsymbol x - \boldsymbol x_s)e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}                           \quad \quad\text{on } \Gamma_n,&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
Figure below shows example indicator fields for initial iteration, intermediate iteration and iteration that achieved the best accuracy of the numerical solution. The third column shows the IMEX error indicator. We can see that the IMEX successfully located the position of the strong source at $\boldsymbol x_s = \Big (\frac{1}{2}, \frac{1}{3}\Big )$ as the highest indicator values are seen in its neighborhood. Moreover, the second column shows that the accuracy of the numerical solution and uniformity of error distribution have both been significantly improved by the $hp$-adaptive solution procedure, further proving that the IMEX can be successfully employed as a reliable error indicator.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_demonstration_2d.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The behavior of IMEX over 70 adaptivity iterations is further studied in figure below. We are pleased to see that the convergence limit of the indicator around iteration $N_{iter}=60$ agrees well with the convergence limit of the numerical solution. &lt;br /&gt;
&lt;br /&gt;
[[File:error_indicator_convergence.png|800px]]&lt;br /&gt;
&lt;br /&gt;
Finally, the convergence behavior of the proposed $hp$-adaptive solution procedure is studied. In addition to the convergence of a single $hp$-adaptive run, the convergences obtained without the use of refinement procedures, i.e. solutions obtained with uniform internodal spacing and approximation orders over the entire domain, are shown in figure below. The figure evidently shows that a $hp$-adaptive solution procedure was able to notably improve the numerical solution in terms of accuracy and required computational points.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_of_h_hp.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Application to linear elasticity problems: Fretting fatigue contact ===&lt;br /&gt;
&lt;br /&gt;
The application of the proposed $hp$-adaptive solution procedure is further expanded to study a linear elasticity problem. Specifically, we obtain a $hp$-refined solution to fretting fatigue contact problem &amp;lt;ref name=&amp;quot;fwo&amp;quot;&amp;gt;Pereira, Kyvia, et al. &amp;quot;On the convergence of stresses in fretting fatigue.&amp;quot; Materials 9.8 (2016): 639.&amp;lt;/ref&amp;gt;, for which the authors believe no closed form solution is known.&lt;br /&gt;
&lt;br /&gt;
The problem formulation is given here &amp;lt;ref name=&amp;quot;slak&amp;quot;&amp;gt;Slak, Jure, and Gregor Kosec. &amp;quot;Adaptive radial basis function–generated finite differences method for contact problems.&amp;quot; International Journal for Numerical Methods in Engineering 119.7 (2019): 661-686.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Figure below shows an example of $hp$-refined solution to fretting fatigue problem at the last adaptivity iteration with $N=46\,626$ computational nodes. We see that the solution procedure successfully located the two critical points, i.e. the fixed top left corner with a stress singularity and the area in the middle of the top edge where the contact is simulated. Note that the highest stress values (approximately $2$ times higher) have been computed in the singularity in the top left corner, but those nodes are not shown since our focus is shifted towards the area under the contact.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_solution_hp.png|800px]]&lt;br /&gt;
&lt;br /&gt;
For a detailed analysis, we look at the surface traction $\sigma_{xx}$, as it is often used to determine the location of crack initiation. The surface traction is shown in figure below for $6$ selected adaptivity iterations. The mesh-free nodes are colored according to the local approximation order enforced by the $hp$-adaptive solution procedure. The message of this figure is twofold. Firstly, it is clear that the proposed IMEX error indicator can be successfully used in linear elasticity problems, and secondly, we observe that the $hp$-adaptive solution procedure successfully approximated the surface traction in the neighborhood of the contact. In the process, the local field description under the contact has been significantly improved and also the local approximation orders have taken a non-trivial distribution.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_abaqus.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The surface traction is additionally accompanied with the FEM results on a much denser mesh with more than 100\,000 DOFs obtained with the commercial solver Abaqus\textsuperscript{\textregistered}. To compute the absolute difference between the two methods, the mesh-free solution has been interpolated to Abaqus's computational points using the Sheppard's inverse distance weighting interpolation with $2$ closest neighbors. We see that the absolute difference is decreasing with the number of adaptivity iterations, finally settling at approximately 2 % of the maximum value under the contact at initial iteration. The highest absolute difference is expectedly located at the edges of the contact, i.e. around $x=a$ and $x=-a$, while the difference in the rest of the contact is even smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to [[Medusa#Examples|Examples]].&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3234</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3234"/>
				<updated>2022-09-20T07:47:57Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Adaptive solution procedures are essential in problems where the accuracy of the numerical solution varies spatially and are currently subject of intensive studies. Two conceptually different adaptive approaches have been proposed, namely $p$-adaptivity or $h$-, $r$-adaptivity. In $p$-adaptivity, the accuracy of the numerical solution is varied by changing the order of approximation, while in $h$- and $r$-adaptivity the resolution of the spatial discretization is adjusted for the same purpose. In the $h$-adaptive approach, nodes are added or removed from the domain as needed, while in the $r$-adaptive approach, the total number of nodes remains constant - the nodes are only repositioned with respect to the desired accuracy. Ultimately, $h$- and $p$-adaptivities can be combined to form the so-called $hp$-adaptivity, where the accuracy of the solution is controlled with the order of the method and the resolution of the spatial discretization.&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
==  Basic concept ==&lt;br /&gt;
&lt;br /&gt;
The proposed $hp$-adaptive solution procedure follows the well-established paradigm based on an iterative loop, where each iteration step consists of four modules:&lt;br /&gt;
* '''Solve''' - A numerical solution $\widehat{u}$ is obtained.&lt;br /&gt;
* '''Estimate''' - An estimate of the spatial accuracy of the numerical solution is calculated using error indicators.&lt;br /&gt;
* '''Mark''' - Depending on the error indicator values $\eta _i$, a marking strategy is used to mark the computational nodes for (de)refinement.&lt;br /&gt;
* '''Refine''' - Refinement strategy is employed to define the amount of the (de)refinement.&lt;br /&gt;
&lt;br /&gt;
Expected result is drafted in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_workflow.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
The implementation of $hp$-adaptive solution procedure can be found [https://gitlab.com/e62Lab/public/2022_p_hp-adaptivity here].&lt;br /&gt;
&lt;br /&gt;
== Solution procedure ==&lt;br /&gt;
=== Solve ===&lt;br /&gt;
&lt;br /&gt;
First a numerical solution $\widehat{u}$ to the governing problem must be obtained. In general, the numerical treatment of a system of PDEs is done in several steps. First, the domain is discretized by positioning the nodes, then the linear differential operators in each computational node are approximated, and, finally, the system of PDEs is discretized and assembled into a large sparse linear system. To obtain a numerical solution $\widehat{u}$, the sparse system is solved.&lt;br /&gt;
&lt;br /&gt;
=== Estimate (IMEX error indicator) ===&lt;br /&gt;
In the estimation step, critical areas with high error of the numerical solution are identified. Identifying such areas is not a trivial task. In rare cases, where a closed form solution to the governing system of PDEs exists, we can not only indicate such areas but also estimate the accuracy of the numerical solution. However, for real-world problems, which are often subject of numerical simulations, closed form solutions do not exist. Therefore, other objective metrics are needed to indicate the computational nodes with high error of the numerical solution. Numerical tools used in such cases are commonly referred to as ''error indicators''.&lt;br /&gt;
&lt;br /&gt;
We have chosen to use our own error indication algorithm IMEX &amp;lt;ref name=&amp;quot;imex&amp;quot;&amp;gt; Jančič, Mitja, Filip Strniša, and Gregor Kosec. &amp;quot;Implicit-Explicit Error Indicator based on Approximation Order.&amp;quot; arXiv preprint arXiv:2204.01022 (2022).&amp;lt;/ref&amp;gt; for implementation-related convenience reasons. This error indicator makes use of the implicitly obtained numerical solution and explicit operators (approximated by higher-order basis) to reconstruct the right-hand side of the governing problem.&lt;br /&gt;
&lt;br /&gt;
To further explain basic idea of IMEX, let us define a PDE of type:&lt;br /&gt;
$$&lt;br /&gt;
    \mathcal L u = f_{RHS},&lt;br /&gt;
$$&lt;br /&gt;
where $\mathcal L$ is a differential operator applied to the scalar field $u$ and $f_{RHS}$ is a function. To obtain an error indicator field $\eta$, the problem is first solved implicitly by using a lower order approximation of operators $\mathcal L$, $\mathcal L^{(lo)}_{im}$, obtaining the solution $u^{(im)}$ in the process. The implicitly computed field $u^{(im)}$ is then used to explicitly reconstruct the right-hand side of the problem~\eqref{eq: general PDE}, but this time using a higher order approximation of $\mathcal L$, $\mathcal L^{(hi)}_{ex}$, obtaining $f_{RHS}^{(ex)}$ in the process.&lt;br /&gt;
Finally, $f_{RHS}^{(ex)}$ and $f_{RHS}$ are compared $\eta = \left | f_{RHS} - f_{RHS}^{(ex)} \right |$ to indicate the error of the numerical solution.&lt;br /&gt;
&lt;br /&gt;
=== Mark ===&lt;br /&gt;
&lt;br /&gt;
After the error indicator $\eta$ had been obtained for each computational point in $\Omega$, a marking strategy is employed. The main objective of this step is to flag the nodes with too high or too low error indicator values in order to achieve a uniformly distributed precision of the numerical solution and reduce computational costs - by avoiding fine local field descriptions and high order approximations where this is not required. Furthermore, the marking strategy not only decides whether or not (de)refinement should take place at a given computational node, but also defines the type of the refinement procedure in cases where there are multiple to choose from.&lt;br /&gt;
&lt;br /&gt;
In each adaptivity iteration, the marking strategy starts by checking the error indicator values $\eta _i$ for all computational nodes in the domain. If $\eta _i$ is greater than $\alpha \eta_{max}$ for a free model parameter $\alpha \in (0, 1)$, the node is marked for refinement. If $\eta _i$ is less than $\beta \eta_{max}$ for a free model parameter $\beta \in (0,1) \land \beta \leq \alpha$, the node is marked for derefinement. Otherwise, the node is left unmarked meaning no refinement should take place. The marking strategy can be summarized with a single equation&lt;br /&gt;
$$&lt;br /&gt;
    \begin{cases}&lt;br /&gt;
        \eta _i &amp;gt; \alpha \eta_{max},                          &amp;amp; \text{ refine}     \\&lt;br /&gt;
        \beta \eta_{max} \leq \eta _i \leq \alpha \eta_{max}, &amp;amp; \text{ do nothing} \\&lt;br /&gt;
        \eta _i &amp;lt; \beta \eta_{max},                           &amp;amp; \text{ derefine}&lt;br /&gt;
    \end{cases}.&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
In the context of mesh-based methods, it has already been observed, that this strategy is indeed simple to implement, however, far from optimal in terms of achieving good convergence rates. Our studies have shown that a slight modification to the originally proposed strategy can significantly improve the performance of an $hp$-adaptive solution procedure in the context of mesh-free methods, but at the cost of higher number of free parameters - making it more difficult to understand. Nevertheless, the strategy is modified by introducing parameters $\left \{ \alpha_h, \beta_h \right \}$ and $\left \{ \alpha_p, \beta_p \right \}$ for separate treatment of $h$- and $p$-refinements respectively. A schematic is shown in figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot from 2022-09-20 08-25-34.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Refine ===&lt;br /&gt;
&lt;br /&gt;
After obtaining the list of nodes marked for modification, the refinement module is initialized. In this module, the local field description and local approximation order for the unmarked nodes are left unchanged, while the rest are further processed to determine other refinement-type-specific details - such as the amount of the (de)refinement. &lt;br /&gt;
&lt;br /&gt;
We use the following $h$-refinement rule&lt;br /&gt;
$$&lt;br /&gt;
    \label{eq:refinement}&lt;br /&gt;
    h_i^{new}(\b p) = \frac{h_i^{old}}{\frac{\eta_i - \alpha \eta _{max}}{\eta_{max} - \alpha\eta_{max}}\big(\lambda - 1\big) + 1}&lt;br /&gt;
$$&lt;br /&gt;
for the dimensionless parameter $\lambda \in [1, \infty)$ allowing us to control the aggressiveness of the refinement - the larger the value, the greater the change. This refinement rule also conveniently refines the areas with higher error indicator values more than the ones that are closer to the upper refinement threshold $\alpha_h \eta_{max}$. Similarly, a derefinement rule is proposed&lt;br /&gt;
$$&lt;br /&gt;
    \label{eq:derefinement}&lt;br /&gt;
    h_i^{new}(\b p) = \frac{h_i^{old}}{\frac{\beta \eta _{max} - \eta_i}{\beta\eta_{max} - \eta_{min}}\big(\frac{1}{\vartheta} - 1\big) + 1},&lt;br /&gt;
$$&lt;br /&gt;
where parameter $\vartheta \in [1, \infty)$ allows us to control the aggressiveness of derefinement.&lt;br /&gt;
&lt;br /&gt;
The same refinement and derefinement strategies were applied to control the local approximation order, except this time the value is rounded to the nearest integer. Similarly and for the same reasons as we did with the marking strategy, we consider a separate treatment of $h$- and $p$-adaptive procedures, by introducing (de)refinement aggressiveness parameters $\left \{\lambda_h, \vartheta_h \right \}$ and $\left \{\lambda_p, \vartheta_p \right \}$ for $h$- and $p$-refinement types respectively.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_rules.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Finalization step ===&lt;br /&gt;
&lt;br /&gt;
Before the 4 modules can be iteratively repeated, the domain is rediscretized taking into account the newly computed local internodal distances $h_i^{new}(\b p)$ and the local approximation orders $m_i^{new}(\b p)$. However, both are only known in the computational nodes, while global functions $\widehat{h}^{new}(\b p)$ and $\widehat{m}^{new}(\b p)$ over our entire domain space $\Omega$ are required. These are obtained by employing the Sheppard's inverse distance weighting interpolation.&lt;br /&gt;
&lt;br /&gt;
Figure below schematically demonstrates 3 examples of $hp$-refinements. For the sake of demonstration, the refinement parameters for $h$- and $p$-adaptivity are the same, i.e.\ $\left \{ \alpha, \beta, \lambda, \vartheta \right \} = \left \{ \alpha_h, \beta_h, \lambda_h, \vartheta_h \right \} = \left \{ \alpha_p, \beta_p, \lambda_p, \vartheta_p \right \}$. Additionally, the derefinement aggressiveness $\vartheta$ and the upper threshold $\beta$ are kept constant, so, effectively, only the upper bound of refinement $\alpha$ and refinement aggressiveness $\lambda$ are altered. We observe that the effect refinement parameters is somewhat intuitive. The larger the aggressiveness $\lambda$ the better the local field description and the larger the number of nodes with high approximation order. Similar effect is observed with manipulating the upper refinement threshold $\alpha$, except the effect comes at a smoother manner. Also observe that all refined states were able to increase the accuracy of the numerical solution from the initial state.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_demonstration.png|800px]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
=== Example peak problem ===&lt;br /&gt;
&lt;br /&gt;
The proposed $hp$-adaptive solution procedure is demonstrated on a synthetical example. We chose a 2-dimensional Poisson problem with exponentially strong source positioned at $\boldsymbol x_s = \Big (\frac{1}{2}, \frac{1}{3}\Big )$. This example is categorized as a difficult problem and is commonly used to test the performance of adaptive solution procedures. The problem has a tractable solution $u(\boldsymbol x)=e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}$, which allows us to evaluate the precision of the numerical solution $\widehat{u}$, e.g.\ in terms of the infinity norm.&lt;br /&gt;
&lt;br /&gt;
Governing equations are&lt;br /&gt;
$$&lt;br /&gt;
    \nabla^2 u (\boldsymbol x)   = 2a e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}(2a\left \| \boldsymbol x - \boldsymbol x_s \right \| - d) \quad \quad \text{in } \Omega,   \\&lt;br /&gt;
    u (\boldsymbol x)        = e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}                                       \quad \quad  \text{on } \Gamma_d, \\&lt;br /&gt;
    \nabla u (\boldsymbol x) = -2a(\boldsymbol x - \boldsymbol x_s)e^{-a \left \| \boldsymbol x - \boldsymbol x_s \right \|^2}                           \quad \quad\text{on } \Gamma_n,&lt;br /&gt;
$$&lt;br /&gt;
&lt;br /&gt;
Figure below shows example indicator fields for initial iteration, intermediate iteration and iteration that achieved the best accuracy of the numerical solution. The third column shows the IMEX error indicator. We can see that the IMEX successfully located the position of the strong source at $\boldsymbol x_s = \Big (\frac{1}{2}, \frac{1}{3}\Big )$ as the highest indicator values are seen in its neighborhood. Moreover, the second column shows that the accuracy of the numerical solution and uniformity of error distribution have both been significantly improved by the $hp$-adaptive solution procedure, further proving that the IMEX can be successfully employed as a reliable error indicator.&lt;br /&gt;
&lt;br /&gt;
[[File:refinement_demonstration_2d.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The behavior of IMEX over 70 adaptivity iterations is further studied in figure below. We are pleased to see that the convergence limit of the indicator around iteration $N_{iter}=60$ agrees well with the convergence limit of the numerical solution. &lt;br /&gt;
&lt;br /&gt;
[[File:error_indicator_convergence.png|800px]]&lt;br /&gt;
&lt;br /&gt;
Finally, the convergence behavior of the proposed $hp$-adaptive solution procedure is studied. In addition to the convergence of a single $hp$-adaptive run, the convergences obtained without the use of refinement procedures, i.e. solutions obtained with uniform internodal spacing and approximation orders over the entire domain, are shown in figure below. The figure evidently shows that a $hp$-adaptive solution procedure was able to notably improve the numerical solution in terms of accuracy and required computational points.&lt;br /&gt;
&lt;br /&gt;
[[File:convergence_of_h_hp.png|800px]]&lt;br /&gt;
&lt;br /&gt;
=== Application to linear elasticity problems: Fretting fatigue contact ===&lt;br /&gt;
&lt;br /&gt;
The application of the proposed $hp$-adaptive solution procedure is further expanded to study a linear elasticity problem. Specifically, we obtain a $hp$-refined solution to fretting fatigue contact problem &amp;lt;ref name=&amp;quot;fwo&amp;quot;&amp;gt;Pereira, Kyvia, et al. &amp;quot;On the convergence of stresses in fretting fatigue.&amp;quot; Materials 9.8 (2016): 639.&amp;lt;/ref&amp;gt;, for which the authors believe no closed form solution is known.&lt;br /&gt;
&lt;br /&gt;
The problem formulation is given here &amp;lt;ref name=&amp;quot;slak&amp;quot;&amp;gt;Slak, Jure, and Gregor Kosec. &amp;quot;Adaptive radial basis function–generated finite differences method for contact problems.&amp;quot; International Journal for Numerical Methods in Engineering 119.7 (2019): 661-686.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Figure below shows an example of $hp$-refined solution to fretting fatigue problem at the last adaptivity iteration with $N=46\,626$ computational nodes. We see that the solution procedure successfully located the two critical points, i.e. the fixed top left corner with a stress singularity and the area in the middle of the top edge where the contact is simulated. Note that the highest stress values (approximately $2$ times higher) have been computed in the singularity in the top left corner, but those nodes are not shown since our focus is shifted towards the area under the contact.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_solution_hp.png|800px]]&lt;br /&gt;
&lt;br /&gt;
For a detailed analysis, we look at the surface traction $\sigma_{xx}$, as it is often used to determine the location of crack initiation. The surface traction is shown in Figure~\ref{fig:fwo_conv} for $6$ selected adaptivity iterations. The mesh-free nodes are colored according to the local approximation order enforced by the $hp$-adaptive solution procedure. The message of this figure is twofold. Firstly, it is clear that the proposed IMEX error indicator can be successfully used in linear elasticity problems, and secondly, we observe that the $hp$-adaptive solution procedure successfully approximated the surface traction in the neighborhood of the contact. In the process, the local field description under the contact has been significantly improved and also the local approximation orders have taken a non-trivial distribution.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_abaqus.png|800px]]&lt;br /&gt;
&lt;br /&gt;
The surface traction in Figure~\ref{fig:fwo_conv} is additionally accompanied with the FEM results on a much denser mesh with more than 100\,000 DOFs obtained with the commercial solver Abaqus\textsuperscript{\textregistered}. To compute the absolute difference between the two methods, the mesh-free solution has been interpolated to Abaqus's computational points using the Sheppard's inverse distance weighting interpolation with $2$ closest neighbors. We see that the absolute difference is decreasing with the number of adaptivity iterations, finally settling at approximately 2 \% of the maximum value under the contact at initial iteration. The highest absolute difference is expectedly located at the edges of the contact, i.e.\ around $x=a$ and $x=-a$, while the difference in the rest of the contact is even smaller.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to [[Medusa#Examples|Examples]].&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3233</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3233"/>
				<updated>2022-09-20T07:06:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;TODO&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Fwo_abaqus.png&amp;diff=3232</id>
		<title>File:Fwo abaqus.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Fwo_abaqus.png&amp;diff=3232"/>
				<updated>2022-09-20T06:31:12Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Error_indicator_convergence.png&amp;diff=3229</id>
		<title>File:Error indicator convergence.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Error_indicator_convergence.png&amp;diff=3229"/>
				<updated>2022-09-20T06:31:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_of_h_hp.png&amp;diff=3230</id>
		<title>File:Convergence of h hp.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Convergence_of_h_hp.png&amp;diff=3230"/>
				<updated>2022-09-20T06:31:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Fwo_solution_hp.png&amp;diff=3231</id>
		<title>File:Fwo solution hp.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Fwo_solution_hp.png&amp;diff=3231"/>
				<updated>2022-09-20T06:31:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_demonstration.png&amp;diff=3227</id>
		<title>File:Refinement demonstration.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_demonstration.png&amp;diff=3227"/>
				<updated>2022-09-20T06:31:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_demonstration_2d.png&amp;diff=3228</id>
		<title>File:Refinement demonstration 2d.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_demonstration_2d.png&amp;diff=3228"/>
				<updated>2022-09-20T06:31:10Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Screenshot_from_2022-09-20_08-25-34.png&amp;diff=3225</id>
		<title>File:Screenshot from 2022-09-20 08-25-34.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Screenshot_from_2022-09-20_08-25-34.png&amp;diff=3225"/>
				<updated>2022-09-20T06:31:09Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_rules.png&amp;diff=3226</id>
		<title>File:Refinement rules.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_rules.png&amp;diff=3226"/>
				<updated>2022-09-20T06:31:09Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_workflow.png&amp;diff=3224</id>
		<title>File:Refinement workflow.png</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=File:Refinement_workflow.png&amp;diff=3224"/>
				<updated>2022-09-20T06:24:22Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: File uploaded with MsUpload&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;File uploaded with MsUpload&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Adaptivity&amp;diff=3223</id>
		<title>Adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Adaptivity&amp;diff=3223"/>
				<updated>2022-09-20T05:48:34Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Go back to [[Medusa#Examples|Examples]].&lt;br /&gt;
&lt;br /&gt;
Solutions to many physical problems governed by partial differential equations (PDE) often significantly vary in magnitude throughout the problem domain. Although in some special cases the areas with high error are known in advance, in general the error distribution is unknown beforehand. Adaptive techniques for solving PDEs are a standard way of dealing with this problem, where problematic regions are iteratively refined. A step further is automatic adaptivity, where problematic regions are chosen automatically using an error indicator and then refined, until certain error threshold is reached. Below, we show some examples of fully automatic adaptivity in Medusa.&lt;br /&gt;
&lt;br /&gt;
__FORCETOC__&lt;br /&gt;
&lt;br /&gt;
==  Basic concept ==&lt;br /&gt;
&lt;br /&gt;
The adaptive methodology in this paper behaves similarly to &amp;quot;remeshing&amp;quot; used commonly in FEM. &lt;br /&gt;
Some initial (possibly variable) nodal spacing $h^0$ is chosen, as well as its lower and upper bounds $h_L$ and  $h_U$, respectively. &lt;br /&gt;
Domain $\Omega$ is filled with nodes, conforming to $h^0$ and the solution $u^0$ is obtained. &lt;br /&gt;
An error indicator is employed to determine which nodes should be (de)refined and the nodal density $h^0$ is altered appropriately. &lt;br /&gt;
This adaptive cycle below is repeated until the convergence criterion is met. The procedure on $j$-th iteration is written in more detail below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fill $\Omega$ with nodes conforming to $h^j$.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Solve the problem to obtain $u^j$.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Compute the error indicator values $\varepsilon_i^j$ for each node $p_i$.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;If the mean of $\varepsilon_i^j$  is below some tolerance $\varepsilon$ return $u^j$ as the solution and stop.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Adapt $h^j$ to obtain $h^{j+1}$.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More details can be found in our paper &amp;lt;ref name=&amp;quot;SlakAdaptive&amp;quot;&amp;gt;Slak, J., &amp;amp; Kosec, G. Adaptive radial basis function‐generated finite differences method for contact problems. International Journal for Numerical Methods in Engineering, 2019.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Node density adaptation ==&lt;br /&gt;
&lt;br /&gt;
The existing nodal spacing function $h^j$ is evaluated at nodes $p_i$ to obtain values $h_{i,j} = h^j(p_i)$ . These values $h_{i,j}$ are modified by a density factor $f_i$ as&lt;br /&gt;
$$&lt;br /&gt;
h_{i,j+1} = \min(\max(h_{i,j} / f_i, h_L(p_i)), h_U(p_i)),&lt;br /&gt;
$$&lt;br /&gt;
where density factor $f_i$ is computed as&lt;br /&gt;
$$&lt;br /&gt;
f_i = \begin{cases}&lt;br /&gt;
1 + \frac{\eta - \varepsilon_i}{\eta - m} (\frac{1}{\beta} - 1), &amp;amp; \varepsilon_i \leq \eta, \quad \text{i.e. decrease the density} \\&lt;br /&gt;
1, &amp;amp; \eta &amp;lt; \varepsilon_i &amp;lt; \varepsilon,  \quad \text{i.e. no change in density}\\&lt;br /&gt;
1 + \frac{\varepsilon_i - \varepsilon}{M - \varepsilon} (\alpha - 1), &amp;amp; \varepsilon_i \geq \varepsilon, \quad \text{i.e. increase the density}&lt;br /&gt;
\end{cases}&lt;br /&gt;
$$&lt;br /&gt;
and $\alpha$ represents the refine aggressiveness, $\beta$ the derefine aggressiveness, $\varepsilon$ the refinement threshold, $\eta$ the derenfinement threshold,&lt;br /&gt;
and $m = \min_i  \varepsilon_i$ is the minimal and  $M = \max_i  \varepsilon_i$ is the maximal value of the error indicator. &lt;br /&gt;
Note that setting $\alpha=1$ or $\beta=1$ disables refinement and derefinement, respectively.&lt;br /&gt;
&lt;br /&gt;
This adaptation is illustrated in the figure below.&lt;br /&gt;
&lt;br /&gt;
[[File:density_change.png|1193px]]&lt;br /&gt;
&lt;br /&gt;
== Error indicators ==&lt;br /&gt;
The work on error indicators is ongoing. For now, we use an ad hoc error indicator&lt;br /&gt;
$$\varepsilon_i = \operatorname{std}_{j \in I_i}(u_j),$$&lt;br /&gt;
which represents the standard deviation of function values over all stencil nodes of a given node $p_i$.&lt;br /&gt;
&lt;br /&gt;
== Numerical exmaples ==&lt;br /&gt;
Below are several numerical examples where adaptivity has been tested or used to obtain solutions.&lt;br /&gt;
&lt;br /&gt;
The errors $e_1$, $e_2$, $e_\infty$ and $e_E$ refer to relative discrete $L^1$, $L^2$, $L_\infty$ and energy norm errors, respectively. These are evaluated in the computation nodes or on a denser grid by reinterpolation.&lt;br /&gt;
&lt;br /&gt;
Relative node density $\rho_i$ is calculated by computing the distances $d_i$ from each node to its closest neighbour and expressing them as the logarithmic ratio against the maximal distance: $\rho_i = -\log_2(d_i / \max_j d_j)$.&lt;br /&gt;
&lt;br /&gt;
=== L shaped domain ===&lt;br /&gt;
&lt;br /&gt;
The L shaped domain problem  is defined on $\Omega = [-1, 1]^2 \setminus [0, 1] \times [-1, 0]$. The Laplace problem $\nabla^2u = 0$ with the solution $u = r^{\frac{2}{3}} \sin(\frac{2}{3}\theta)$ given in polar coordinates.&lt;br /&gt;
&lt;br /&gt;
BF-FD method with Polyharmonic splines augmented with monomials up to and including 2nd order was used to approximate the differential operators. The stencils for each node were chosen by simply selecting the closest $n=15$ nodes. The resulting sparse system was solved using the Intel ® MKL Pardiso sparse solver. Both uniform and fully adaptive refinement was tested. The adaptive procedure was run with $\alpha=3$, $\varepsilon = 10^{-2}$, $\beta=1$ and $\eta=0$.&lt;br /&gt;
&lt;br /&gt;
The errors under uniform (left) and adaptive (right) refinement are shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:L_shape_uniform_error.png|500px]][[File:L_shape_adaptive_error.png|500px]]&lt;br /&gt;
&lt;br /&gt;
The error (left) and the nodal density (right) during the adaptive iteration are shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:L_shape_progress.png|600px]]&lt;br /&gt;
&lt;br /&gt;
=== Disk under stress ===&lt;br /&gt;
&lt;br /&gt;
The next case is disk under pressure case from [[Linear elasticity]] solving the Caucy-Navier equation of [[Solid Mechanics]].&lt;br /&gt;
The problem considers one quarter of the disk illustrated below by the domain $\Omega$. The spacing $\gamma$ represents the distance from the singularity.&lt;br /&gt;
&lt;br /&gt;
[[File:disk.png|350px]]&lt;br /&gt;
&lt;br /&gt;
Computed $\sigma_{xy}$ stress profiles for three considered cases. The lower three images show close-ups of the computed peaks.&lt;br /&gt;
&lt;br /&gt;
[[File:disk_profiles.png|1050px]]&lt;br /&gt;
&lt;br /&gt;
Error of the numerical solution of the compressed disk problem during adaptive iteration.&lt;br /&gt;
&lt;br /&gt;
[[File:disk_error.png|977px]]&lt;br /&gt;
&lt;br /&gt;
Error indicator value and node density in the last iteration.&lt;br /&gt;
&lt;br /&gt;
[[File:disk_err_den.png|695px]]&lt;br /&gt;
&lt;br /&gt;
Comparison of uniform and adaptive refinement.&lt;br /&gt;
&lt;br /&gt;
[[File:disk_uni_ada_err.png|971px]]&lt;br /&gt;
&lt;br /&gt;
=== Hertzian contact ===&lt;br /&gt;
&lt;br /&gt;
See [[Hertzian_contact]] for the description. &lt;br /&gt;
&lt;br /&gt;
Errors and node counts during adaptive iteration for the solution of the Hertzian problem. Observe the initial decrease due to derefinement.&lt;br /&gt;
&lt;br /&gt;
[[File:her_err_n.png|921px]]&lt;br /&gt;
&lt;br /&gt;
Top surface stress profiles during the iteration. Only even iterations are shown for brevity.&lt;br /&gt;
&lt;br /&gt;
[[File:her_profile.png|840px]]&lt;br /&gt;
&lt;br /&gt;
Comparing adaptive (left) and manual (right) nodal distributions densities for the Hertzian problem. The manual density was used in the refinement paper&amp;lt;ref name=&amp;quot;SlakRef&amp;quot;&amp;gt;Slak, J., &amp;amp; Kosec, G. (2019). Refined Meshless Local Strong Form solution of Cauchy–Navier equation on an irregular domain. Engineering analysis with boundary elements, 100, 3-13.&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
[[File:her_density.png|906px]]&lt;br /&gt;
&lt;br /&gt;
=== Fretting fatigue contact ===&lt;br /&gt;
&lt;br /&gt;
See [[Fretting fatigue case]] for the description.&lt;br /&gt;
&lt;br /&gt;
Surface traction $\sigma_{xx}$ under contact in four subsequent adaptive iterations during the solution of the fretting fatigue problem.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_profiles.png|627px]]&lt;br /&gt;
&lt;br /&gt;
Nodes of four subsequent adaptive iterations during the solution of the fretting fatigue problem, coloured by von Mises stress.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_iters.png|819px]]&lt;br /&gt;
&lt;br /&gt;
Error of surface traction using two reference solutions.&lt;br /&gt;
&lt;br /&gt;
[[File:fwo_error.png|505px]]&lt;br /&gt;
&lt;br /&gt;
=== Bousinesq's problem ===&lt;br /&gt;
&lt;br /&gt;
See [[Linear_elasticity#Point_contact_3D]] for more details.&lt;br /&gt;
&lt;br /&gt;
Error with respect to the number of nodes in the adaptive iteration of the solution of the Boussinesq's problem.&lt;br /&gt;
The right axis shows the number of computational nodes.&lt;br /&gt;
&lt;br /&gt;
[[File:bou_err.png|778px]]&lt;br /&gt;
&lt;br /&gt;
Stress profiles along the body diagonal from $[-1, -1, -1]$ to $[-\gamma, -\gamma, -\gamma]$ in adaptive iteration when solving the&lt;br /&gt;
Boussinesq's problem.&lt;br /&gt;
&lt;br /&gt;
[[File:bou_profile.png|1063px]]&lt;br /&gt;
&lt;br /&gt;
The obtained solution in the final iteration with an enlarged portion around the contact area. Both solutions are&lt;br /&gt;
plotted only in the computation nodes to also show the final nodal distribution. Nodes are coloured proportional to computed&lt;br /&gt;
values of von Mises stress.&lt;br /&gt;
&lt;br /&gt;
[[File:bou_sol.png|1165px]]&lt;br /&gt;
&lt;br /&gt;
=== Helmholz equation ===&lt;br /&gt;
&lt;br /&gt;
The equation $\nabla^2 u + \frac{1}{(\alpha+r)^4} u = f$ with the solution $u = sin(\frac{1}{\alpha+r})$ is solved adaptively. The value $\alpha = \frac{1}{5\pi}$ was used and the right hand side $f$ was computed from $u$.&lt;br /&gt;
&lt;br /&gt;
Error under uniform (left) and adaptive (right) refinement.&lt;br /&gt;
&lt;br /&gt;
[[File:osc2d_uniform_error.png|500px]][[File:osc2d_adaptive_error.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Solution and the nodal density in the final iteration.&lt;br /&gt;
&lt;br /&gt;
[[File:osc2d_adaptive_sol.png|500px]][[File:osc2d_adaptive_den.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Error under adaptive refinement for the 3D equation.&lt;br /&gt;
&lt;br /&gt;
[[File:osc3d_adaptive_error.png|500px]]&lt;br /&gt;
&lt;br /&gt;
Solution and the nodal density in the final iteration of the 3D solution.&lt;br /&gt;
&lt;br /&gt;
[[File:osc3d_adaptive_sol.png|500px]][[File:osc3d_adaptive_den.png|500px]]&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Go back to [[Medusa#Examples|Examples]].&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3222</id>
		<title>Medusa</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3222"/>
				<updated>2022-09-20T05:41:55Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Added hp-adaptivity page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--__NOTITLE__--&amp;gt;&lt;br /&gt;
'''Welcome to the Medusa wiki. To visit the main website, go to [http://e6.ijs.si/medusa/ http://e6.ijs.si/medusa/].'''&lt;br /&gt;
&lt;br /&gt;
In [http://e6.ijs.si/ParallelAndDistributedSystems/ Parallel and Distributed Systems Laboratory] we are working on a C++ library that is first and foremost focused on tools for solving Partial Differential Equations by meshless methods. The basic idea is to create generic codes for tools that are needed for solving not only PDEs but many other problems, e.g. Moving Least Squares approximation, $k$-d tree, domain generation engines, etc.&lt;br /&gt;
We call this open source meshless project [http://e6.ijs.si/medusa/ Medusa: Coordinate Free Meshless Method implementation (MM)].&lt;br /&gt;
&lt;br /&gt;
Technical details about code and examples  can be found on our [http://e6.ijs.si/medusa/docs/ documentation page] and [https://gitlab.com/e62Lab/medusa Gitlab repository]. [[File:C.png|100px||link=https://gitlab.com/e62Lab/medusa|alt=Alt text|code]] [[File:doxygen.png|100px|link=http://e6.ijs.si/medusa/docs/|alt=Alt text|Documentation page]]&lt;br /&gt;
&lt;br /&gt;
This wiki site is meant for more relaxed discussions about general principles, possible and already implemented applications, preliminary analyses, etc.&lt;br /&gt;
Note, that there are many grammatical mistakes, typos, stupid sentences, etc. This wiki is meant for quick information exchange and therefore we do not invest a lot of energy into styling :).  &lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [https://gitlab.com/e62Lab/medusa Code on Gitlab]&lt;br /&gt;
* [[How to build | Installation and building]]&lt;br /&gt;
* [[Including this library in your project | Including this library in your project]]&lt;br /&gt;
* [[Testing | Running tests]]&lt;br /&gt;
* [http://e6.ijs.si/medusa/docs/ Technical documentation]&lt;br /&gt;
* [[Coding style | Coding style]]&lt;br /&gt;
* [[Wiki editing guide | Wiki editing and backup guide]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In this section we present exact examples. Each of the below solutions can be found also in in the repository under examples. More explanation about the physical background and solution procedure can be found in following sections.&lt;br /&gt;
* [[Philosophy of examples and how to run them]]&lt;br /&gt;
* [[Poisson's equation]]&lt;br /&gt;
* [[Heat equation]]&lt;br /&gt;
* [[Linear elasticity]]&lt;br /&gt;
* [[Complex-valued problems]]&lt;br /&gt;
* [[Coupled domains]]&lt;br /&gt;
* [[Parametric domains | Parametric domains &amp;amp;ndash; Curved surface with variable density]]&lt;br /&gt;
* [[NURBS domains | Domains modeled with non-uniform rational basis spline's (NURBS)]]&lt;br /&gt;
* [[Determining the interior of the domain by oversampling the boundary]]&lt;br /&gt;
* [[Computer-aided design - Importing IGES and STEP files]]&lt;br /&gt;
* [[Realistic 3D models]]&lt;br /&gt;
* [[Customization]]&lt;br /&gt;
* [[Ghost nodes]]&lt;br /&gt;
* [[Electromagnetic scattering]]&lt;br /&gt;
* [[Schrödinger equation]]&lt;br /&gt;
* [[Wave equation]]&lt;br /&gt;
* [[Cahn-Hilliard equation]]&lt;br /&gt;
* [[Non-Newtonian_fluid_example | Non-Newtonian fluid]]&lt;br /&gt;
* [[Meshless Lattice Boltzmann method]]&lt;br /&gt;
&lt;br /&gt;
== Building blocks ==&lt;br /&gt;
Medusa is modular coordinate-free parallel implementation of a numerical framework designed, but not limited to, for solving PDEs. In this section we present main modules of the library that can be also used as a standalone tools. &lt;br /&gt;
* [[Positioning of computational nodes]] &lt;br /&gt;
* [[Relaxation of the nodal distribution]]&lt;br /&gt;
* [[Refinement of the nodal distribution]]&lt;br /&gt;
* [[k-d tree|''k''-d tree]] and other spatial search structures&lt;br /&gt;
* Solving [[Solving linear systems | linear systems]], [[Solving overdetermined systems | overdetermined]] and [[Solving underdetermined systems | underdetermined]]&lt;br /&gt;
* [[Weighted Least Squares (WLS)]]&lt;br /&gt;
* [[Computation of shape functions]]&lt;br /&gt;
* [[Meshless Local Strong Form Method (MLSM)]]&lt;br /&gt;
* [[Radial basis function-generated finite differences (RBF-FD)]]&lt;br /&gt;
* [[Ghost nodes (theory)]]&lt;br /&gt;
* [[Integrators for time stepping]]&lt;br /&gt;
* [[RBF Interpolation]]&lt;br /&gt;
&lt;br /&gt;
== Discussions / Applications ==&lt;br /&gt;
This section is meant for general discussion about the physical background of the examples, the solution procedures, various applications, etc. Note, that code snippets presented in discussion might not reflect the actual state of Medusa.  &lt;br /&gt;
* [[Convection Diffusion equation | Convection Diffusion equation]]&lt;br /&gt;
* [[Adaptivity]]&lt;br /&gt;
** [[HP-adaptivity]]&lt;br /&gt;
* [[Solid Mechanics]]&lt;br /&gt;
** [[Point contact]]&lt;br /&gt;
** [[Hertzian contact]]&lt;br /&gt;
** [[Cantilever beam]]&lt;br /&gt;
** [[Fretting fatigue case]]&lt;br /&gt;
** [[Plasticity]]&lt;br /&gt;
* [[Fluid Mechanics]]&lt;br /&gt;
** [[Lid driven cavity]]&lt;br /&gt;
** [[de Vahl Davis natural convection test]]&lt;br /&gt;
** [[Natural convection in 3D irregular domain]]&lt;br /&gt;
** [[Natural convection from heated cylinder]]&lt;br /&gt;
** [[Natural convection between concentric cylinders]]&lt;br /&gt;
** [[Non-Newtonian fluid]]&lt;br /&gt;
* [[Computational electromagnetics]]&lt;br /&gt;
** [[Triple dielectric step in 1D]]&lt;br /&gt;
** [[Scattering from an infinite cylinder]]&lt;br /&gt;
** [[Point source near an anisotropic lens]]&lt;br /&gt;
* Other applications&lt;br /&gt;
** [[Attenuation due to liquid water content in the atmosphere|Attenuation of a satellite communication]]&lt;br /&gt;
** [[Heart rate variability detection]]&lt;br /&gt;
** [[Bioheat equation]]&lt;br /&gt;
&lt;br /&gt;
== Performance analyses ==&lt;br /&gt;
* [[Execution on Intel® Xeon Phi™ co-processor]]&lt;br /&gt;
* [[1D MLSM and FDM comparison]]&lt;br /&gt;
* [[:File:tech_report.pdf|Execution overheads due to clumsy types::technical report]] [[File:pdf-file.gif]]&lt;br /&gt;
* [[Solving sparse systems]]&lt;br /&gt;
* [[Eigen paralelization]]&lt;br /&gt;
&lt;br /&gt;
== Last changes ==&lt;br /&gt;
&amp;lt;news unique=1 limit = 5&amp;gt;&lt;br /&gt;
*{{{timeanddate}}} :: {{{title}}} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/news&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
* FAQ  - [[Frequently asked questions]]. &lt;br /&gt;
* [[List of wiki contributors]]&lt;br /&gt;
* List of library contributors: [http://e6.ijs.si/medusa/about#about-contributors See the official website]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
For pre-prints check https://e6.ijs.si/ParallelAndDistributedSystems/publications/&lt;br /&gt;
&lt;br /&gt;
* J. Slak, G. Kosec; Medusa : A C++ library for solving PDEs using strong form mesh-free methods, ACM transactions on mathematical software, vol. 47, 2021 [DOI: 10.1145/3450966]&lt;br /&gt;
* M. Depolli, J. Slak, G. Kosec; Parallel domain discretization algorithm for RBF-FD and other meshless numerical methods for solving PDEs, Computers &amp;amp; Structures, 2022 [DOI: 10.1016/j.compstruc.2022.106773]&lt;br /&gt;
* U. Duh, G. Kosec, J. Slak; Fast variable density node generation on parametric surfaces with application to mesh-free methods, SIAM journal on scientific computing, vol. 43, 2021 [DOI: 10.1137/20M1325642]&lt;br /&gt;
* M. Jančič, J. Slak, G. Kosec; Monomial augmentation guidelines for RBF-FD from accuracy versus computational time perspective, Journal of scientific computing, vol. 87, 2021 [DOI: 10.1007/s10915-020-01401-y]&lt;br /&gt;
* Slak J., Kosec G., On Generation of Node Distributions for Meshless PDE Discretizations, SIAM Journal on Scientific Computing, 41(5), A3202&lt;br /&gt;
* Slak J., Kosec G. Adaptive radial basis function-generated finite differences method for contact problems. International journal for numerical methods in engineering, ISSN 0029-5981 [http://www-e6.ijs.si/ParallelAndDistributedSystems/pdf/32230439.pdf manuscript]&lt;br /&gt;
* Slak J., Kosec G.; Refined meshless local strong form solution of Cauchy-Navier equation on an irregular domain. Engineering analysis with boundary elements. 2018;11 ; [http://comms.ijs.si/~gkosec/data/papers/31107623.pdf manuscript]&lt;br /&gt;
* Depolli, M., Kosec, G., Assessment of differential evolution for multi-objective optimization in a natural convection problem solved by a local meshless method. Engineering optimization, 2017, vol. 49, no. 4, pp. 675-692 ;[http://comms.ijs.si/~gkosec/data/papers/29639719.pdf manuscript]&lt;br /&gt;
* Kosec G., A local numerical solution of a fluid-flow problem on an irregular domain. Advances in engineering software. 2016;7 ; [29512743] ; [http://comms.ijs.si/~gkosec/data/papers/29512743.pdf manuscript]&lt;br /&gt;
* Kosec G., Trobec R., Simulation of semiconductor devices with a local numerical approach. Engineering analysis with boundary elements. 2015;69-75; [27912487] ; [http://comms.ijs.si/~gkosec/data/papers/27912487.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., Simulation of macrosegregation with mesosegregates in binary metallic casts by a meshless method. Engineering analysis with boundary elements. 2014;36-44; [http://comms.ijs.si/~gkosec/data/papers/3218939.pdf manuscript]&lt;br /&gt;
* Kosec G., Depolli M., Rashkovska A., Trobec R., Super linear speedup in a local parallel meshless solution of thermo-fluid problem. Computers &amp;amp; Structures. 2014;133:30-38; [http://comms.ijs.si/~gkosec/data/papers/27339815.pdf manuscript]&lt;br /&gt;
* Kosec G., Zinterhof P., Local strong form meshless method on multiple Graphics Processing Units. Computer modeling in engineering &amp;amp; sciences. 2013;91:377-396; [http://comms.ijs.si/~gkosec/data/papers/26785063.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., H-adaptive local radial basis function collocation meshless method. Computers, materials &amp;amp; continua. 2011;26:227-253; [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerBurgers.pdf manuscript]&lt;br /&gt;
* Trobec R., Kosec G., Šterk M., Šarler B., Comparison of local weak and strong form meshless methods for 2-D diffusion equation. Engineering analysis with boundary elements. 2012;36:310-321; [http://comms.ijs.si/~gkosec/data/papers/EABE2499.pdf manuscript]&lt;br /&gt;
* Kosec G, Zaloznik M, Sarler B, Combeau H. A Meshless Approach Towards Solution of Macrosegregation Phenomena. CMC: Computers, Materials, &amp;amp; Continua. 2011;580:1-27 [http://comms.ijs.si/~gkosec/data/papers/KosecZaloznikSarlerCombeauSegregation.pdf manuscript]&lt;br /&gt;
* Kosec G, Sarler B. Solution of thermo-fluid problems by collocation with local pressure correction. International Journal of Numerical Methods for Heat &amp;amp; Fluid Flow. 2008;18:868-82 [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerNS2008.pdf manuscript]&lt;br /&gt;
*  Trobec R., Kosec G., Parallel Scientific Computing, ISBN: 978-3-319-17072-5 (Print) 978-3-319-17073-2.&lt;br /&gt;
*  Slak, J., Kosec, G.. Detection of heart rate variability from a wearable differential ECG device., MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938, pp 450-455.&lt;br /&gt;
*  Kolman, M., Kosec, G. Correlation between attenuation of 20 GHz satellite communication link and liquid water content in the atmosphere. MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938. pp. 308-313.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/products/medusa/&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3220</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3220"/>
				<updated>2022-09-20T05:41:13Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic moved page Hp-adaptivity to HP-adaptivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Test&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Hp-adaptivity&amp;diff=3221</id>
		<title>Hp-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Hp-adaptivity&amp;diff=3221"/>
				<updated>2022-09-20T05:41:13Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic moved page Hp-adaptivity to HP-adaptivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[HP-adaptivity]]&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3218</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3218"/>
				<updated>2022-09-20T05:40:15Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic moved page $hp$-adaptivity to Hp-adaptivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Test&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=$hp$-adaptivity&amp;diff=3219</id>
		<title>$hp$-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=$hp$-adaptivity&amp;diff=3219"/>
				<updated>2022-09-20T05:40:15Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic moved page $hp$-adaptivity to Hp-adaptivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Hp-adaptivity]]&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3216</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3216"/>
				<updated>2022-09-20T05:39:55Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic moved page Hp adaptivity to $hp$-adaptivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Test&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Hp_adaptivity&amp;diff=3217</id>
		<title>Hp adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Hp_adaptivity&amp;diff=3217"/>
				<updated>2022-09-20T05:39:55Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Mitjajancic moved page Hp adaptivity to $hp$-adaptivity&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[$hp$-adaptivity]]&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3215</id>
		<title>HP-adaptivity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=HP-adaptivity&amp;diff=3215"/>
				<updated>2022-09-20T05:39:39Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Created page with &amp;quot;Test&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Test&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3185</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3185"/>
				<updated>2021-10-08T10:23:13Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of plastic deformation by employing the von Mises plasticity model with isotropic hardening. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as ''plastic deformation'', is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation is irreversible.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to the simplicity of its computational implementation and appropriateness for real-world applications.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force $\bf f$ is applied to the body, the dynamics can be described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \boldsymbol{\sigma} + \bf{f} = 0,&lt;br /&gt;
\end{equation}&lt;br /&gt;
where $\boldsymbol \sigma $ is the stress tensor. Now contrary to the elastic response, where the relationship between the deformation $\bf u$ and stress $\boldsymbol \sigma$ is linear, the plastic response is a typical example of a non-linear relationship, because the stress tensor not only depends depends on the current deformation $\bf u$ but also on its history states. &lt;br /&gt;
Generally speaking, for such highly non-linear problems, iterative numerical methods are used to solve the problem. Therefore, the residuum vector $\bf r$ is introduced and above equation is rewritten&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \bf r (\bf u_{n + 1}) = \nabla \boldsymbol \sigma (\bf u_{n + 1}) - \bf f = 0.&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
TO BE FINISHED.&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto, mainly chapters 4-7.&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3184</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3184"/>
				<updated>2021-10-08T10:22:33Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of plastic deformation by employing the von Mises plasticity model with isotropic hardening. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as ''plastic deformation'', is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation is irreversible.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to the simplicity of its computational implementation and appropriateness for real-world applications.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force $\bf f$ is applied to the body, the dynamics can be described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \boldsymbol{\sigma} + \bf{f} = 0,&lt;br /&gt;
\end{equation}&lt;br /&gt;
where $\boldsymbol \sigma $ is the stress tensor. Now contrary to the elastic response, where the relationship between the deformation $\bf u$ and stress $\boldsymbol \sigma$ is linear, the plastic response is a typical example of a non-linear relationship, because the stress tensor not only depends depends on the current deformation $\bf u$ but also on its history states. &lt;br /&gt;
Generally speaking, for such highly non-linear problems, iterative numerical methods are used to solve the problem. Therefore, the residuum vector $\bf r$ is introduced and above equation is rewritten&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \bf r (\bf u_{n + 1}) = \nabla \boldsymbol \sigma (\bf u_{n + 1}) - \bf f = 0.&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TO BE FINISHED.&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto, mainly chapters 4-7.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3183</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3183"/>
				<updated>2021-10-08T10:20:56Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of plastic deformation by employing the von Mises plasticity model with isotropic hardening. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&amp;lt;div class=&amp;quot;mw-collapsible-content&amp;quot;&amp;gt;&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as ''plastic deformation'', is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation is irreversible.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to the simplicity of its computational implementation and appropriateness for real-world applications.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force $\bf f$ is applied to the body, the dynamics can be described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \boldsymbol{\sigma} + \bf{f} = 0,&lt;br /&gt;
\end{equation}&lt;br /&gt;
where $\boldsymbol \sigma $ is the stress tensor. Now contrary to the elastic response, where the relationship between the deformation $\bf u$ and stress $\boldsymbol \sigma$ is linear, the plastic response is a typical example of a non-linear relationship, because the stress tensor not only depends depends on the current deformation $\bf u$ but also on its history states. &lt;br /&gt;
Generally speaking, for such highly non-linear problems, iterative numerical methods are used to solve the problem. Therefore, the residuum vector $\bf r$ is introduced and above equation is rewritten&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \bf r (\bf u_{n + 1}) = \nabla \boldsymbol \sigma (\bf u_{n + 1}) - \bf f = 0.&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TO BE FINISHED.&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto, mainly chapters 4-7.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3182</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3182"/>
				<updated>2021-10-08T10:20:07Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of plastic deformation by employing the von Mises plasticity model with isotropic hardening. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as ''plastic deformation'', is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation is irreversible.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to the simplicity of its computational implementation and appropriateness for real-world applications.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force $\bf f$ is applied to the body, the dynamics can be described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \boldsymbol{\sigma} + \bf{f} = 0,&lt;br /&gt;
\end{equation}&lt;br /&gt;
where $\boldsymbol \sigma $ is the stress tensor. Now contrary to the elastic response, where the relationship between the deformation $\bf u$ and stress $\boldsymbol \sigma$ is linear, the plastic response is a typical example of a non-linear relationship, because the stress tensor not only depends depends on the current deformation $\bf u$ but also on its history states. &lt;br /&gt;
Generally speaking, for such highly non-linear problems, iterative numerical methods are used to solve the problem. Therefore, the residuum vector $\bf r$ is introduced and above equation is rewritten&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \bf r (\bf u_{n + 1}) = \nabla \boldsymbol \sigma (\bf u_{n + 1}) - \bf f = 0.&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
TO BE FINISHED.&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto, mainly chapters 4-7.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3181</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3181"/>
				<updated>2021-10-08T10:01:07Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of '''plastic deformation by employing the von Mises plasticity model with isotropic hardening'''. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as plastic deformation, is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation transits from elastic to plastic range.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to its computational implementation simplicity and appropriateness for real-world examples.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force is applied to the body, the dynamics are described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \boldsymbol{\sigma} + \bf{f} = 0&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;, mainly chapters 4-7.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3180</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3180"/>
				<updated>2021-10-08T10:00:19Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of '''plastic deformation by employing the von Mises plasticity model with isotropic hardening'''. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as plastic deformation, is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation transits from elastic to plastic range.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to its computational implementation simplicity and appropriateness for real-world examples.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force is applied to the body, the dynamics are described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \bf{\sigma} + \bf{f} = 0&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;, mainly chapters 4-7.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3179</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3179"/>
				<updated>2021-10-08T10:00:09Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of '''plastic deformation by employing the von Mises plasticity model with isotropic hardening'''. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;. For a more detailed theory description, we strongly recommend reading the book.&lt;br /&gt;
&lt;br /&gt;
= Introduction =&lt;br /&gt;
In physics and materials science, ''plasticity'', also known as plastic deformation, is observed when the solid material undergoes permanent deformation in response to applied forces. There are different small-strain elastoplastic constitutive models of plasticity known. The most popular theories are the von Mises, Tresca, Mohr-Coulomb and Drucker-Prager models. The main difference between them is in the computation of yield condition - threshold value after which the deformation transits from elastic to plastic range.&lt;br /&gt;
&lt;br /&gt;
This demonstration uses ''the von Mises model, with nonlinear isotropic hardening'', due to its computational implementation simplicity and appropriateness for real-world examples.&lt;br /&gt;
&lt;br /&gt;
= Theory of plasticity =&lt;br /&gt;
In continuum mechanics, stress is a physical quantity that expresses the internal forces that neighbouring particles of a continuous material exert on each other. When additional external force is applied to the body, the dynamics are described by a second Newton's law&lt;br /&gt;
\begin{equation}&lt;br /&gt;
\ \nabla \cdot \bf{sigma} + \bf{f} = 0&lt;br /&gt;
\end{equation}&lt;br /&gt;
&lt;br /&gt;
As previously stated, all of the theory is thoroughly explained in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;, mainly chapters 4-7.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3178</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3178"/>
				<updated>2021-10-08T09:28:42Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of '''plastic deformation with von Mises plasticity model and isotropic hardening'''. The majority of the theory is explained in detail in '''Computational Methods for Plasticity - Theory and Applications''' by EA de Souza Neto &amp;lt;ref&amp;gt; de Souza Neto, E.A., Peric, D. and Owen, D.R., 2011. Computational methods for plasticity: theory and applications. John Wiley &amp;amp; Sons&amp;lt;/ref&amp;gt;.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3177</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3177"/>
				<updated>2021-10-08T09:21:57Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Do you want to go back to [[Solid Mechanics]]?&lt;br /&gt;
&lt;br /&gt;
On this page we conduct numerical studies of '''bending of a cantilever loaded at the end''', a common numerical benchmark in elastostatics. &amp;lt;ref&amp;gt; Augarde, Charles E. and Deeks, Andrew J.. &amp;quot;The use of Timoshenko's exact solution for a cantilever beam in adaptive analysis&amp;quot; , ''Finite Elements in Analysis and Design''. (2008), doi: [http://dx.doi.org/10.1016/j.finel.2008.01.010 10.1016/j.finel.2008.01.010] &amp;lt;/ref&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3176</id>
		<title>Plasticity</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Plasticity&amp;diff=3176"/>
				<updated>2021-10-08T09:21:02Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Created page with &amp;quot; On this page we showcase some basic examples from linear elasticity. To read more about the governing equations, refer to the Solid Mechanics page and examples therein, w...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
On this page we showcase some basic examples from linear elasticity. To read more about the governing equations, refer to the [[Solid Mechanics]] page&lt;br /&gt;
and examples therein, which are considered in more detail.&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3175</id>
		<title>Medusa</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Medusa&amp;diff=3175"/>
				<updated>2021-10-08T09:20:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: /* Discussions / Applications */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--__NOTITLE__--&amp;gt;&lt;br /&gt;
'''Welcome to the Medusa wiki. To visit the main website, go to [http://e6.ijs.si/medusa/ http://e6.ijs.si/medusa/].'''&lt;br /&gt;
&lt;br /&gt;
In [http://e6.ijs.si/ParallelAndDistributedSystems/ Parallel and Distributed Systems Laboratory] we are working on a C++ library that is first and foremost focused on tools for solving Partial Differential Equations by meshless methods. The basic idea is to create generic codes for tools that are needed for solving not only PDEs but many other problems, e.g. Moving Least Squares approximation, $k$-d tree, domain generation engines, etc.&lt;br /&gt;
We call this open source meshless project [http://e6.ijs.si/medusa/ Medusa: Coordinate Free Meshless Method implementation (MM)].&lt;br /&gt;
&lt;br /&gt;
Technical details about code and examples  can be found on our [http://e6.ijs.si/medusa/docs/ documentation page] and [https://gitlab.com/e62Lab/medusa Gitlab repository]. [[File:C.png|100px||link=https://gitlab.com/e62Lab/medusa|alt=Alt text|code]] [[File:doxygen.png|100px|link=http://e6.ijs.si/medusa/docs/|alt=Alt text|Documentation page]]&lt;br /&gt;
&lt;br /&gt;
This wiki site is meant for more relaxed discussions about general principles, possible and already implemented applications, preliminary analyses, etc.&lt;br /&gt;
Note, that there are many grammatical mistakes, typos, stupid sentences, etc. This wiki is meant for quick information exchange and therefore we do not invest a lot of energy into styling :).  &lt;br /&gt;
&lt;br /&gt;
== Documentation ==&lt;br /&gt;
* [https://gitlab.com/e62Lab/medusa Code on Gitlab]&lt;br /&gt;
* [[How to build | Installation and building]]&lt;br /&gt;
* [[Including this library in your project | Including this library in your project]]&lt;br /&gt;
* [[Testing | Running tests]]&lt;br /&gt;
* [http://e6.ijs.si/medusa/docs/ Technical documentation]&lt;br /&gt;
* [[Coding style | Coding style]]&lt;br /&gt;
* [[Wiki editing guide | Wiki editing and backup guide]]&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
In this section we present exact examples. Each of the below solutions can be found also in in the repository under examples. More explanation about the physical background and solution procedure can be found in following sections.&lt;br /&gt;
* [[Philosophy of examples and how to run them]]&lt;br /&gt;
* [[Poisson's equation]]&lt;br /&gt;
* [[Heat equation]]&lt;br /&gt;
* [[Linear elasticity]]&lt;br /&gt;
* [[Complex-valued problems]]&lt;br /&gt;
* [[Coupled domains]]&lt;br /&gt;
* [[Parametric domains | Parametric domains &amp;amp;ndash; Curved surface with variable density]]&lt;br /&gt;
* [[NURBS domains | Domains modeled with non-uniform rational basis spline's (NURBS)]]&lt;br /&gt;
* [[Realistic 3D models]]&lt;br /&gt;
* [[Customization]]&lt;br /&gt;
* [[Ghost nodes]]&lt;br /&gt;
* [[Electromagnetic scattering]]&lt;br /&gt;
* [[Schrödinger equation]]&lt;br /&gt;
* [[Wave equation]]&lt;br /&gt;
* [[Cahn-Hilliard equation]]&lt;br /&gt;
* [[Non-Newtonian_fluid_example | Non-Newtonian fluid]]&lt;br /&gt;
* [[Meshless Lattice Boltzmann method]]&lt;br /&gt;
&lt;br /&gt;
== Building blocks ==&lt;br /&gt;
Medusa is modular coordinate-free parallel implementation of a numerical framework designed, but not limited to, for solving PDEs. In this section we present main modules of the library that can be also used as a standalone tools. &lt;br /&gt;
* [[Positioning of computational nodes]] &lt;br /&gt;
* [[Relaxation of the nodal distribution]]&lt;br /&gt;
* [[Refinement of the nodal distribution]]&lt;br /&gt;
* [[k-d tree|''k''-d tree]] and other spatial search structures&lt;br /&gt;
* Solving [[Solving linear systems | linear systems]], [[Solving overdetermined systems | overdetermined]] and [[Solving underdetermined systems | underdetermined]]&lt;br /&gt;
* [[Weighted Least Squares (WLS)]]&lt;br /&gt;
* [[Computation of shape functions]]&lt;br /&gt;
* [[Meshless Local Strong Form Method (MLSM)]]&lt;br /&gt;
* [[Radial basis function-generated finite differences (RBF-FD)]]&lt;br /&gt;
* [[Ghost nodes (theory)]]&lt;br /&gt;
* [[Integrators for time stepping]]&lt;br /&gt;
* [[RBF Interpolation]]&lt;br /&gt;
&lt;br /&gt;
== Discussions / Applications ==&lt;br /&gt;
This section is meant for general discussion about the physical background of the examples, the solution procedures, various applications, etc. Note, that code snippets presented in discussion might not reflect the actual state of Medusa.  &lt;br /&gt;
* [[Convection Diffusion equation | Convection Diffusion equation]]&lt;br /&gt;
* [[Adaptivity]]&lt;br /&gt;
* [[Solid Mechanics]]&lt;br /&gt;
** [[Point contact]]&lt;br /&gt;
** [[Hertzian contact]]&lt;br /&gt;
** [[Cantilever beam]]&lt;br /&gt;
** [[Fretting fatigue case]]&lt;br /&gt;
** [[Plasticity]]&lt;br /&gt;
* [[Fluid Mechanics]]&lt;br /&gt;
** [[Lid driven cavity]]&lt;br /&gt;
** [[de Vahl Davis natural convection test]]&lt;br /&gt;
** [[Natural convection in 3D irregular domain]]&lt;br /&gt;
** [[Natural convection from heated cylinder]]&lt;br /&gt;
** [[Natural convection between concentric cylinders]]&lt;br /&gt;
** [[Non-Newtonian fluid]]&lt;br /&gt;
* [[Computational electromagnetics]]&lt;br /&gt;
** [[Triple dielectric step in 1D]]&lt;br /&gt;
** [[Scattering from an infinite cylinder]]&lt;br /&gt;
** [[Point source near an anisotropic lens]]&lt;br /&gt;
* Other applications&lt;br /&gt;
** [[Attenuation due to liquid water content in the atmosphere|Attenuation of a satellite communication]]&lt;br /&gt;
** [[Heart rate variability detection]]&lt;br /&gt;
** [[Bioheat equation]]&lt;br /&gt;
&lt;br /&gt;
== Performance analyses ==&lt;br /&gt;
* [[Execution on Intel® Xeon Phi™ co-processor]]&lt;br /&gt;
* [[1D MLSM and FDM comparison]]&lt;br /&gt;
* [[:File:tech_report.pdf|Execution overheads due to clumsy types::technical report]] [[File:pdf-file.gif]]&lt;br /&gt;
* [[Solving sparse systems]]&lt;br /&gt;
* [[Eigen paralelization]]&lt;br /&gt;
&lt;br /&gt;
== Last changes ==&lt;br /&gt;
&amp;lt;news unique=1 limit = 5&amp;gt;&lt;br /&gt;
*{{{timeanddate}}} :: {{{title}}} &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/news&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Miscellaneous ==&lt;br /&gt;
* FAQ  - [[Frequently asked questions]]. &lt;br /&gt;
* [[List of wiki contributors]]&lt;br /&gt;
* List of library contributors: [http://e6.ijs.si/medusa/about#about-contributors See the official website]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
For pre-prints check http://e6.ijs.si/ParallelAndDistributedSystems/publications/&lt;br /&gt;
&lt;br /&gt;
* Slak J., Kosec G., On Generation of Node Distributions for Meshless PDE Discretizations, SIAM Journal on Scientific Computing, 41(5), A3202&lt;br /&gt;
* Slak J., Kosec G. Adaptive radial basis function-generated finite differences method for contact problems. International journal for numerical methods in engineering, ISSN 0029-5981 [http://www-e6.ijs.si/ParallelAndDistributedSystems/pdf/32230439.pdf manuscript]&lt;br /&gt;
* Slak J., Kosec G.; Refined meshless local strong form solution of Cauchy-Navier equation on an irregular domain. Engineering analysis with boundary elements. 2018;11 ; [http://comms.ijs.si/~gkosec/data/papers/31107623.pdf manuscript]&lt;br /&gt;
* Depolli, M., Kosec, G., Assessment of differential evolution for multi-objective optimization in a natural convection problem solved by a local meshless method. Engineering optimization, 2017, vol. 49, no. 4, pp. 675-692 ;[http://comms.ijs.si/~gkosec/data/papers/29639719.pdf manuscript]&lt;br /&gt;
* Kosec G., A local numerical solution of a fluid-flow problem on an irregular domain. Advances in engineering software. 2016;7 ; [29512743] ; [http://comms.ijs.si/~gkosec/data/papers/29512743.pdf manuscript]&lt;br /&gt;
* Kosec G., Trobec R., Simulation of semiconductor devices with a local numerical approach. Engineering analysis with boundary elements. 2015;69-75; [27912487] ; [http://comms.ijs.si/~gkosec/data/papers/27912487.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., Simulation of macrosegregation with mesosegregates in binary metallic casts by a meshless method. Engineering analysis with boundary elements. 2014;36-44; [http://comms.ijs.si/~gkosec/data/papers/3218939.pdf manuscript]&lt;br /&gt;
* Kosec G., Depolli M., Rashkovska A., Trobec R., Super linear speedup in a local parallel meshless solution of thermo-fluid problem. Computers &amp;amp; Structures. 2014;133:30-38; [http://comms.ijs.si/~gkosec/data/papers/27339815.pdf manuscript]&lt;br /&gt;
* Kosec G., Zinterhof P., Local strong form meshless method on multiple Graphics Processing Units. Computer modeling in engineering &amp;amp; sciences. 2013;91:377-396; [http://comms.ijs.si/~gkosec/data/papers/26785063.pdf manuscript]&lt;br /&gt;
* Kosec G., Šarler B., H-adaptive local radial basis function collocation meshless method. Computers, materials &amp;amp; continua. 2011;26:227-253; [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerBurgers.pdf manuscript]&lt;br /&gt;
* Trobec R., Kosec G., Šterk M., Šarler B., Comparison of local weak and strong form meshless methods for 2-D diffusion equation. Engineering analysis with boundary elements. 2012;36:310-321; [http://comms.ijs.si/~gkosec/data/papers/EABE2499.pdf manuscript]&lt;br /&gt;
* Kosec G, Zaloznik M, Sarler B, Combeau H. A Meshless Approach Towards Solution of Macrosegregation Phenomena. CMC: Computers, Materials, &amp;amp; Continua. 2011;580:1-27 [http://comms.ijs.si/~gkosec/data/papers/KosecZaloznikSarlerCombeauSegregation.pdf manuscript]&lt;br /&gt;
* Kosec G, Sarler B. Solution of thermo-fluid problems by collocation with local pressure correction. International Journal of Numerical Methods for Heat &amp;amp; Fluid Flow. 2008;18:868-82 [http://comms.ijs.si/~gkosec/data/papers/KosecSarlerNS2008.pdf manuscript]&lt;br /&gt;
*  Trobec R., Kosec G., Parallel Scientific Computing, ISBN: 978-3-319-17072-5 (Print) 978-3-319-17073-2.&lt;br /&gt;
*  Slak, J., Kosec, G.. Detection of heart rate variability from a wearable differential ECG device., MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938, pp 450-455.&lt;br /&gt;
*  Kolman, M., Kosec, G. Correlation between attenuation of 20 GHz satellite communication link and liquid water content in the atmosphere. MIPRO 2016, 39th International Convention, 2016, Opatija, Croatia, ISSN 1847-3938. pp. 308-313.&lt;br /&gt;
&lt;br /&gt;
==Related pages==&lt;br /&gt;
* http://e6.ijs.si/ParallelAndDistributedSystems/products/medusa/&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3161</id>
		<title>Coding style</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3161"/>
				<updated>2020-11-30T13:06:11Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: /* Using your IDE auto formatter */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a brief description of our coding style, roughtly following the [https://google.github.io/styleguide/cppguide.html Google C++ Style Guide]. &lt;br /&gt;
&lt;br /&gt;
You can also download the CLion settings: [[File:Settings.jar|thumb]], which you can import in &amp;lt;code&amp;gt;File/Import settings&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also download only our code style settings to import in CLion: [[:File:mm.xml]]. It can be imported under &amp;lt;code&amp;gt;Settings/Editor/Code Style/Scheme/Import scheme&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
We use a 100 characters line width limit in C++ code.&lt;br /&gt;
&lt;br /&gt;
=Indentation=&lt;br /&gt;
&lt;br /&gt;
Indent using spaces. Indentation width is 4 spaces.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
for (int i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
    cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Naming convention=&lt;br /&gt;
&lt;br /&gt;
Constants - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; UPPER_CASE &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
classes   - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PascalCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
methods - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;camelCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
variables and stand-alone functions - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; underscore_separated &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typedefs - lowercase underscore separated, usually one word with trailing &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; _t &amp;lt;/syntaxhighlight&amp;gt;, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; vec_t &amp;lt;/syntaxhighlight&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
namespaces - one lowercase word, maybe shortened, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op &amp;lt;/syntaxhighlight&amp;gt;. For internal implementation details use &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op_internal &amp;lt;/syntaxhighlight&amp;gt;. Namespace closing brace should contain comment  `// namespace your_name`. There is no indentation within namespaces.&lt;br /&gt;
&lt;br /&gt;
All standard abbreviations like [[Weighted Least Squares (WLS)]] or [https://en.wikipedia.org/wiki/Finite_element_method Finite Elements Method (FEM)] -&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;UPPER_CASE&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Floating point and integer literals use small suffixes, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; 0.0f, -1e8l, 45ull&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
#define MAX_VALUE 500&lt;br /&gt;
class MyClass {&lt;br /&gt;
  public:&lt;br /&gt;
    MyClass(first_var, second_var) {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    int getSize();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comments=&lt;br /&gt;
&lt;br /&gt;
Comments are good. Use them to explain your code. Comments should have a space between the last&lt;br /&gt;
slash and the start of text.  Inline comments should have at least two spaces between end of code&lt;br /&gt;
and start of the comment. Comments before functions are used for documentation. Always use full &lt;br /&gt;
sentences and end them with a punctuation mark.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * This function changes the world.&lt;br /&gt;
 * @param skynet If `true`, the world ends, otherwise nothing happens.&lt;br /&gt;
 */&lt;br /&gt;
double change_the_world(bool skynet) {&lt;br /&gt;
    if (skynet) {&lt;br /&gt;
        return 0.0;  // Brace for the end of the world.&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use doxygen comments to generate [http://e6.ijs.si/medusa/docs/html/ documentation].&lt;br /&gt;
&lt;br /&gt;
=Headers =&lt;br /&gt;
&lt;br /&gt;
All headers must contain a header guard of form &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PATH_TO_FILENAME_HPP_&amp;lt;/syntaxhighlight&amp;gt; as enforced by the linter.&lt;br /&gt;
&lt;br /&gt;
Includes in header guards are separated in two groups, with intra-project includes on top and other includes on the bottom.&lt;br /&gt;
The groups are separated by a blank line and includes are kept sorted within a group.&lt;br /&gt;
&lt;br /&gt;
=Misc=&lt;br /&gt;
&lt;br /&gt;
Avoid trailing whitespace. Curly opening brackets &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; { &amp;lt;/syntaxhighlight&amp;gt; should be inline with &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; for &amp;lt;/syntaxhighlight&amp;gt; loops, function&lt;br /&gt;
definitions, class names, separated with a space. Outermost binary operators should have spaces&lt;br /&gt;
around them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
int sumMe(int var) {  // yes&lt;br /&gt;
    if (var == 1)&lt;br /&gt;
    {                 // no&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For null pointer we use  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; nullptr &amp;lt;/syntaxhighlight&amp;gt; instead of  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; NULL &amp;lt;/syntaxhighlight&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
=Using your IDE auto formatter=&lt;br /&gt;
Most available IDEs support source code formatting using [https://clang.llvm.org/docs/ClangFormat.html clang-format]. We recommend using coding style based on Google, with minor modifications concerning indentation and pointer location.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
# Use the Google style in this project.&lt;br /&gt;
BasedOnStyle: Google&lt;br /&gt;
&lt;br /&gt;
# Custom adjustments.&lt;br /&gt;
AccessModifierOffset: -2&lt;br /&gt;
IndentWidth: 4&lt;br /&gt;
ColumnLimit: 100&lt;br /&gt;
&lt;br /&gt;
# Some folks prefer to write &amp;quot;int&amp;amp; foo&amp;quot; while others prefer &amp;quot;int &amp;amp;foo&amp;quot;.  The&lt;br /&gt;
# Google Style Guide only asks for consistency within a project, we chose&lt;br /&gt;
# &amp;quot;int&amp;amp; foo&amp;quot; for this project:&lt;br /&gt;
DerivePointerAlignment: false&lt;br /&gt;
PointerAlignment: Left&lt;br /&gt;
&lt;br /&gt;
# Do not sort includes.&lt;br /&gt;
SortIncludes: false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More information about auto formatting in:&lt;br /&gt;
* [https://code.visualstudio.com/docs/cpp/cpp-ide Visual Studio Code],&lt;br /&gt;
* [https://www.jetbrains.com/help/clion/clangformat-as-alternative-formatter.html Jetbrains Clion]&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	<entry>
		<id>http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3160</id>
		<title>Coding style</title>
		<link rel="alternate" type="text/html" href="http://e6.ijs.si/medusa/wiki/index.php?title=Coding_style&amp;diff=3160"/>
				<updated>2020-11-30T13:00:08Z</updated>
		
		<summary type="html">&lt;p&gt;Mitjajancic: Updated .clang-format.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a brief description of our coding style, roughtly following the [https://google.github.io/styleguide/cppguide.html Google C++ Style Guide]. &lt;br /&gt;
&lt;br /&gt;
You can also download the CLion settings: [[File:Settings.jar|thumb]], which you can import in &amp;lt;code&amp;gt;File/Import settings&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can also download only our code style settings to import in CLion: [[:File:mm.xml]]. It can be imported under &amp;lt;code&amp;gt;Settings/Editor/Code Style/Scheme/Import scheme&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=General=&lt;br /&gt;
We use a 100 characters line width limit in C++ code.&lt;br /&gt;
&lt;br /&gt;
=Indentation=&lt;br /&gt;
&lt;br /&gt;
Indent using spaces. Indentation width is 4 spaces.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
for (int i = 0; i &amp;lt; 10; i++) {&lt;br /&gt;
    cout &amp;lt;&amp;lt; i &amp;lt;&amp;lt; endl;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Naming convention=&lt;br /&gt;
&lt;br /&gt;
Constants - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; UPPER_CASE &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
classes   - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PascalCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
methods - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;camelCase&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
variables and stand-alone functions - &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; underscore_separated &amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
typedefs - lowercase underscore separated, usually one word with trailing &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; _t &amp;lt;/syntaxhighlight&amp;gt;, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; vec_t &amp;lt;/syntaxhighlight&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
namespaces - one lowercase word, maybe shortened, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op &amp;lt;/syntaxhighlight&amp;gt;. For internal implementation details use &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; op_internal &amp;lt;/syntaxhighlight&amp;gt;. Namespace closing brace should contain comment  `// namespace your_name`. There is no indentation within namespaces.&lt;br /&gt;
&lt;br /&gt;
All standard abbreviations like [[Weighted Least Squares (WLS)]] or [https://en.wikipedia.org/wiki/Finite_element_method Finite Elements Method (FEM)] -&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;UPPER_CASE&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Floating point and integer literals use small suffixes, eg. &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; 0.0f, -1e8l, 45ull&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
#define MAX_VALUE 500&lt;br /&gt;
class MyClass {&lt;br /&gt;
  public:&lt;br /&gt;
    MyClass(first_var, second_var) {&lt;br /&gt;
        ...&lt;br /&gt;
    }&lt;br /&gt;
    int getSize();&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Comments=&lt;br /&gt;
&lt;br /&gt;
Comments are good. Use them to explain your code. Comments should have a space between the last&lt;br /&gt;
slash and the start of text.  Inline comments should have at least two spaces between end of code&lt;br /&gt;
and start of the comment. Comments before functions are used for documentation. Always use full &lt;br /&gt;
sentences and end them with a punctuation mark.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * This function changes the world.&lt;br /&gt;
 * @param skynet If `true`, the world ends, otherwise nothing happens.&lt;br /&gt;
 */&lt;br /&gt;
double change_the_world(bool skynet) {&lt;br /&gt;
    if (skynet) {&lt;br /&gt;
        return 0.0;  // Brace for the end of the world.&lt;br /&gt;
    }&lt;br /&gt;
    ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use doxygen comments to generate [http://e6.ijs.si/medusa/docs/html/ documentation].&lt;br /&gt;
&lt;br /&gt;
=Headers =&lt;br /&gt;
&lt;br /&gt;
All headers must contain a header guard of form &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt;PATH_TO_FILENAME_HPP_&amp;lt;/syntaxhighlight&amp;gt; as enforced by the linter.&lt;br /&gt;
&lt;br /&gt;
Includes in header guards are separated in two groups, with intra-project includes on top and other includes on the bottom.&lt;br /&gt;
The groups are separated by a blank line and includes are kept sorted within a group.&lt;br /&gt;
&lt;br /&gt;
=Misc=&lt;br /&gt;
&lt;br /&gt;
Avoid trailing whitespace. Curly opening brackets &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; { &amp;lt;/syntaxhighlight&amp;gt; should be inline with &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; for &amp;lt;/syntaxhighlight&amp;gt; loops, function&lt;br /&gt;
definitions, class names, separated with a space. Outermost binary operators should have spaces&lt;br /&gt;
around them.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot;&amp;gt;&lt;br /&gt;
int sumMe(int var) {  // yes&lt;br /&gt;
    if (var == 1)&lt;br /&gt;
    {                 // no&lt;br /&gt;
        return 1;&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
For null pointer we use  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; nullptr &amp;lt;/syntaxhighlight&amp;gt; instead of  &amp;lt;syntaxhighlight lang=&amp;quot;c++&amp;quot; inline&amp;gt; NULL &amp;lt;/syntaxhighlight&amp;gt; macro.&lt;br /&gt;
&lt;br /&gt;
=Using your IDE auto formatter=&lt;br /&gt;
Most available IDEs support source code formatting using [https://clang.llvm.org/docs/ClangFormat.html clang-format]. We recommend using coding style based on Google, with minor modifications concerning indentation and pointer location.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
# Use the Google style in this project.&lt;br /&gt;
BasedOnStyle: Google&lt;br /&gt;
&lt;br /&gt;
# Custom adjustments.&lt;br /&gt;
AccessModifierOffset: -2&lt;br /&gt;
IndentWidth: 4&lt;br /&gt;
ColumnLimit: 100&lt;br /&gt;
&lt;br /&gt;
# Some folks prefer to write &amp;quot;int&amp;amp; foo&amp;quot; while others prefer &amp;quot;int &amp;amp;foo&amp;quot;.  The&lt;br /&gt;
# Google Style Guide only asks for consistency within a project, we chose&lt;br /&gt;
# &amp;quot;int&amp;amp; foo&amp;quot; for this project:&lt;br /&gt;
DerivePointerAlignment: false&lt;br /&gt;
PointerAlignment: Left&lt;br /&gt;
&lt;br /&gt;
# Do not sort includes.&lt;br /&gt;
SortIncludes:false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
More information about auto formatting in:&lt;br /&gt;
* [https://code.visualstudio.com/docs/cpp/cpp-ide Visual Studio Code],&lt;br /&gt;
* [https://www.jetbrains.com/help/clion/clangformat-as-alternative-formatter.html Jetbrains Clion]&lt;/div&gt;</summary>
		<author><name>Mitjajancic</name></author>	</entry>

	</feed>