15 #if !defined(RESIDUAL_BASED_BLOCK_BUILDER_AND_SOLVER_WITH_CONSTRAINTS_FOR_CHIMERA)
16 #define RESIDUAL_BASED_BLOCK_BUILDER_AND_SOLVER_WITH_CONSTRAINTS_FOR_CHIMERA
19 #include <unordered_set>
20 #include <unordered_map>
68 template <
class TSparseSpace,
99 typename TLinearSolver::Pointer pNewLinearSystemSolver)
123 mL.resize(0,0,
false);
139 std::string
Info()
const override
141 return "ResidualBasedBlockBuilderAndSolverWithConstraintsForChimera";
184 mL(eq_id, eq_id) = 1.0;
190 mL(eq_id, eq_id) = 1.0;
197 typename TSchemeType::Pointer pScheme,
206 double start_constraints = OpenMPUtils::GetCurrentTime();
210 SparseMatrixMultiplicationUtility::TransposeMatrix<TSystemMatrixType, TSystemMatrixType>(L_transpose_matrix,
mL, 1.0);
214 TSparseSpace::Copy(b_modified, rb);
215 b_modified.resize(0,
false);
219 L_transpose_matrix.resize(0, 0,
false);
222 auxiliar_A_matrix.resize(0, 0,
false);
224 double max_diag = 0.0;
227 max_diag =
std::max(std::abs(rA(
i,
i)), max_diag);
230 #pragma omp parallel for
236 rA(slave_equation_id, slave_equation_id) = max_diag;
237 rb[slave_equation_id] = 0.0;
240 const double stop_constraints = OpenMPUtils::GetCurrentTime();
241 KRATOS_INFO_IF(
"ResidualBasedBlockBuilderAndSolverWithConstraintsForChimera", this->
GetEchoLevel() >= 1 )<<
"Applying constraints time: " << stop_constraints - start_constraints << std::endl;
std::size_t IndexType
Definition of the index type.
Definition: builder_and_solver.h:76
TSparseSpace::VectorType TSystemVectorType
Definition of the vector size.
Definition: builder_and_solver.h:85
TSparseSpace::MatrixType TSystemMatrixType
Definition of the sparse matrix.
Definition: builder_and_solver.h:82
int GetEchoLevel() const
It returns the echo level.
Definition: builder_and_solver.h:674
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
MasterSlaveConstraintContainerType & MasterSlaveConstraints(IndexType ThisIndex=0)
Definition: model_part.h:654
Current class provides an implementation for standard builder and solving operations.
Definition: residualbased_block_builder_and_solver.h:82
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: residualbased_block_builder_and_solver.h:1081
std::vector< IndexType > mSlaveIds
This is vector containing the rigid movement of the constraint.
Definition: residualbased_block_builder_and_solver.h:1220
std::unordered_set< IndexType > mInactiveSlaveDofs
The equation ids of the master.
Definition: residualbased_block_builder_and_solver.h:1222
virtual void BuildMasterSlaveConstraints(ModelPart &rModelPart)
Definition: residualbased_block_builder_and_solver.h:1384
TSystemMatrixType mT
Definition: residualbased_block_builder_and_solver.h:1218
virtual void ConstructMasterSlaveConstraintsStructure(ModelPart &rModelPart)
Definition: residualbased_block_builder_and_solver.h:1301
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_block_builder_and_solver.h:107
std::vector< IndexType > mMasterIds
The equation ids of the slaves.
Definition: residualbased_block_builder_and_solver.h:1221
Current class provides an implementation for applying the chimera constraints that is enforcing conti...
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:73
TSystemMatrixType mL
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:156
void BuildMasterSlaveConstraints(ModelPart &rModelPart) override
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:174
BaseType::TSchemeType TSchemeType
Definition of the classes from the base class.
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:85
ResidualBasedBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition of the base class.
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:79
BaseType::TSystemMatrixType TSystemMatrixType
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:86
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:120
BaseType::TSystemVectorType TSystemVectorType
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:87
KRATOS_CLASS_POINTER_DEFINITION(ResidualBasedBlockBuilderAndSolverWithConstraintsForChimera)
~ResidualBasedBlockBuilderAndSolverWithConstraintsForChimera()=default
void ApplyConstraints(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
Applies the constraints with master-slave relation matrix.
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:196
BaseType::IndexType IndexType
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:82
std::string Info() const override
Turn back information as a string.
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:139
ResidualBasedBlockBuilderAndSolverWithConstraintsForChimera(typename TLinearSolver::Pointer pNewLinearSystemSolver)
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:98
void ConstructMasterSlaveConstraintsStructure(ModelPart &rModelPart) override
Definition: residualbased_block_builder_and_solver_with_constraints_for_chimera.h:165
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
static void MatrixMultiplication(const AMatrix &rA, const BMatrix &rB, CMatrix &rC)
Matrix-matrix product C = A·B @detail This method uses a template for each matrix.
Definition: sparse_matrix_multiplication_utility.h:117
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
static double max(double a, double b)
Definition: GeometryFunctions.h:79
void Mult(TSpaceType &dummy, typename TSpaceType::MatrixType &rA, typename TSpaceType::VectorType &rX, typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:98
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
integer i
Definition: TensorModule.f:17