/usr/include/trilinos/Teko_ALOperator.hpp is in libtrilinos-teko-dev 12.4.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | /*
* Author: Zhen Wang
* Email: wangz@ornl.gov
* zhen.wang@alum.emory.edu
*/
#ifndef __Teko_ALOperator_hpp__
#define __Teko_ALOperator_hpp__
#include "Teko_BlockedEpetraOperator.hpp"
#include "Teko_Utilities.hpp"
namespace Teko
{
namespace NS
{
/** \brief Sparse matrix vector multiplication
* for augmented Lagrangian-based preconditioners.
*
* This class implements sparse matrix vector multiplication
* for augmented Lagrangian-based preconditioners.
* Details can be found in the following papers:
*
* [1] M. Benzi and M. A. Olshanskii,
* An Augmented Lagrangian-Based Approach to the Oseen Problem,
* SIAM J. Scientific Computing, 28 (2006), pp. 2095-2113.
*
* [2] Benzi, M. A. Olshanskii and Z. Wang,
* Modified Augmented Lagrangian Preconditioners for the Incompressible Navier-Stokes Equations,
* International Journal for Numerical Methods in Fluids, 66 (2011), pp. 486-508.
*
* Suppose we are solving the following linear system:
*
* \f$
* \left[ \begin{array}{cc}
* A & B^T \\
* B & -C
* \end{array} \right]
* \left[ \begin{array}{c}
* u \\
* p
* \end{array} \right]
* =
* \left[ \begin{array}{c}
* f \\
* g
* \end{array} \right].
* \f$
*
* The equivalent augmented Lagrangian formulation is:
*
* \f$
* \left[ \begin{array}{cc}
* A + \gamma B^T W^{-1} B & B^T - \gamma B^T W^{-1} C \\
* B & -C
* \end{array} \right]
* \left[ \begin{array}{c}
* u \\
* p
* \end{array} \right]
* =
* \left[ \begin{array}{c}
* f + \gamma B^T W^{-1} g \\
* g
* \end{array} \right]
* \f$
*
* or
*
* \f$
* \widehat{\mathcal{A}} x = \hat{b}.
* \f$
*
* Here \f$ W \f$ can be take as the diagonal of the pressure
* mass matrix and \f$ \gamma \f$ is a positive number.
*
* This class implements the matrix vector product with
* \f$ \widehat{\mathcal{A}} \f$.
*/
class ALOperator : public Teko::Epetra::BlockedEpetraOperator
{
public:
/** Build an augmented Lagrangian operator based on a vector of vector
* of global IDs.
*
* \param[in] vars
* Vector of vectors of global ids specifying
* how the operator is to be blocked.
* \param[in] content
* Operator to be blocked
* \param[in] pressureMassMatrix
* Pressure mass matrix
* \param[in] gamma
* Augmentation parameter
* \param[in] label
* Label for name the operator
*/
ALOperator(const std::vector<std::vector<int> > & vars,
const Teuchos::RCP<Epetra_Operator> & content,
LinearOp pressureMassMatrix,
double gamma = 0.05, const std::string & label = "<ANYM>");
/** Build a modified augmented Lagrangian operator based on a vector of vector
* of global IDs.
*
* \param[in] vars
* Vector of vectors of global ids specifying
* how the operator is to be blocked.
* \param[in] content
* Operator to be blocked
* \param[in] gamma
* Augmentation parameter
* \param[in] label
* Name of the operator
*/
ALOperator(const std::vector<std::vector<int> > & vars,
const Teuchos::RCP<Epetra_Operator> & content,
double gamma = 0.05, const std::string & label = "<ANYM>");
// Destructor
virtual
~ALOperator()
{
}
/** Set the pressure mass matrix.
*
* \param[in] pressureMassMatrix
* Pressure mass matrix.
*
*/
void
setPressureMassMatrix(LinearOp pressureMassMatrix);
/**
* \returns Pressure mass matrix that can be used to construct preconditioner.
*/
const LinearOp &
getPressureMassMatrix() const
{
return pressureMassMatrix_;
}
/** Set gamma.
*
* \param[in] gamma
* Augmentation parameter.
*/
void
setGamma(double gamma);
/**
* \returns Gamma
* Augmentation parameter.
*/
const double &
getGamma() const
{
return gamma_;
}
/**
* \param[in] b
* Right-hand side.
* \param[out] bAugmented
* Augmented right-hand side.
*/
void
augmentRHS(const Epetra_MultiVector & b, Epetra_MultiVector & bAugmented);
/**
* \returns Number of rows.
*/
int
getNumberOfBlockRows() const
{
return numBlockRows_;
}
/**
* Force a rebuild of the blocked operator from the stored
* content operator.
*/
virtual void
RebuildOps()
{
BuildALOperator();
}
/** Get the (i,j) block of the original (non-augmented) operator.
*
* \param[in] i
* Row index.
* \param[in] j
* Column index.
*/
const Teuchos::RCP<const Epetra_Operator>
GetBlock(int i, int j) const;
protected:
/**
* AL operator.
*/
Teuchos::RCP<Thyra::LinearOpBase<double> > alOperator_;
/**
* Operator for augmenting the right-hand side.
*/
Teuchos::RCP<Thyra::LinearOpBase<double> > alOperatorRhs_;
/**
* Pressure mass matrix and its inverse.
*/
LinearOp pressureMassMatrix_;
/**
* Inverse of the pressure mass matrix.
*/
LinearOp invPressureMassMatrix_;
/**
* Augmentation parameter.
*/
double gamma_;
/**
* Dimension of the problem.
*/
int dim_;
/**
* Number of block rows.
*/
int numBlockRows_;
/**
* Check dimension. Only implemente for 2D and 3D problems.
*/
void
checkDim(const std::vector<std::vector<int> > & vars);
/**
* Build AL operator.
*/
void
BuildALOperator();
};
} // end namespace NS
} // end namespace Teko
#endif /* __Teko_ALOperator_hpp__ */
|