From 536568d8c8d603cf09c5b183766fea53265af204 Mon Sep 17 00:00:00 2001 From: Umberto Zerbinati Date: Fri, 7 Jun 2024 16:07:47 +0100 Subject: [PATCH] typoss Signed-off-by: Umberto Zerbinati --- docs/src/PETScPC/oseen.py.rst | 10 +++++----- docs/src/PETScPC/stokes.py.rst | 2 +- docs/src/PETScSNES/hyperelasticity.py.rst | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/src/PETScPC/oseen.py.rst b/docs/src/PETScPC/oseen.py.rst index 5ed0637..35d5c46 100755 --- a/docs/src/PETScPC/oseen.py.rst +++ b/docs/src/PETScPC/oseen.py.rst @@ -4,12 +4,12 @@ Vertex Patch smoothing for Augmented Lagrangian formulations of the Oseen proble In this tutorial, we will see how to use an augmented Lagrangian formulation to precondition the Oseen problem, i.e. .. math:: - - \text{Given }\vec{\beta}\in \mathbb{R}^3 \text{ find } (\vec{u},p) \in [H^1_{0}(\Omega)]^d\times L^2(\Omega) \text{ s.t. } - + + \text{Given } \vec{\beta} \in \mathbb{R}^3 \text{ find } (\vec{u}, p) \in [H^1_{0}(\Omega)]^d \times L^2(\Omega) \text{ s.t. } + \begin{cases} - \nu (\nabla \vec{u},\nabla \vec{v})_{L^2(\Omega)} + (\nabla\cdot \vec{v}, p)_{L^2(\Omega)} -(\nabla \vec{u}\vec{\beta},\vec{v})_{L^2(\Omega)} + (div(\vec{u}),div(\vec{v}))_{L^2(\Omega)} = (\vec{f},\vec{v})_{L^2(\Omega)} \qquad \forall v\in H^1_{0}(\Omega)\\ - (\nabla\cdot \vec{u},q)_{L^2(\Omega)} = 0 \qquad \froall q\in L^2(\Omega) + \nu (\nabla \vec{u}, \nabla \vec{v})_{L^2(\Omega)} + (\nabla \cdot \vec{v}, p)_{L^2(\Omega)} - (\nabla \vec{u} \vec{\beta}, \vec{v})_{L^2(\Omega)} + (\text{div}(\vec{u}), \text{div}(\vec{v}))_{L^2(\Omega)} = (\vec{f}, \vec{v})_{L^2(\Omega)} \quad \forall v \in H^1_{0}(\Omega) \\ + (\nabla \cdot \vec{u}, q)_{L^2(\Omega)} = 0 \quad \forall q \in L^2(\Omega) \end{cases} Let us begin defining the parameters of the problem. :: diff --git a/docs/src/PETScPC/stokes.py.rst b/docs/src/PETScPC/stokes.py.rst index fba4dce..9de24dd 100755 --- a/docs/src/PETScPC/stokes.py.rst +++ b/docs/src/PETScPC/stokes.py.rst @@ -10,7 +10,7 @@ In particular, we will consider a Bernardi-Raugel inf-sup stable discretization \begin{cases} (\nabla \vec{u},\nabla \vec{v})_{L^2(\Omega)} + (\nabla\cdot \vec{v}, p)_{L^2(\Omega)} = (\vec{f},\vec{v})_{L^2(\Omega)} \qquad \forall v\in H^1_{0}(\Omega)\\ - (\nabla\cdot \vec{u},q)_{L^2(\Omega)} = 0 \qquad \froall q\in L^2(\Omega) + (\nabla\cdot \vec{u},q)_{L^2(\Omega)} = 0 \qquad \forall q\in L^2(\Omega) \end{cases} Such a discretization can easily be constructed using NGSolve as follows: :: diff --git a/docs/src/PETScSNES/hyperelasticity.py.rst b/docs/src/PETScSNES/hyperelasticity.py.rst index 6746732..88e108d 100644 --- a/docs/src/PETScSNES/hyperelasticity.py.rst +++ b/docs/src/PETScSNES/hyperelasticity.py.rst @@ -47,6 +47,9 @@ A discretization of this energy leads to a non-linear problem that we solve usin a += Variation(NeoHooke(C(u)).Compile()*dx) a += ((Id(3)+Grad(u.Trace()))*force)*v*ds("top") +Once we have defined the energy and the weak form, we can solve the non-linear problem using `PETSc SNES`. +In particular, we will use a Newton method with line search, and precondition the linear solves with a direct solver. :: + from ngsPETSc import NonLinearSolver gfu_petsc = GridFunction(fes) gfu_ngs = GridFunction(fes) @@ -89,4 +92,3 @@ We compare the performance of the two solvers, in the following table: - 10 This suggests that while NGS non-linear solver when finely tuned performs as well as PETSc SNES, it is more sensitive to the choice of the damping factor. In this case, a damping factor of 0.3 was found to be the best choice. -""" \ No newline at end of file