---
name: "problem_mixed"
section: "2rheolef"
platform: "linux"
package: "librheolef-dev"
version: "7.2-4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/problem_mixed"
---

# problem\_mixed(2rheolef)

linear solver (rheolef-7.2)

## NAME

problem\_mixed - linear solver (rheolef-7.2)

## DESCRIPTION

The `problem_mixed` class solves a given linear mixed system for PDEs in variational formulation.

Mixed problem appear in many applications such as the Stokes or the nearly incompressible elasticity. Let `Xh` and `Qh` be two finite element **space(2)**. Let `a: Xh*Xh --> IR`, `b: Xh*Qh --> IR` and `c: Xh*Qh --> IR` be three bilinear **form(2)**. The system writes:

```
    [ A  B^T ] [ uh ]   [ lh ]
    [        ] [    ] = [    ]
    [ B  -C  ] [ ph ]   [ kh ]
```

 where `A`, `B` and `C` are the three operators associated to `a`, `b` and `c`, respectively, and `lh in Xh` and `kh in Qh` are the two given right-hand-sides. The `c` bilinear form is called the stabilization, and could be zero.

The degrees of freedom are split between *unknown* degrees of freedom and *blocked* one. See also **form(2)** and **space(2)**. The linear system expands as:

```
    [ a.uu  a.ub   b.uu^T b.bu^T ] [ uh.u ]   [ lh.u ]
    [                            ] [      ] = [      ]
    [ a.bu  a.bb   b.ub^T b.bb^T ] [ uh.b ]   [ lh.b ]
    [                            ] [      ] = [      ]
    [ b.uu  b.ub  -c.uu  -c.ub   ] [ ph.u ]   [ kh.u ]
    [                            ] [      ] = [      ]
    [ b.bu  a.bb  -c.bu  -c.bb   ] [ ph.b ]   [ kh.b ]
```

 Both the `uh.b` and `ph.b` are blocked degrees of freedom: their values are prescribed and the corresponding values are move to the right-hand-side of the system that reduces to:

```
    a.uu*uh.u + b.uu^T*ph.u = lh.u - a.ub*uh.b - b.bu^T*ph.b
    b.uu*uh.u -   c.uu*ph.u = kh.u - b.ub*uh.b +   c.ub*ph.b
```

 This writes:

```
    problem_mixed p (a, b, c);
    p.solve (lh, kh, uh, ph);
```

 When `c` is zero, the last `c` argument could be omitted, as:

```
    problem_mixed p (a, b);
```

 Observe that, during the `p.solve` call, `uh` is both an input variable, for the `uh.b` contribution to the right-hand-side, and an output variable, with `uh.u`. This is also true for `ph` when `ph.b` is non-empty. The previous linear system is solved via the **solver\_abtb(4)** class: the `problem_mixed` class is simply a convenient wrapper around the **solver\_abtb(4)** one.

## EXAMPLE

See **stokes\_cavity.cc**

## OPTIONS

The **solver\_abtb(4)** could be customized via the constructor optional **solver\_option(4)** argument:

```
    problem p (a, b, sopt);
```

 or

```
    problem p (a, b, c, sopt);
```

 This **solver\_abtb(4)** is used to switch between a direct and an iterative method for solving the mixed system.

## METRIC

A *metric* in the `Qh` space could also be provided:

```
    p.set_metric (mp);
```

 By default, when nothing has been specified, this metric is the L2 scalar product for the `Qh` space.

When using a direct **solver(4)** method, this metric is used to add a constraint when the multiplier is known up to a constant. For instance, when the pressure is known up to a constant, a constraint for a zero average pressure is automatically added to the linear system.

When using an iterative **solver(4)** method, this metric is used as a Schur complement preconditionner, see **solver\_abtb(4)** for details. The **solver(4)** associated to this Schur preconditionner could be customized by specifying the **solver(4)** associated to the **problem(2)** related to the `mp` operator:

```
p.set_preconditionner (pmp);
```

 Note this preconditionner subproblem could be solved either by a direct or an iterative method, while the whole mixed problem solver is iterative.

## INNER SOLVER

When using an iterative **solver\_abtb(4)**, the inner **problem(2)** related to the `a` operator could also be customized by specifying its **solver(4)** :

```
    p.set_inner_problem (pa);
```

 Note this inner subproblem could be solved either by a direct or an iterative method, while the whole mixed problem solver is iterative.

## IMPLEMENTATION

This documentation has been generated from file main/lib/problem\_mixed.h

The `problem_mixed` class is simply an alias to the **problem\_mixed\_basic class**

```
typedef problem_mixed_basic<Float> problem_mixed;
```

**The problem\_mixed\_basic class provides a generic interface:**

```
template <class T, class M = rheo_default_memory_model>
class problem_mixed_basic {
public:
// typedefs:
  typedef typename solver_basic<T,M>::size_type         size_type;
  typedef typename solver_basic<T,M>::determinant_type  determinant_type;
// allocators:
  problem_mixed_basic();
  problem_mixed_basic(
      const form_basic<T,M>& a,
      const form_basic<T,M>& b,
      const solver_option& sopt = solver_option());
  problem_mixed_basic(
      const form_basic<T,M>& a,
      const form_basic<T,M>& b,
      const form_basic<T,M>& c,
      const solver_option& sopt = solver_option());
// accessor:
  void solve (const field_basic<T,M>& lh, const field_basic<T,M>& kh,
                    field_basic<T,M>& uh,       field_basic<T,M>& ph) const;
  bool initialized() const;
  const solver_option&     option() const;
// modifiers:
  void set_metric          (const form& mp);
  void set_preconditionner (const problem& pmp);
  void set_inner_problem   (const problem& pa);
```

```
};
```

## AUTHOR

**Pierre  Saramito  \<Pierre.Saramito@imag.fr\>**

## COPYRIGHT

**Copyright   (C)  2000-2018  Pierre  Saramito  \<Pierre.Saramito@imag.fr\>** **GPLv3+: GNU GPL version 3 or later  \<http://gnu.org/licenses/gpl.html\>.** **This  is  free  software:  you  are free to change and redistribute it.** **There is NO WARRANTY, to the extent permitted by law.**
