KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
mvqn_recursive_convergence_accelerator.hpp
Go to the documentation of this file.
1 // | / |
2 // ' / __| _` | __| _ \ __|
3 // . \ | ( | | ( |\__ \.
4 // _|\_\_| \__,_|\__|\___/ ____/
5 // Multi-Physics
6 //
7 // License: BSD License
8 // Original author: Ruben Zorrilla
9 //
10 
11 #if !defined(KRATOS_MVQN_RECURSIVE_CONVERGENCE_ACCELERATOR)
12 #define KRATOS_MVQN_RECURSIVE_CONVERGENCE_ACCELERATOR
13 
14 /* System includes */
15 
16 /* External includes */
17 
18 /* Project includes */
22 #include "utilities/svd_utils.h"
23 
24 
25 namespace Kratos
26 {
30 
34 
38 
42 
45 
48 template<class TSpace>
50 {
51 public:
52 
55  typedef typename std::unique_ptr< JacobianEmulator<TSpace> > Pointer;
56 
57  typedef typename TSpace::VectorType VectorType;
58  typedef typename TSpace::VectorPointerType VectorPointerType;
59 
60  typedef typename TSpace::MatrixType MatrixType;
61  typedef typename TSpace::MatrixPointerType MatrixPointerType;
65 
69 
70 
75  JacobianEmulator( Pointer&& OldJacobianEmulatorPointer )
76  {
77  mpOldJacobianEmulator = std::unique_ptr<JacobianEmulator<TSpace>>(std::move(OldJacobianEmulatorPointer));
78  }
79 
84  JacobianEmulator( Pointer&& OldJacobianEmulatorPointer, const unsigned int EmulatorBufferSize )
85  {
86  mpOldJacobianEmulator = std::unique_ptr<JacobianEmulator<TSpace> >(std::move(OldJacobianEmulatorPointer));
87 
88  // Get the last pointer out of buffer
89  if(EmulatorBufferSize > 1) {
90  JacobianEmulator* p = (mpOldJacobianEmulator->mpOldJacobianEmulator).get();
91 
92  for(unsigned int i = 1; i < (EmulatorBufferSize); i++) {
93  if(i == EmulatorBufferSize-1) {
94  (p->mpOldJacobianEmulator).reset();
95  } else {
96  p = (p->mpOldJacobianEmulator).get();
97  }
98  }
99  } else { // If Jacobian buffer size equals 1 directly destroy the previous one
100  (mpOldJacobianEmulator->mpOldJacobianEmulator).reset();
101  }
102  }
103 
109 
114  {
115  mpOldJacobianEmulator = rOther.mpOldJacobianEmulator;
116  }
117 
121  virtual ~JacobianEmulator() {}
122 
126 
130 
137  const VectorPointerType pWorkVector,
138  VectorPointerType pProjectedVector)
139  {
140  const auto data_cols = this->GetNumberOfDataCols();
141 
142  // Security check for the empty observation matrices case (when no correction has been done in the previous step)
143  if (data_cols == 0) {
144  if (mpOldJacobianEmulator != nullptr) { // If it is available, consider the previous step Jacobian
145  mpOldJacobianEmulator->ApplyJacobian(pWorkVector, pProjectedVector);
146  } else { // When the JacobianEmulator has no PreviousJacobianEmulator consider minus the identity matrix as inverse Jacobian
147  TSpace::Assign(*pProjectedVector, -1.0, *pWorkVector);
148  }
149  } else {
150  const unsigned int residual_size = this->GetResidualSize();
151 
152  // Set V and trans(V)
153  MatrixPointerType pV = Kratos::make_shared<MatrixType>(residual_size, data_cols);
154  MatrixPointerType pVtrans = Kratos::make_shared<MatrixType>(data_cols,residual_size);
155  for (std::size_t i = 0; i < data_cols; ++i){
156  const auto i_row = mJacobianObsMatrixV[i];
157  for (std::size_t j = 0; j < residual_size; ++j){
158  (*pV)(j, i) = i_row(j);
159  (*pVtrans)(i, j) = i_row(j);
160  }
161  }
162 
163  // Set trans(V)*V
164  MatrixPointerType pVtransV = Kratos::make_shared<MatrixType>(data_cols, data_cols);
165  for (std::size_t i_row = 0; i_row < data_cols; ++i_row){
166  for (std::size_t i_col = 0; i_col < data_cols; ++i_col){
167  (*pVtransV)(i_row, i_col) = TSpace::Dot(mJacobianObsMatrixV[i_row],mJacobianObsMatrixV[i_col]);
168  }
169  }
170 
171  // Compute trans(V)*pWorkVector
172  VectorPointerType pVtransWorkVect = Kratos::make_shared<VectorType>(data_cols);
173  TSpace::Mult(*pVtrans,*pWorkVector,*pVtransWorkVect);
174 
175  // Do the QR decomp of trans(V)*V and solve ((trans(V)*V)^-1)*trans(V)*res
177  qr_decomposition.Compute(*pVtransV);
178  VectorPointerType pLambda = Kratos::make_shared<VectorType>(data_cols);
179  qr_decomposition.Solve(*pVtransWorkVect, *pLambda);
180 
181  // Compute (res - V*Lambda). Note that it is save in pY
182  VectorPointerType pY = Kratos::make_shared<VectorType>(residual_size);
183  TSpace::Mult(*pV,*pLambda,*pY);
184  TSpace::UnaliasedAdd(*pY, -1.0, *pWorkVector);
185 
186  // Project over the previous step Jacobian
187  if (mpOldJacobianEmulator == nullptr) {
188  TSpace::Copy(*pY, *pProjectedVector); // Consider minus the identity as previous step Jacobian
189  } else {
190  VectorPointerType pYminus(new VectorType(*pY));
191  TSpace::Assign(*pYminus, -1.0, *pY);
192  mpOldJacobianEmulator->ApplyJacobian(pYminus, pProjectedVector); // The minus comes from the fact that we want to apply r_k - V_k*zQR
193  }
194 
195  // w = W_k*z
196  VectorPointerType pW(new VectorType(residual_size));
197  TSpace::SetToZero(*pW);
198  for (unsigned int j = 0; j < data_cols; ++j) {
199  // TSpace::UnaliasedAdd(*pW, (*pzQR)(j), mJacobianObsMatrixW[j]);
200  TSpace::UnaliasedAdd(*pW, (*pLambda)(j), mJacobianObsMatrixW[j]);
201  }
202 
203  TSpace::UnaliasedAdd(*pProjectedVector, 1.0, *pW);
204  }
205  }
206 
220  const VectorType& rNewColV,
221  const VectorType& rNewColW,
222  const double AbsCutOff = 1e-8)
223  {
224  // Add the provided iformation to the observation matrices
225  mJacobianObsMatrixV.push_back(rNewColV);
226  mJacobianObsMatrixW.push_back(rNewColW);
227 
228  // Loop to store a std::vector<VectorType> type as Matrix type
229  const std::size_t data_cols = this->GetNumberOfDataCols();
230 
231  // Set trans(V)*V
232  MatrixPointerType ptransV_V = Kratos::make_shared<MatrixType>(data_cols, data_cols);
233  for (std::size_t i_row = 0; i_row < data_cols; ++i_row){
234  for (std::size_t i_col = 0; i_col < data_cols; ++i_col){
235  (*ptransV_V)(i_row, i_col) = TSpace::Dot(mJacobianObsMatrixV[i_row],mJacobianObsMatrixV[i_col]);
236  }
237  }
238 
239  // Perform the Singular Value Decomposition (SVD) of matrix trans(V)*V
240  // SVD decomposition of matrix A yields two orthogonal matrices "u_svd"
241  // and "v_svd" as well as a diagonal matrix "w_svd" cotaining matrix
242  // A eigenvalues such that A = u_svd * w_svd * v_svd
243  MatrixType u_svd; // Orthogonal matrix (m x m)
244  MatrixType w_svd; // Rectangular diagonal matrix (m x n)
245  MatrixType v_svd; // Orthogonal matrix (n x n)
246  const std::string svd_type = "Jacobi"; // SVD decomposition type
247  const double svd_rel_tol = 1.0e-6; // Relative tolerance of the SVD decomposition (it will be multiplied by the input matrix norm)
248  SVDUtils<double>::SingularValueDecomposition(*ptransV_V, u_svd, w_svd, v_svd, svd_type, svd_rel_tol);
249 
250  // Get the eigenvalues vector. Remember that eigenvalues
251  // of trans(A)*A are equal to the eigenvalues of A^2
252  std::vector<double> eig_vector(data_cols);
253  for (std::size_t i_col = 0; i_col < data_cols; ++i_col){
254  const double i_col_eig = std::sqrt(w_svd(i_col,i_col));
255  eig_vector[i_col] = i_col_eig;
256  }
257 
258  // Get the maximum and minimum eigenvalues
259  double max_eig_V = 0.0;
260  double min_eig_V = std::numeric_limits<double>::max();
261  for (std::size_t i_col = 0; i_col < data_cols; ++i_col){
262  if (max_eig_V < eig_vector[i_col]) {
263  max_eig_V = eig_vector[i_col];
264  } else if (min_eig_V > eig_vector[i_col]) {
265  min_eig_V = eig_vector[i_col];
266  }
267  }
268 
269  // Check the representativity of each eigenvalue and its value.
270  // If its value is close to zero or out of the representativity
271  // the correspondent data columns are dropped from both V and W.
272  if (min_eig_V < AbsCutOff * max_eig_V){
273  KRATOS_WARNING("MVQNRecursiveJacobianConvergenceAccelerator")
274  << "Dropping info for eigenvalue " << min_eig_V << " (tolerance " << AbsCutOff * max_eig_V << " )" << std::endl;
275  mJacobianObsMatrixV.pop_back();
276  mJacobianObsMatrixW.pop_back();
277  return false;
278  }
279  // }
280 
281  return true;
282  }
283 
295  const VectorType& rNewColV,
296  const VectorType& rNewColW,
297  const double AbsCutOffEps = 1e-8)
298  {
299  // std::cout << "DropAndAppendDataColumns()" << std::endl;
300  const bool info_added = this->AppendDataColumns(rNewColV, rNewColW, AbsCutOffEps);
301 
302  // If a new column has been added, drop the oldest data
303  if (info_added){
304  // Move the current data (oldest data is dropped)
305  for (unsigned int i = 0; i < (this->GetResidualSize() - 1); ++i) {
306  mJacobianObsMatrixV[i] = mJacobianObsMatrixV[i+1];
307  mJacobianObsMatrixW[i] = mJacobianObsMatrixW[i+1];
308  }
309  // Pop the last term (keep the amount of data columns as the problem size)
310  mJacobianObsMatrixV.pop_back();
311  mJacobianObsMatrixW.pop_back();
312  }
313 
314  return info_added;
315  }
316 
324  inline std::size_t GetNumberOfDataCols() const
325  {
326  return mJacobianObsMatrixV.size();
327  }
328 
337  inline std::size_t GetResidualSize() const
338  {
339  return TSpace::Size(mJacobianObsMatrixV[0]);
340  }
341 
345 
349 
353 
357 
359 private:
362 
366 
367  Pointer mpOldJacobianEmulator; // Pointer to the old Jacobian
368 
369  std::vector<VectorType> mJacobianObsMatrixV; // Residual increment observation matrix
370  std::vector<VectorType> mJacobianObsMatrixW; // Solution increment observation matrix
371 
375 
379 
383 
387 
391 
395 
397 
398 }; /* Class JacobianEmulator */
399 
400 
407 template<class TSparseSpace, class TDenseSpace>
408 class MVQNRecursiveJacobianConvergenceAccelerator: public ConvergenceAccelerator<TSparseSpace, TDenseSpace> {
409 public:
413 
415  typedef typename BaseType::Pointer BaseTypePointer;
416 
418 
421 
424 
428 
433  explicit MVQNRecursiveJacobianConvergenceAccelerator(Parameters rConvAcceleratorParameters)
434  {
435  Parameters mvqn_recursive_default_parameters(R"(
436  {
437  "solver_type" : "MVQN_recursive",
438  "w_0" : 0.825,
439  "buffer_size" : 10,
440  "abs_cut_off_tol" : 1e-8,
441  "interface_block_newton" : false
442  }
443  )");
444 
445  rConvAcceleratorParameters.ValidateAndAssignDefaults(mvqn_recursive_default_parameters);
446 
447  mOmega_0 = rConvAcceleratorParameters["w_0"].GetDouble();
448  mAbsCutOff = rConvAcceleratorParameters["abs_cut_off_tol"].GetDouble();
449  mJacobianBufferSize = rConvAcceleratorParameters["buffer_size"].GetInt();
450  mConvergenceAcceleratorStep = 0;
451  mConvergenceAcceleratorIteration = 0;
452  mConvergenceAcceleratorFirstCorrectionPerformed = false;
453  }
454 
456  double OmegaInitial = 0.825,
457  unsigned int JacobianBufferSize = 10,
458  double AbsCutOff = 1e-8)
459  {
460  mOmega_0 = OmegaInitial;
461  mAbsCutOff = AbsCutOff;
462  mJacobianBufferSize = JacobianBufferSize;
463  mConvergenceAcceleratorStep = 0;
464  mConvergenceAcceleratorIteration = 0;
465  mConvergenceAcceleratorFirstCorrectionPerformed = false;
466  }
467 
472 
477 
481 
485 
490  void Initialize() override
491  {
492  KRATOS_TRY;
493 
494  mpCurrentJacobianEmulatorPointer = Kratos::make_unique<JacobianEmulator<TDenseSpace>>();
495 
496  KRATOS_CATCH( "" );
497  }
498 
504  void InitializeSolutionStep() override
505  {
506  KRATOS_TRY;
507 
508  mConvergenceAcceleratorStep += 1;
509  mConvergenceAcceleratorIteration = 0;
510 
511  if (mConvergenceAcceleratorStep <= mJacobianBufferSize) {
512  // Construct the inverse Jacobian emulator
513  mpCurrentJacobianEmulatorPointer = Kratos::make_unique<JacobianEmulator<TDenseSpace>>(std::move(mpCurrentJacobianEmulatorPointer));
514  } else {
515  // Construct the inverse Jacobian emulator considering the recursive elimination
516  mpCurrentJacobianEmulatorPointer = Kratos::make_unique<JacobianEmulator<TDenseSpace>>(std::move(mpCurrentJacobianEmulatorPointer), mJacobianBufferSize);
517  }
518 
519  KRATOS_CATCH( "" );
520  }
521 
529  const VectorType& rResidualVector,
530  VectorType& rIterationGuess) override
531  {
532  KRATOS_TRY;
533 
534  const auto problem_size = TSparseSpace::Size(rResidualVector);
535 
536  VectorPointerType pAuxResidualVector(new VectorType(rResidualVector));
537  VectorPointerType pAuxIterationGuess(new VectorType(rIterationGuess));
538  std::swap(mpResidualVector_1, pAuxResidualVector);
539  std::swap(mpIterationValue_1, pAuxIterationGuess);
540 
541  if (mConvergenceAcceleratorIteration == 0) {
542  if (mConvergenceAcceleratorFirstCorrectionPerformed == false) {
543  // The very first correction of the problem is done with a fixed point iteration
544  TSparseSpace::UnaliasedAdd(rIterationGuess, mOmega_0, *mpResidualVector_1);
545 
546  mConvergenceAcceleratorFirstCorrectionPerformed = true;
547  } else {
548  VectorPointerType pInitialCorrection(new VectorType(rResidualVector));
549 
550  // The first correction of the current step is done with the previous step inverse Jacobian approximation
551  mpCurrentJacobianEmulatorPointer->ApplyJacobian(mpResidualVector_1, pInitialCorrection);
552 
553  TSparseSpace::UnaliasedAdd(rIterationGuess, -1.0, *pInitialCorrection); // Recall the minus sign coming from the Taylor expansion of the residual (Newton-Raphson)
554  }
555  } else {
556  // Gather the new observation matrices column information
557  VectorPointerType pNewColV(new VectorType(*mpResidualVector_1));
558  VectorPointerType pNewColW(new VectorType(*mpIterationValue_1));
559 
560  TSparseSpace::UnaliasedAdd(*pNewColV, -1.0, *mpResidualVector_0); // NewColV = ResidualVector_1 - ResidualVector_0
561  TSparseSpace::UnaliasedAdd(*pNewColW, -1.0, *mpIterationValue_0); // NewColW = IterationValue_1 - IterationValue_0
562 
563  // Observation matrices information filling
564  bool info_added = false;
565  const std::size_t n_data_cols = mpCurrentJacobianEmulatorPointer->GetNumberOfDataCols();
566  if (n_data_cols < problem_size) {
567  info_added = (mpCurrentJacobianEmulatorPointer)->AppendDataColumns(*pNewColV, *pNewColW, mAbsCutOff);
568  } else {
569  info_added = (mpCurrentJacobianEmulatorPointer)->DropAndAppendDataColumns(*pNewColV, *pNewColW, mAbsCutOff);
570  }
571  KRATOS_WARNING_IF("MVQNRecursiveJacobianConvergenceAccelerator", !info_added) << "Information not added to the observation matrices." << std::endl;
572 
573  // Apply the current step inverse Jacobian emulator to the residual vector
574  VectorPointerType pIterationCorrection(new VectorType(rResidualVector));
575  mpCurrentJacobianEmulatorPointer->ApplyJacobian(mpResidualVector_1, pIterationCorrection);
576 
577  TSparseSpace::UnaliasedAdd(rIterationGuess, -1.0, *pIterationCorrection); // Recall the minus sign coming from the Taylor expansion of the residual (Newton-Raphson)
578  }
579 
580  KRATOS_CATCH( "" );
581  }
582 
588  {
589  KRATOS_TRY;
590 
591  // Variables update
592  mpIterationValue_0 = mpIterationValue_1;
593  mpResidualVector_0 = mpResidualVector_1;
594 
595  mConvergenceAcceleratorIteration += 1;
596 
597  KRATOS_CATCH( "" );
598  }
599 
603 
607 
611 
615 
617 private:
618 
621 
625 
626  double mOmega_0; // Relaxation factor for the initial fixed point iteration
627  double mAbsCutOff; // Tolerance for the absolute cut-off criterion
628  unsigned int mJacobianBufferSize; // User-defined Jacobian buffer-size
629  unsigned int mConvergenceAcceleratorStep; // Convergence accelerator steps counter
630  unsigned int mConvergenceAcceleratorIteration; // Convergence accelerator iteration counter
631  bool mConvergenceAcceleratorFirstCorrectionPerformed; // Indicates that the initial fixed point iteration has been already performed
632 
633  VectorPointerType mpResidualVector_0; // Previous iteration residual vector pointer
634  VectorPointerType mpResidualVector_1; // Current iteration residual vector pointer
635  VectorPointerType mpIterationValue_0; // Previous iteration guess pointer
636  VectorPointerType mpIterationValue_1; // Current iteration guess pointer
637 
638  JacobianEmulatorPointerType mpCurrentJacobianEmulatorPointer; // Current step Jacobian approximator pointer
639 
643 
647 
651 
655 
659 
663 
665 }; /* Class MVQNRecursiveJacobianConvergenceAccelerator */
666 
670 
674 
676 
677 } /* namespace Kratos.*/
678 
679 #endif /* KRATOS_MVQN_RECURSIVE_CONVERGENCE_ACCELERATOR defined */
Base class for convergence accelerators This class is intended to be the base of any convergence acce...
Definition: convergence_accelerator.h:43
Definition: dense_householder_qr_decomposition.h:45
void Compute(MatrixType &rInputMatrix) override
Compute the QR Computes the QR Decomposition (QR) of the given imput matrix Note that the input matri...
Definition: dense_householder_qr_decomposition.h:92
void Solve(MatrixType &rB, MatrixType &rX) const override
Solves the problem Ax=b Being A the input matrix, this method solves the problem Ax = b.
Definition: dense_householder_qr_decomposition.h:148
Jacobian emulator.
Definition: mvqn_recursive_convergence_accelerator.hpp:50
JacobianEmulator(const JacobianEmulator &rOther)
Definition: mvqn_recursive_convergence_accelerator.hpp:113
bool AppendDataColumns(const VectorType &rNewColV, const VectorType &rNewColW, const double AbsCutOff=1e-8)
Definition: mvqn_recursive_convergence_accelerator.hpp:219
TSpace::VectorType VectorType
Definition: mvqn_recursive_convergence_accelerator.hpp:57
JacobianEmulator()
Definition: mvqn_recursive_convergence_accelerator.hpp:108
void ApplyJacobian(const VectorPointerType pWorkVector, VectorPointerType pProjectedVector)
Definition: mvqn_recursive_convergence_accelerator.hpp:136
std::unique_ptr< JacobianEmulator< TSpace > > Pointer
Definition: mvqn_recursive_convergence_accelerator.hpp:55
TSpace::VectorPointerType VectorPointerType
Definition: mvqn_recursive_convergence_accelerator.hpp:58
TSpace::MatrixType MatrixType
Definition: mvqn_recursive_convergence_accelerator.hpp:60
std::size_t GetNumberOfDataCols() const
Get the Number Of Data Cols object This function returns the number of data columns stored....
Definition: mvqn_recursive_convergence_accelerator.hpp:324
virtual ~JacobianEmulator()
Definition: mvqn_recursive_convergence_accelerator.hpp:121
JacobianEmulator(Pointer &&OldJacobianEmulatorPointer)
Definition: mvqn_recursive_convergence_accelerator.hpp:75
TSpace::MatrixPointerType MatrixPointerType
Definition: mvqn_recursive_convergence_accelerator.hpp:61
JacobianEmulator(Pointer &&OldJacobianEmulatorPointer, const unsigned int EmulatorBufferSize)
Definition: mvqn_recursive_convergence_accelerator.hpp:84
std::size_t GetResidualSize() const
Get the Residual Size object This function returns the interface residual size. Since the residual si...
Definition: mvqn_recursive_convergence_accelerator.hpp:337
bool DropAndAppendDataColumns(const VectorType &rNewColV, const VectorType &rNewColW, const double AbsCutOffEps=1e-8)
Definition: mvqn_recursive_convergence_accelerator.hpp:294
Recursive MVQN acceleration scheme Recursive MultiVectorQuasiNewton convergence accelerator....
Definition: mvqn_recursive_convergence_accelerator.hpp:408
MVQNRecursiveJacobianConvergenceAccelerator(const MVQNRecursiveJacobianConvergenceAccelerator &rOther)=delete
MVQNRecursiveJacobianConvergenceAccelerator(Parameters rConvAcceleratorParameters)
Definition: mvqn_recursive_convergence_accelerator.hpp:433
BaseType::MatrixPointerType MatrixPointerType
Definition: mvqn_recursive_convergence_accelerator.hpp:423
void FinalizeNonLinearIteration() override
Do the MVQN variables update Updates the MVQN iteration variables for the next non-linear iteration.
Definition: mvqn_recursive_convergence_accelerator.hpp:587
virtual ~MVQNRecursiveJacobianConvergenceAccelerator()
Definition: mvqn_recursive_convergence_accelerator.hpp:476
JacobianEmulator< TDenseSpace >::Pointer JacobianEmulatorPointerType
Definition: mvqn_recursive_convergence_accelerator.hpp:417
MVQNRecursiveJacobianConvergenceAccelerator(double OmegaInitial=0.825, unsigned int JacobianBufferSize=10, double AbsCutOff=1e-8)
Definition: mvqn_recursive_convergence_accelerator.hpp:455
void InitializeSolutionStep() override
This method initializes the internal counters and constructs the previous step Jacobian emulator....
Definition: mvqn_recursive_convergence_accelerator.hpp:504
KRATOS_CLASS_POINTER_DEFINITION(MVQNRecursiveJacobianConvergenceAccelerator)
BaseType::MatrixType MatrixType
Definition: mvqn_recursive_convergence_accelerator.hpp:422
BaseType::VectorType VectorType
Definition: mvqn_recursive_convergence_accelerator.hpp:419
void UpdateSolution(const VectorType &rResidualVector, VectorType &rIterationGuess) override
Performs the solution update The correction is computed using an inverse Jacobian approximation obtai...
Definition: mvqn_recursive_convergence_accelerator.hpp:528
ConvergenceAccelerator< TSparseSpace, TDenseSpace > BaseType
Definition: mvqn_recursive_convergence_accelerator.hpp:414
BaseType::Pointer BaseTypePointer
Definition: mvqn_recursive_convergence_accelerator.hpp:415
BaseType::VectorPointerType VectorPointerType
Definition: mvqn_recursive_convergence_accelerator.hpp:420
void Initialize() override
Initialize the Jacobian emulator This method constructs the very first Jacobian emulator of the simul...
Definition: mvqn_recursive_convergence_accelerator.hpp:490
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
double GetDouble() const
This method returns the double contained in the current Parameter.
Definition: kratos_parameters.cpp:657
int GetInt() const
This method returns the integer contained in the current Parameter.
Definition: kratos_parameters.cpp:666
void ValidateAndAssignDefaults(const Parameters &rDefaultParameters)
This function is designed to verify that the parameters under testing match the form prescribed by th...
Definition: kratos_parameters.cpp:1306
static std::size_t SingularValueDecomposition(const MatrixType &InputMatrix, MatrixType &UMatrix, MatrixType &SMatrix, MatrixType &VMatrix, Parameters ThisParameters)
This function gives the SVD of a given mxn matrix (m>=n), returns U,S; where A=U*S*V.
Definition: svd_utils.h:103
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
TSparseSpace::VectorType VectorType
Definition: convergence_accelerator.h:50
TSparseSpace::VectorPointerType VectorPointerType
Definition: convergence_accelerator.h:53
TSparseSpace::MatrixPointerType MatrixPointerType
Definition: convergence_accelerator.h:54
TSparseSpace::MatrixType MatrixType
Definition: convergence_accelerator.h:51
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
#define KRATOS_WARNING(label)
Definition: logger.h:265
Vector VectorType
Definition: geometrical_transformation_utilities.h:56
Matrix MatrixType
Definition: geometrical_transformation_utilities.h:55
static double max(double a, double b)
Definition: GeometryFunctions.h:79
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
void Mult(TSpaceType &dummy, typename TSpaceType::MatrixType &rA, typename TSpaceType::VectorType &rX, typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:98
double Dot(SparseSpaceType &dummy, SparseSpaceType::VectorType &rX, SparseSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:85
void UnaliasedAdd(TSpaceType &dummy, typename TSpaceType::VectorType &x, const double A, const typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:170
void Assign(const Expression &rExpression, const IndexType EntityIndex, const IndexType EntityDataBeginIndex, TDataType &rValue, std::index_sequence< TIndex... >)
Definition: variable_expression_data_io.cpp:41
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
int j
Definition: quadrature.py:648
p
Definition: sensitivityMatrix.py:52
integer i
Definition: TensorModule.f:17
e
Definition: run_cpp_mpi_tests.py:31