11 #if !defined(KRATOS_TRILINOS_MVQN_RECURSIVE_CONVERGENCE_ACCELERATOR)
12 #define KRATOS_TRILINOS_MVQN_RECURSIVE_CONVERGENCE_ACCELERATOR
17 #include "Epetra_SerialDenseSolver.h"
49 template<
class TSpace>
56 typedef typename std::unique_ptr< TrilinosJacobianEmulator<TSpace> >
Pointer;
79 const Epetra_MpiComm& rEpetraCommunicator,
80 Pointer&& OldJacobianEmulatorPointer ) :
84 mpOldJacobianEmulator = std::unique_ptr<TrilinosJacobianEmulator<TSpace> >(std::move(OldJacobianEmulatorPointer));
92 const Epetra_MpiComm &rEpetraCommunicator,
93 Pointer &&OldJacobianEmulatorPointer,
94 const unsigned int EmulatorBufferSize) :
98 mpOldJacobianEmulator = std::unique_ptr<TrilinosJacobianEmulator<TSpace> >(std::move(OldJacobianEmulatorPointer));
101 if(EmulatorBufferSize > 1)
105 for(
unsigned int i = 1;
i < (EmulatorBufferSize);
i++)
107 if(
i == EmulatorBufferSize-1)
109 (
p->mpOldJacobianEmulator).reset();
113 p = (
p->mpOldJacobianEmulator).get();
128 const Epetra_MpiComm &rEpetraCommunicator) :
189 if (previous_iterations == 0)
209 Epetra_Map InterfaceMap(NumGlobalInterfaceDofs, NumLocalInterfaceDofs, IndexBase,
mrEpetraCommunicator);
212 auto pY(
new Epetra_FEVector(InterfaceMap));
213 auto pW(
new Epetra_FEVector(InterfaceMap));
216 Epetra_SerialDenseMatrix Vtrans_V(previous_iterations, previous_iterations);
218 for (
unsigned int i=0;
i<previous_iterations; ++
i)
222 for (
unsigned int j=
i+1;
j<previous_iterations; ++
j)
225 Vtrans_V(
j,
i) = Vtrans_V(
i,
j);
229 Epetra_SerialDenseVector Vtrans_r(previous_iterations);
230 Epetra_SerialDenseVector zSystemSol(previous_iterations);
232 for (
unsigned int i=0;
i<previous_iterations; ++
i)
237 Epetra_SerialDenseSolver EpetraSystemSolver;
238 EpetraSystemSolver.SetMatrix(Vtrans_V);
239 EpetraSystemSolver.SetVectors(zSystemSol,Vtrans_r);
240 EpetraSystemSolver.Solve();
242 TSpace::SetToZero(*pY);
243 for (
unsigned int j = 0;
j < previous_iterations; ++
j)
252 TSpace::Copy(*pY, *pProjectedVector);
262 TSpace::SetToZero(*pW);
263 for (
unsigned int j = 0;
j < previous_iterations; ++
j)
439 template<
class TSparseSpace,
class TDenseSpace>
468 const Epetra_MpiComm& rEpetraCommunicator,
473 Parameters mvqn_recursive_default_parameters(R
"(
475 "solver_type" : "MVQN_recursive",
478 "interface_block_newton" : false
493 const Epetra_MpiComm& rEpetraCommunicator,
494 const double OmegaInitial = 0.825,
495 const unsigned int JacobianBufferSize = 7 ):
virtual const DataCommunicator & GetDataCommunicator() const
Definition: communicator.cpp:340
MeshType & LocalMesh()
Returns the reference to the mesh storing all local entities.
Definition: communicator.cpp:245
Base class for convergence accelerators This class is intended to be the base of any convergence acce...
Definition: convergence_accelerator.h:43
SizeType NumberOfNodes() const
Definition: mesh.h:259
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Communicator & GetCommunicator()
Definition: model_part.h:1821
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
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
Jacobian emulator.
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:51
ModelPart & mrInterfaceModelPart
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:367
TSpace::VectorType VectorType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:58
TrilinosJacobianEmulator(const TrilinosJacobianEmulator &rOther)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:135
Pointer mpOldJacobianEmulator
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:370
std::unique_ptr< TrilinosJacobianEmulator< TSpace > > Pointer
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:56
const Epetra_MpiComm & mrEpetraCommunicator
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:368
TSpace::MatrixPointerType MatrixPointerType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:62
void AppendColToV(const VectorType &rNewColV)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:280
TrilinosJacobianEmulator(ModelPart &rInterfaceModelPart, const Epetra_MpiComm &rEpetraCommunicator, Pointer &&OldJacobianEmulatorPointer)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:78
void ApplyPrevStepJacobian(const VectorPointerType pWorkVector, VectorPointerType pProjectedVector)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:162
virtual ~TrilinosJacobianEmulator()
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:146
void ApplyJacobian(const VectorPointerType pWorkVector, VectorPointerType pProjectedVector)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:181
void AppendColToW(const VectorType &rNewColW)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:293
void DropAndAppendColToW(const VectorType &rNewColW)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:326
TrilinosJacobianEmulator(ModelPart &rInterfaceModelPart, const Epetra_MpiComm &rEpetraCommunicator)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:127
std::vector< VectorType > mJacobianObsMatrixW
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:373
std::vector< VectorType > mJacobianObsMatrixV
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:372
TrilinosJacobianEmulator(ModelPart &rInterfaceModelPart, const Epetra_MpiComm &rEpetraCommunicator, Pointer &&OldJacobianEmulatorPointer, const unsigned int EmulatorBufferSize)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:91
TSpace::MatrixType MatrixType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:61
TSpace::VectorPointerType VectorPointerType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:59
void DropAndAppendColToV(const VectorType &rNewColV)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:306
MVQN (MultiVectorQuasiNewton method) acceleration scheme Recursive MultiVectorQuasiNewton convergence...
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:441
void FinalizeNonLinearIteration() override
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:654
KRATOS_CLASS_POINTER_DEFINITION(TrilinosMVQNRecursiveJacobianConvergenceAccelerator)
unsigned int mConvergenceAcceleratorStep
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:699
VectorPointerType mpResidualVector_0
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:703
unsigned int mJacobianBufferSize
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:695
BaseType::Pointer BaseTypePointer
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:448
void UpdateSolution(const VectorType &rResidualVector, VectorType &rIterationGuess) override
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:588
VectorPointerType mpIterationValue_0
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:705
VectorPointerType mpIterationValue_1
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:706
BaseType::MatrixPointerType MatrixPointerType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:456
TrilinosJacobianEmulator< TSparseSpace >::Pointer JacobianEmulatorPointerType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:450
void InitializeSolutionStep() override
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:554
virtual ~TrilinosMVQNRecursiveJacobianConvergenceAccelerator()
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:525
ConvergenceAccelerator< TSparseSpace, TDenseSpace > BaseType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:447
unsigned int mProblemSize
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:697
TSparseSpace::VectorType VectorType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:452
TrilinosMVQNRecursiveJacobianConvergenceAccelerator(ModelPart &rInterfaceModelPart, const Epetra_MpiComm &rEpetraCommunicator, const double OmegaInitial=0.825, const unsigned int JacobianBufferSize=7)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:492
TSparseSpace::VectorPointerType VectorPointerType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:453
void Initialize() override
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:539
TrilinosMVQNRecursiveJacobianConvergenceAccelerator(ModelPart &rInterfaceModelPart, const Epetra_MpiComm &rEpetraCommunicator, Parameters rConvAcceleratorParameters)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:466
ModelPart & mrInterfaceModelPart
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:692
unsigned int mConvergenceAcceleratorIteration
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:700
JacobianEmulatorPointerType mpCurrentJacobianEmulatorPointer
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:708
VectorPointerType mpResidualVector_1
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:704
unsigned int mCurrentJacobianBufferSize
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:698
bool mConvergenceAcceleratorFirstCorrectionPerformed
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:701
double mOmega_0
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:694
const Epetra_MpiComm & mrEpetraCommunicator
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:693
BaseType::MatrixType MatrixType
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:455
TrilinosMVQNRecursiveJacobianConvergenceAccelerator(const TrilinosMVQNRecursiveJacobianConvergenceAccelerator &rOther)
Definition: trilinos_mvqn_recursive_convergence_accelerator.hpp:510
#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
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
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