Skip to content

Commit c69adba

Browse files
committed
remove support for nonzero initial lagrange multipliers
1 parent 1b77f80 commit c69adba

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

kratos/solving_strategies/builder_and_solvers/p_multigrid/augmented_lagrange_constraint_assembler.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void ApplyDirichletConditions(typename TSparse::MatrixType& rRelationMatrix,
3737
int Verbosity)
3838
{
3939
// Sanity checks.
40-
KRATOS_ERROR_IF_NOT(std::distance(itDofBegin, itDofEnd) == rRelationMatrix.size2());
40+
KRATOS_ERROR_IF_NOT(static_cast<typename TSparse::IndexType>(std::distance(itDofBegin, itDofEnd)) == rRelationMatrix.size2());
4141
KRATOS_ERROR_IF_NOT(rConstraintGaps.size() == rRelationMatrix.size1());
4242

4343
KRATOS_TRY
@@ -181,9 +181,8 @@ AugmentedLagrangeConstraintAssembler<TSparse,TDense>::AugmentedLagrangeConstrain
181181
mpImpl->mpPenaltyFunctor = std::make_unique<Scaling>(Settings["penalty_factor"]);
182182

183183
// Parse other algorithmic settings.
184-
Vector algorithmic_parameters(2);
185-
algorithmic_parameters[0] = Settings["initial_lagrange_multiplier"].Get<double>();
186-
algorithmic_parameters[1] = Settings["tolerance"].Get<double>();
184+
Vector algorithmic_parameters(1);
185+
algorithmic_parameters[0] = Settings["tolerance"].Get<double>();
187186
this->SetValue(this->GetAlgorithmicParametersVariable(), algorithmic_parameters);
188187
this->SetValue(NL_ITERATION_NUMBER, Settings["max_iterations"].Get<int>());
189188

@@ -306,7 +305,6 @@ void AugmentedLagrangeConstraintAssembler<TSparse,TDense>::Initialize(typename T
306305
using SparseUtils = SparseMatrixMultiplicationUtility;
307306
mpImpl->mpPenaltyFunctor->template Cache<TSparse>(rLhs);
308307
const typename TSparse::DataType penalty_factor = this->GetPenaltyFactor();
309-
const typename TSparse::DataType initial_lagrange_multiplier = this->GetInitialLagrangeMultiplier();
310308

311309
// Apply initial penalty- and lagrange terms to the left- and right hand sides.
312310
{
@@ -333,22 +331,9 @@ void AugmentedLagrangeConstraintAssembler<TSparse,TDense>::Initialize(typename T
333331
penalty_factor);
334332

335333
// Add terms to the RHS vector.
336-
typename TSparse::VectorType rhs_term(rRhs.size()),
337-
lagrange_multipliers(this->GetRelationMatrix().size1(),
338-
initial_lagrange_multiplier);
339-
340-
TSparse::UnaliasedAdd(lagrange_multipliers,
341-
-penalty_factor,
342-
this->GetConstraintGapVector());
343-
344-
TSparse::SetToZero(rhs_term);
345334
BalancedProduct<TSparse,TSparse,TSparse>(r_transpose_relation_matrix,
346-
lagrange_multipliers,
347-
rhs_term);
348-
349-
TSparse::UnaliasedAdd(rRhs,
350-
-1.0,
351-
rhs_term);
335+
this->GetConstraintGapVector(),
336+
rRhs);
352337
}
353338
KRATOS_CATCH("")
354339
}
@@ -436,7 +421,6 @@ Parameters AugmentedLagrangeConstraintAssembler<TSparse,TDense>::GetDefaultParam
436421
return Parameters(R"({
437422
"method" : "augmented_lagrange",
438423
"penalty_factor" : "norm",
439-
"initial_lagrange_multiplier" : 0.0,
440424
"tolerance" : 1e-6,
441425
"max_iterations" : 1e1,
442426
"verbosity" : 1

kratos/solving_strategies/builder_and_solvers/p_multigrid/augmented_lagrange_constraint_assembler.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,10 @@ class AugmentedLagrangeConstraintAssembler : public ConstraintAssembler<TSparse,
117117
/// @internal
118118
typename TSparse::DataType GetPenaltyFactor() const;
119119

120-
/// @internal
121-
typename TSparse::DataType GetInitialLagrangeMultiplier() const
122-
{
123-
return this->GetValue(AugmentedLagrangeConstraintAssembler::GetAlgorithmicParametersVariable())[0];
124-
}
125-
126120
/// @internal
127121
typename TSparse::DataType GetTolerance() const
128122
{
129-
return this->GetValue(AugmentedLagrangeConstraintAssembler::GetAlgorithmicParametersVariable())[1];
123+
return this->GetValue(AugmentedLagrangeConstraintAssembler::GetAlgorithmicParametersVariable())[0];
130124
}
131125

132126
/// @internal

0 commit comments

Comments
 (0)