Skip to content

Commit 12c999e

Browse files
Merge pull request #1691 from isteinbrecher/beam-to-beam-point-couplings_with_lagrange_multipliers
Beam to beam point couplings with Lagrange multipliers
2 parents 3fe57bd + bec9037 commit 12c999e

File tree

22 files changed

+477
-34
lines changed

22 files changed

+477
-34
lines changed

src/beaminteraction/src/4C_beaminteraction_beam_to_beam_point_coupling_pair.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ namespace BeamInteraction
5555
//! Flag on type of constraint enforcement.
5656
enum class ConstraintEnforcement
5757
{
58-
penalty_direct,
59-
penalty_indirect
58+
penalty_direct, //! Direct assembly via penalty method.
59+
penalty_indirect, //! Set up full Lagrange-multiplier system and regularize
60+
lagrange_multiplier //! Set up full Lagrange-multiplier system and solve with Lagrange
61+
//! multipliers
6062
};
6163
ConstraintEnforcement constraint_enforcement = ConstraintEnforcement::penalty_direct;
6264

@@ -238,8 +240,11 @@ namespace BeamInteraction
238240
*/
239241
double get_energy() const override
240242
{
241-
FOUR_C_THROW("get_energy not implemented yet!");
242-
return 0.0;
243+
if (parameters_.constraint_enforcement ==
244+
BeamToBeamPointCouplingPairParameters::ConstraintEnforcement::lagrange_multiplier)
245+
return 0.0;
246+
else
247+
FOUR_C_THROW("get_energy not implemented yet!");
243248
}
244249

245250
/**

src/beaminteraction/src/4C_beaminteraction_beam_to_beam_point_coupling_pair_condition.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ BeamInteraction::BeamToBeamPointCouplingConditionIndirect::create_indirect_assem
187187
.penalty_parameter_translational = parameters_.penalty_parameter_pos,
188188
.penalty_parameter_rotational = parameters_.penalty_parameter_rot};
189189

190+
if (parameters_.constraint_enforcement ==
191+
BeamToBeamPointCouplingPairParameters::ConstraintEnforcement::lagrange_multiplier)
192+
{
193+
mortar_manager_parameters.constraint_enforcement =
194+
Inpar::BeamToSolid::BeamToSolidConstraintEnforcement::lagrange;
195+
mortar_manager_parameters.lagrange_formulation =
196+
Inpar::BeamToSolid::BeamToSolidLagrangeFormulation::saddlepoint;
197+
}
198+
190199
auto mortar_manager = std::make_shared<BeamInteraction::BeamToSolidMortarManager>(
191200
discret, mortar_manager_parameters);
192201
mortar_manager->setup();

src/beaminteraction/src/4C_beaminteraction_beam_to_solid_mortar_manager.cpp

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,23 @@ void BeamInteraction::BeamToSolidMortarManager::evaluate_force_stiff_penalty_reg
431431
*
432432
*/
433433
void BeamInteraction::BeamToSolidMortarManager::evaluate_coupling_terms_lagrange(
434-
const std::shared_ptr<const Solid::ModelEvaluator::BeamInteractionDataState>& data_state)
434+
const std::shared_ptr<const Solid::ModelEvaluator::BeamInteractionDataState>& data_state,
435+
std::shared_ptr<Core::LinAlg::SparseMatrix> stiff,
436+
std::shared_ptr<Core::LinAlg::FEVector<double>> force)
435437
{
436438
// Evaluate the global coupling terms
437439
evaluate_and_assemble_global_coupling_contributions(data_state->get_dis_col_np());
438440

439441
// For now we need to set a link to the global Lagrange multiplier vector in the beam interaction
440442
// data state.
441443
global_lambda_ = data_state->get_lambda();
444+
445+
// Add the force and stiffness contributions that are assembled directly by the pairs.
446+
Core::LinAlg::Vector<double> lambda_col(*lambda_dof_colmap_);
447+
Core::LinAlg::export_to(*global_lambda_, lambda_col);
448+
for (const auto& elepairptr : contact_pairs_)
449+
elepairptr->evaluate_and_assemble(
450+
*discret_, this, force, stiff, lambda_col, *data_state->get_dis_col_np());
442451
}
443452

444453
/**
@@ -780,6 +789,23 @@ void BeamInteraction::BeamToSolidMortarManager::assemble_stiff(
780789
auto block_lm_displ_row_map = jac_block_sparse_matrix_base->matrix(1, 0).row_map();
781790
auto block_displ_lm_row_map = jac_block_sparse_matrix_base->matrix(0, 1).row_map();
782791

792+
Core::LinAlg::SparseMatrix lm_lm =
793+
Core::LinAlg::SparseMatrix(block_lm_displ_row_map, 81, true, true);
794+
795+
auto lambda_non_active = Core::LinAlg::Vector<double>(lambda_active_->get_map());
796+
for (int lid = 0; lid < lambda_active_->get_map().num_my_elements(); lid++)
797+
{
798+
if (lambda_active_->get_values()[lid] < 0.1)
799+
lambda_non_active.replace_local_value(lid, 1.0);
800+
else
801+
lambda_non_active.replace_local_value(lid, 0.0);
802+
}
803+
auto lambda_non_active_structure_map = Core::LinAlg::Vector<double>(block_lm_displ_row_map);
804+
Core::LinAlg::export_to(lambda_non_active, lambda_non_active_structure_map);
805+
Core::LinAlg::SparseMatrix lambda_non_active_matrix(lambda_non_active_structure_map);
806+
lambda_non_active_matrix.complete();
807+
lm_lm.add(lambda_non_active_matrix, false, 1.0, 1.0);
808+
783809
if (parameters_.lagrange_formulation ==
784810
Inpar::BeamToSolid::BeamToSolidLagrangeFormulation::regularized)
785811
{
@@ -790,10 +816,13 @@ void BeamInteraction::BeamToSolidMortarManager::assemble_stiff(
790816
Core::LinAlg::SparseMatrix kappa_penalty_inv_mat(kappa_vector);
791817
kappa_penalty_inv_mat.scale(-1.0 / penalty_translation);
792818
kappa_penalty_inv_mat.complete();
793-
gstate.assign_model_block(jac, kappa_penalty_inv_mat, Inpar::Solid::model_beaminteraction,
794-
Solid::MatBlockType::lm_lm);
819+
lm_lm.add(kappa_penalty_inv_mat, false, 1.0, 1.0);
795820
}
796821

822+
gstate.assign_model_block(
823+
jac, lm_lm, Inpar::Solid::model_beaminteraction, Solid::MatBlockType::lm_lm);
824+
825+
797826
Core::LinAlg::SparseMatrix lm_displ =
798827
Core::LinAlg::SparseMatrix(*lambda_dof_rowmap_, 81, true, true);
799828
Core::LinAlg::matrix_add(*constraint_lin_beam_, false, 1.0, lm_displ, 0.0);

src/beaminteraction/src/4C_beaminteraction_beam_to_solid_mortar_manager.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,13 @@ namespace BeamInteraction
214214
* \brief Evaluate the coupling contributions resulting from a lagrange
215215
* type of constraint enforcement.
216216
* @param data_state (in) Beam interaction data state.
217+
* @param stiff (out) Global stiffness matrix. Mortar terms are added to it.
218+
* @param force (out) Global force vector. Mortar terms are added to it.
217219
*/
218220
void evaluate_coupling_terms_lagrange(
219-
const std::shared_ptr<const Solid::ModelEvaluator::BeamInteractionDataState>& data_state);
221+
const std::shared_ptr<const Solid::ModelEvaluator::BeamInteractionDataState>& data_state,
222+
std::shared_ptr<Core::LinAlg::SparseMatrix> stiff,
223+
std::shared_ptr<Core::LinAlg::FEVector<double>> force);
220224

221225
/**
222226
* \brief Check if the model uses Lagrange multipliers.

src/beaminteraction/src/4C_beaminteraction_submodel_evaluator_beamcontact_assembly_manager_indirect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void BeamInteraction::SubmodelEvaluator::BeamContactAssemblyManagerInDirect::eva
2929
{
3030
if (mortar_manager_->have_lagrange_dofs())
3131
{
32-
mortar_manager_->evaluate_coupling_terms_lagrange(data_state);
32+
mortar_manager_->evaluate_coupling_terms_lagrange(data_state, fe_sysmat, fe_sysvec);
3333
}
3434
else
3535
{

src/inpar/4C_inpar_beaminteraction.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ void Inpar::BeamInteraction::set_valid_conditions(
229229
Core::Conditions::geometry_type_line);
230230
penalty_coupling_condition_indirect.add_component(parameter<int>("COUPLING_ID"));
231231
penalty_coupling_condition_indirect.add_component(group("PARAMETERS",
232-
{parameter<double>("POSITIONAL_PENALTY_PARAMETER"),
233-
parameter<double>("ROTATIONAL_PENALTY_PARAMETER"),
232+
{parameter<double>("POSITIONAL_PENALTY_PARAMETER", {.default_value = 0.0}),
233+
parameter<double>("ROTATIONAL_PENALTY_PARAMETER", {.default_value = 0.0}),
234234
parameter<double>("PROJECTION_VALID_FACTOR",
235235
{.description = "Factor multiplied with sum of cross section "
236236
"radii to define valid projection distance",
@@ -240,10 +240,8 @@ void Inpar::BeamInteraction::set_valid_conditions(
240240
.default_value = 0}),
241241
parameter<::FourC::BeamInteraction::BeamToBeamPointCouplingPairParameters::
242242
ConstraintEnforcement>("CONSTRAINT_ENFORCEMENT",
243-
{.description = "How the constraints for this condition shall be enforced",
244-
.default_value =
245-
::FourC::BeamInteraction::BeamToBeamPointCouplingPairParameters::
246-
ConstraintEnforcement::penalty_direct})},
243+
{.description = "Specifies the constraint enforcement technique for beam-to-beam "
244+
"point couplings."})},
247245
{.required = false}));
248246
condlist.push_back(penalty_coupling_condition_indirect);
249247
}

tests/input_files/beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow.4C.yaml renamed to tests/input_files/beam3r_herm2line3_beam_to_beam_point_coupling_elbow.4C.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ BINNING STRATEGY:
3939
BIN_SIZE_LOWER_BOUND: 10
4040
DOMAINBOUNDINGBOX: "-20 -20 -20 20 20 20"
4141
STRUCT NOX/Status Test:
42-
XML File: "beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow.xml"
42+
XML File: "beam3r_herm2line3_beam_to_beam_point_coupling_elbow.xml"
4343
MATERIALS:
4444
- MAT: 1
4545
MAT_BeamReissnerElastHyper:

tests/input_files/beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow.xml renamed to tests/input_files/beam3r_herm2line3_beam_to_beam_point_coupling_elbow.xml

File renamed without changes.

tests/input_files/beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow_offset.4C.yaml renamed to tests/input_files/beam3r_herm2line3_beam_to_beam_point_coupling_elbow_offset.4C.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ STRUCT NOX/Printing:
6161
Linear Solver Details: true
6262
Test Details: true
6363
STRUCT NOX/Status Test:
64-
XML File: "beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow.xml"
64+
XML File: "beam3r_herm2line3_beam_to_beam_point_coupling_elbow.xml"
6565
STRUCTURAL DYNAMIC:
6666
LINEAR_SOLVER: 1
6767
INT_STRATEGY: "Standard"

tests/input_files/beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow_offset_indirect_global_assembly.4C.yaml renamed to tests/input_files/beam3r_herm2line3_beam_to_beam_point_coupling_elbow_offset_indirect_global_assembly.4C.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ STRUCT NOX/Printing:
7171
Linear Solver Details: true
7272
Test Details: true
7373
STRUCT NOX/Status Test:
74-
XML File: "beam3r_herm2line3_beam_to_beam_penalty_point_coupling_elbow.xml"
74+
XML File: "beam3r_herm2line3_beam_to_beam_point_coupling_elbow.xml"
7575
STRUCTURAL DYNAMIC:
7676
LINEAR_SOLVER: 1
7777
INT_STRATEGY: "Standard"

0 commit comments

Comments
 (0)