ASPECT
block_stokes_preconditioner.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 - 2025 by the authors of the ASPECT code.
3 
4  This file is part of ASPECT.
5 
6  ASPECT is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2, or (at your option)
9  any later version.
10 
11  ASPECT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with ASPECT; see the file LICENSE. If not see
18  <http://www.gnu.org/licenses/>.
19 */
20 #ifndef aspect_block_stokes_preconditioner_h
21 #define aspect_block_stokes_preconditioner_h
22 
23 namespace aspect
24 {
25 
26  namespace internal
27  {
32  template <class AInvOperator, class SInvOperator, class BTOperator, class VectorType>
34  {
35  public:
43  const AInvOperator &A_inverse_operator,
44  const SInvOperator &S_inverse_operator,
45  const BTOperator &BT_operator);
46 
50  void vmult (VectorType &dst,
51  const VectorType &src) const;
52 
53  private:
58  const AInvOperator &A_inverse_operator;
59  const SInvOperator &S_inverse_operator;
60  const BTOperator &BT_operator;
61  };
62 
63 
64  template <class AInvOperator, class SInvOperator, class BTOperator, class VectorType>
67  const AInvOperator &A_inverse_operator,
68  const SInvOperator &S_inverse_operator,
69  const BTOperator &BT_operator)
70  :
71  A_inverse_operator (A_inverse_operator),
72  S_inverse_operator (S_inverse_operator),
73  BT_operator (BT_operator)
74  {}
75 
76 
77 
78  template <class AInvOperator, class SInvOperator, class BTOperator, class VectorType>
79  void
81  vmult (VectorType &dst,
82  const VectorType &src) const
83  {
84  typename VectorType::BlockType utmp(src.block(0));
85 
86  // first apply the Schur Complement inverse operator.
87  {
88  S_inverse_operator.vmult(dst.block(1),src.block(1));
89  dst.block(1) *= -1.0;
90  }
91 
92  // apply the top right block
93  {
94  BT_operator.vmult(utmp, dst.block(1)); // B^T or J^{up}
95  utmp *= -1.0;
96  utmp += src.block(0);
97  }
98 
99  A_inverse_operator.vmult(dst.block(0), utmp);
100  }
101  }
102 }
103 
104 #endif
void vmult(VectorType &dst, const VectorType &src) const
BlockSchurPreconditioner(const AInvOperator &A_inverse_operator, const SInvOperator &S_inverse_operator, const BTOperator &BT_operator)
Constructor.