From df3198a772e6800adc81563fddd3b08ed7b39c53 Mon Sep 17 00:00:00 2001 From: Laura Engelhardt Date: Thu, 19 Feb 2026 11:09:17 +0100 Subject: [PATCH] Remove untested multipoint constraint 3D penalty Remove the condition DESIGN SURFACE NORMALDIR MULTIPNT CONSTRAINT 3D PEN as it is untested. --- .../boundaryconditions.rst.j2 | 2 - src/adapter/4C_adapter_str_structure_new.cpp | 5 +- src/constraint/4C_constraint.cpp | 2 +- src/constraint/4C_constraint_manager.cpp | 10 +- src/constraint/4C_constraint_manager.hpp | 2 - ...onstraint_multipointconstraint3penalty.cpp | 506 ------------------ ...onstraint_multipointconstraint3penalty.hpp | 142 ----- .../4C_legacy_enum_definitions_conditions.cpp | 2 - .../4C_legacy_enum_definitions_conditions.hpp | 1 - ...C_global_legacy_module_validconditions.cpp | 23 - 10 files changed, 3 insertions(+), 692 deletions(-) delete mode 100644 src/constraint/4C_constraint_multipointconstraint3penalty.cpp delete mode 100644 src/constraint/4C_constraint_multipointconstraint3penalty.hpp diff --git a/doc/documentation/src/analysis_guide_templates/boundaryconditions.rst.j2 b/doc/documentation/src/analysis_guide_templates/boundaryconditions.rst.j2 index bf0a6c7df81..c6f681e8a89 100644 --- a/doc/documentation/src/analysis_guide_templates/boundaryconditions.rst.j2 +++ b/doc/documentation/src/analysis_guide_templates/boundaryconditions.rst.j2 @@ -329,8 +329,6 @@ In this constraint, the whole surface is displaced the same amount as a single m {{ section_dump(input_file4_content, "DESIGN SURFACE NORMALDIR MULTIPNT CONSTRAINT 3D") }} -There is also a penalty version, which uses a different algorithm, where one has to provide a penalty parameter. -See also :ref:`secdesignsurfacenormaldirmultipntconstraint3d` and :ref:`secdesignsurfacenormaldirmultipntconstraint3dpen`. Node displacement relative to a given surface or line ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/adapter/4C_adapter_str_structure_new.cpp b/src/adapter/4C_adapter_str_structure_new.cpp index 99726d62589..d0c19737164 100644 --- a/src/adapter/4C_adapter_str_structure_new.cpp +++ b/src/adapter/4C_adapter_str_structure_new.cpp @@ -403,12 +403,9 @@ void Adapter::StructureBaseAlgorithmNew::set_model_types( // --- enforcement by penalty law std::vector pencond_volconstr3d; std::vector pencond_areaconstr3d; - std::vector pencond_mpcnormcomp3d; actdis_->get_condition("VolumeConstraint_3D_Pen", pencond_volconstr3d); actdis_->get_condition("AreaConstraint_3D_Pen", pencond_areaconstr3d); - actdis_->get_condition("MPC_NormalComponent_3D_Pen", pencond_mpcnormcomp3d); - if (pencond_volconstr3d.size() or pencond_areaconstr3d.size() or pencond_mpcnormcomp3d.size()) - have_pen_constraint = true; + if (pencond_volconstr3d.size() or pencond_areaconstr3d.size()) have_pen_constraint = true; if (have_lag_constraint or have_pen_constraint) modeltypes.insert(Inpar::Solid::model_lag_pen_constraint); diff --git a/src/constraint/4C_constraint.cpp b/src/constraint/4C_constraint.cpp index dfb2e884373..8015fa1584a 100644 --- a/src/constraint/4C_constraint.cpp +++ b/src/constraint/4C_constraint.cpp @@ -97,7 +97,7 @@ Constraints::Constraint::ConstrType Constraints::Constraint::get_constr_type( return mpcnodeonplane3d; else if (name == "MPC_NodeOnLine_2D") return mpcnodeonline2d; - else if (name == "MPC_NormalComponent_3D" or name == "MPC_NormalComponent_3D_Pen") + else if (name == "MPC_NormalComponent_3D") return mpcnormalcomp3d; return none; } diff --git a/src/constraint/4C_constraint_manager.cpp b/src/constraint/4C_constraint_manager.cpp index ab67b93e8e1..8f2ffc76f18 100644 --- a/src/constraint/4C_constraint_manager.cpp +++ b/src/constraint/4C_constraint_manager.cpp @@ -12,7 +12,6 @@ #include "4C_constraint_monitor.hpp" #include "4C_constraint_multipointconstraint2.hpp" #include "4C_constraint_multipointconstraint3.hpp" -#include "4C_constraint_multipointconstraint3penalty.hpp" #include "4C_constraint_penalty.hpp" #include "4C_io.hpp" #include "4C_linalg_utils_densematrix_communication.hpp" @@ -78,11 +77,8 @@ void Constraints::ConstrManager::init( volconstr3dpen_ = std::make_shared(actdisc_, "VolumeConstraint_3D_Pen"); areaconstr3dpen_ = std::make_shared(actdisc_, "AreaConstraint_3D_Pen"); - mpcnormcomp3dpen_ = - std::make_shared(actdisc_, "MPC_NormalComponent_3D_Pen"); - havepenaconstr_ = (mpcnormcomp3dpen_->have_constraint()) or - (volconstr3dpen_->have_constraint()) or (areaconstr3dpen_->have_constraint()); + havepenaconstr_ = (volconstr3dpen_->have_constraint()) or (areaconstr3dpen_->have_constraint()); //---------------------------------------------------- //-----------include possible further constraints here @@ -145,8 +141,6 @@ void Constraints::ConstrManager::setup( mpconplane3d_->initialize(p, refbaseredundant); mpcnormcomp3d_->set_constr_state("displacement", *disp); mpcnormcomp3d_->initialize(p, refbaseredundant); - mpcnormcomp3dpen_->set_constr_state("displacement", *disp); - mpcnormcomp3dpen_->initialize(p); // Export redundant vector into distributed one refbasevalues_->export_to(*refbaseredundant, *conimpo_, Core::LinAlg::CombineMode::add); @@ -268,8 +262,6 @@ void Constraints::ConstrManager::evaluate_force_stiff(const double time, mpconplane3d_->evaluate(p, stiff, constr_matrix_, fint, refbaseredundant, actredundant); mpcnormcomp3d_->set_constr_state("displacement", *disp); mpcnormcomp3d_->evaluate(p, stiff, constr_matrix_, fint, refbaseredundant, actredundant); - mpcnormcomp3dpen_->set_constr_state("displacement", *disp); - mpcnormcomp3dpen_->evaluate(p, stiff, nullptr, fint, nullptr, nullptr); mpconline2d_->set_constr_state("displacement", *disp); mpconline2d_->evaluate(p, stiff, constr_matrix_, fint, refbaseredundant, actredundant); // Export redundant vectors into distributed ones diff --git a/src/constraint/4C_constraint_manager.hpp b/src/constraint/4C_constraint_manager.hpp index aa89bea5836..5d91fba409a 100644 --- a/src/constraint/4C_constraint_manager.hpp +++ b/src/constraint/4C_constraint_manager.hpp @@ -41,7 +41,6 @@ namespace Constraints class Constraint; class ConstraintPenalty; class MPConstraint3; - class MPConstraint3Penalty; class MPConstraint2; class Monitor; class ConstraintDofSet; @@ -341,7 +340,6 @@ namespace Constraints std::shared_ptr mpconline2d_; ///< 2d multipoint constraint prescribing the motion ///< of a node relatively to a straight line - std::shared_ptr mpcnormcomp3dpen_; std::shared_ptr volmonitor3d_; ///< 3d volume monitors defined on surfaces diff --git a/src/constraint/4C_constraint_multipointconstraint3penalty.cpp b/src/constraint/4C_constraint_multipointconstraint3penalty.cpp deleted file mode 100644 index c34ad07292c..00000000000 --- a/src/constraint/4C_constraint_multipointconstraint3penalty.cpp +++ /dev/null @@ -1,506 +0,0 @@ -// This file is part of 4C multiphysics licensed under the -// GNU Lesser General Public License v3.0 or later. -// -// See the LICENSE.md file in the top-level for license information. -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -#include "4C_constraint_multipointconstraint3penalty.hpp" - -#include "4C_constraint_element3.hpp" -#include "4C_fem_condition_utils.hpp" -#include "4C_fem_discretization.hpp" -#include "4C_fem_dofset_transparent.hpp" -#include "4C_global_data.hpp" -#include "4C_linalg_sparsematrix.hpp" -#include "4C_linalg_utils_densematrix_communication.hpp" -#include "4C_linalg_utils_sparse_algebra_assemble.hpp" -#include "4C_rebalance_binning_based.hpp" -#include "4C_utils_function_of_time.hpp" - -#include - -FOUR_C_NAMESPACE_OPEN - -/*----------------------------------------------------------------------* - *----------------------------------------------------------------------*/ -Constraints::MPConstraint3Penalty::MPConstraint3Penalty( - std::shared_ptr discr, ///< discretization constraint lives on - const std::string& CondName ///< Name of condition to create constraint from - ) - : MPConstraint(discr, CondName) -{ - if (constrcond_.size()) - { - // control the constraint by absolute or relative values - for (auto* conditer : constrcond_) - { - const int condID = conditer->parameters().get("ConditionID"); - penalties_[condID] = conditer->parameters().get("penalty"); - const std::string type = conditer->parameters().get("control"); - if (type == "abs") - absconstraint_[condID] = true; - else - { - absconstraint_[condID] = false; - } - } - - int startID = 0; - constraintdis_ = create_discretization_from_condition( - actdisc_, constrcond_, "ConstrDisc", "CONSTRELE3", startID); - - std::map>::iterator discriter; - for (discriter = constraintdis_.begin(); discriter != constraintdis_.end(); discriter++) - { - std::shared_ptr newcolnodemap = - Core::Rebalance::compute_node_col_map(*actdisc_, *discriter->second); - actdisc_->redistribute({*actdisc_->node_row_map(), *newcolnodemap}); - std::shared_ptr newdofset = - std::make_shared(actdisc_); - (discriter->second)->replace_dof_set(newdofset); - newdofset = nullptr; - (discriter->second)->fill_complete(); - } - - int nummyele = 0; - int numele = eletocond_id_.size(); - if (!Core::Communication::my_mpi_rank(actdisc_->get_comm())) - { - nummyele = numele; - } - // initialize maps and importer - errormap_ = std::make_shared(numele, nummyele, 0, actdisc_->get_comm()); - rederrormap_ = Core::LinAlg::allreduce_e_map(*errormap_); - errorexport_ = std::make_shared(*rederrormap_, *errormap_); - errorimport_ = std::make_shared(*rederrormap_, *errormap_); - acterror_ = std::make_shared>(*rederrormap_); - initerror_ = std::make_shared>(*rederrormap_); - } -} - -/*------------------------------------------------------------------------* - *------------------------------------------------------------------------*/ -void Constraints::MPConstraint3Penalty::initialize(const double& time) -{ - for (auto* cond : constrcond_) - { - // Get ConditionID of current condition if defined and write value in parameterlist - int condID = cond->parameters().get("ConditionID"); - - // if current time (at) is larger than activation time of the condition, activate it - if ((inittimes_.find(condID)->second < time) && (!activecons_.find(condID)->second)) - { - activecons_.find(condID)->second = true; - if (Core::Communication::my_mpi_rank(actdisc_->get_comm()) == 0) - { - std::cout << "Encountered another active condition (Id = " << condID - << ") for restart time t = " << time << std::endl; - } - } - } -} - -/*-----------------------------------------------------------------------* - *-----------------------------------------------------------------------*/ -void Constraints::MPConstraint3Penalty::initialize( - Teuchos::ParameterList& params, std::shared_ptr> systemvector) -{ - FOUR_C_THROW("method not used for penalty formulation!"); -} - -/*-----------------------------------------------------------------------* - *-----------------------------------------------------------------------*/ -void Constraints::MPConstraint3Penalty::initialize(Teuchos::ParameterList& params) -{ - const double time = params.get("total time", -1.0); - - for (auto* cond : constrcond_) - { - int condID = cond->parameters().get("ConditionID"); - // control absolute values - switch (type()) - { - case mpcnodeonplane3d: - case mpcnormalcomp3d: - params.set("action", "calc_MPC_state"); - break; - case none: - return; - default: - FOUR_C_THROW("Constraint/monitor is not an multi point constraint!"); - } - - evaluate_error(*constraintdis_.find(condID)->second, params, *initerror_, true); - - activecons_.find(condID)->second = true; - if (Core::Communication::my_mpi_rank(actdisc_->get_comm()) == 0) - { - std::cout << "Encountered a new active condition (Id = " << condID - << ") at time t = " << time << std::endl; - } - // std::cout << "initial error "<< *initerror_< systemmatrix1, - std::shared_ptr systemmatrix2, - std::shared_ptr> systemvector1, - std::shared_ptr> systemvector2, - std::shared_ptr> systemvector3) -{ - switch (type()) - { - case mpcnodeonplane3d: - case mpcnormalcomp3d: - params.set("action", "calc_MPC_state"); - break; - case none: - return; - default: - FOUR_C_THROW("Constraint/monitor is not an multi point constraint!"); - } - - acterror_->put_scalar(0.0); - std::map>::iterator discriter; - for (discriter = constraintdis_.begin(); discriter != constraintdis_.end(); discriter++) - evaluate_error(*discriter->second, params, *acterror_); - - // std::cout << "current error "<< *acterror_<second, params, systemmatrix1, systemmatrix2, systemvector1, - systemvector2, systemvector3); - - return; -} - -/*-----------------------------------------------------------------------* - *-----------------------------------------------------------------------*/ -std::map> -Constraints::MPConstraint3Penalty::create_discretization_from_condition( - std::shared_ptr actdisc, - std::span constrcondvec, const std::string& discret_name, - const std::string& element_name, int& startID) -{ - // start with empty map - std::map> newdiscmap; - - if (!actdisc->filled()) - { - actdisc->fill_complete(); - } - - if (constrcondvec.size() == 0) - FOUR_C_THROW( - "number of multi point constraint conditions = 0 --> cannot create constraint " - "discretization"); - - // Loop all conditions in constrcondvec and build discretization for any condition ID - - int index = 0; // counter for the index of condition in vector - std::span::iterator conditer; - for (conditer = constrcondvec.begin(); conditer != constrcondvec.end(); conditer++) - { - // initialize a new discretization - MPI_Comm com(actdisc->get_comm()); - std::shared_ptr newdis = - std::make_shared(discret_name, com, actdisc->n_dim()); - const int myrank = Core::Communication::my_mpi_rank(newdis->get_comm()); - std::set rownodeset; - std::set colnodeset; - const Core::LinAlg::Map* actnoderowmap = actdisc->node_row_map(); - // get node IDs, this vector will only contain FREE nodes in the end - std::vector ngid = *((*conditer)->get_nodes()); - std::vector defnv; - switch (type()) - { - case mpcnodeonplane3d: - { - // take three nodes defining plane as specified by user and put them into a set - const auto& defnvp = (*conditer)->parameters().get>("planeNodes"); - defnv = defnvp; - } - break; - case mpcnormalcomp3d: - { - // take master node - const int defn = (*conditer)->parameters().get("masterNode"); - defnv.push_back(defn); - } - break; - default: - FOUR_C_THROW("not good!"); - } - std::set defns(defnv.begin(), defnv.end()); - std::set::iterator nsit; - // safe gids of definition nodes in a vector - std::vector defnodeIDs; - - int counter = 1; // counter is used to keep track of deleted node ids from the vector, input - // starts with 1 - - for (nsit = defns.begin(); nsit != defns.end(); ++nsit) - { - defnodeIDs.push_back(ngid.at((*nsit) - counter)); - ngid.erase(ngid.begin() + (*nsit) - counter); - counter++; - } - - unsigned int nodeiter; - // loop over all free nodes of condition - for (nodeiter = 0; nodeiter < ngid.size(); nodeiter++) - { - std::vector ngid_ele = defnodeIDs; - ngid_ele.push_back(ngid[nodeiter]); - const int numnodes = ngid_ele.size(); - remove_copy_if(ngid_ele.data(), ngid_ele.data() + numnodes, - inserter(rownodeset, rownodeset.begin()), - std::not_fn(Core::Conditions::MyGID(actnoderowmap))); - // copy node ids specified in condition to colnodeset - copy(ngid_ele.data(), ngid_ele.data() + numnodes, inserter(colnodeset, colnodeset.begin())); - - // construct constraint nodes, which use the same global id as the standard nodes - for (int i = 0; i < actnoderowmap->num_my_elements(); ++i) - { - const int gid = actnoderowmap->gid(i); - if (rownodeset.find(gid) != rownodeset.end()) - { - const Core::Nodes::Node* standardnode = actdisc->l_row_node(i); - newdis->add_node(standardnode->x(), gid, - std::make_shared(gid, standardnode->x(), myrank)); - } - } - - if (myrank == 0) - { - std::shared_ptr constraintele = - Core::Communication::factory(element_name, "Polynomial", nodeiter + startID, myrank); - // set the same global node ids to the ale element - constraintele->set_node_ids(ngid_ele.size(), ngid_ele.data()); - // add constraint element - newdis->add_element(constraintele); - } - // save the connection between element and condition - eletocond_id_[nodeiter + startID] = (*conditer)->parameters().get("ConditionID"); - eletocondvecindex_[nodeiter + startID] = index; - } - // adjust starting ID for next condition, in this case nodeiter=ngid.size(), hence the counter - // is larger than the ID - // of the last element - startID += nodeiter; - - // now care about the parallel distribution and ghosting. - // So far every processor only knows about its nodes - - // build unique node row map - std::vector boundarynoderowvec(rownodeset.begin(), rownodeset.end()); - rownodeset.clear(); - Core::LinAlg::Map constraintnoderowmap( - -1, boundarynoderowvec.size(), boundarynoderowvec.data(), 0, newdis->get_comm()); - boundarynoderowvec.clear(); - - // build overlapping node column map - std::vector constraintnodecolvec(colnodeset.begin(), colnodeset.end()); - colnodeset.clear(); - Core::LinAlg::Map constraintnodecolmap( - -1, constraintnodecolvec.size(), constraintnodecolvec.data(), 0, newdis->get_comm()); - - constraintnodecolvec.clear(); - newdis->redistribute({constraintnoderowmap, constraintnodecolmap}); - // put new discretization into the map - newdiscmap[(*conditer)->parameters().get("ConditionID")] = newdis; - // increase counter - index++; - } - - startID--; // set counter back to ID of the last element - return newdiscmap; -} - -/*----------------------------------------------------------------------* - *----------------------------------------------------------------------*/ -void Constraints::MPConstraint3Penalty::evaluate_constraint( - std::shared_ptr disc, Teuchos::ParameterList& params, - std::shared_ptr systemmatrix1, - std::shared_ptr systemmatrix2, - std::shared_ptr> systemvector1, - std::shared_ptr> systemvector2, - std::shared_ptr> systemvector3) -{ - if (!(disc->filled())) FOUR_C_THROW("fill_complete() was not called"); - if (!(disc->have_dofs())) FOUR_C_THROW("assign_degrees_of_freedom() was not called"); - - // define element matrices and vectors - Core::LinAlg::SerialDenseMatrix elematrix1; - Core::LinAlg::SerialDenseMatrix elematrix2; - Core::LinAlg::SerialDenseVector elevector1; - Core::LinAlg::SerialDenseVector elevector2; - Core::LinAlg::SerialDenseVector elevector3; - - const double time = params.get("total time", -1.0); - const int numcolele = disc->num_my_col_elements(); - - // get values from time integrator to scale matrices with - double scStiff = params.get("scaleStiffEntries", 1.0); - - // loop over column elements - for (int i = 0; i < numcolele; ++i) - { - // some useful data for computation - Core::Elements::Element* actele = disc->l_col_element(i); - int eid = actele->id(); - int condID = eletocond_id_.find(eid)->second; - const Core::Conditions::Condition* cond = constrcond_[eletocondvecindex_.find(eid)->second]; - params.set("condition", cond); - - // computation only if time is larger or equal than initialization time for constraint - if (inittimes_.find(condID)->second <= time) - { - // initialize if it is the first time condition is evaluated - if (activecons_.find(condID)->second == false) - { - const std::string action = params.get("action"); - std::shared_ptr> displast = - params.get>>("old disp"); - set_constr_state("displacement", *displast); - // last converged step is used reference - initialize(params); - std::shared_ptr> disp = - params.get>>("new disp"); - set_constr_state("displacement", *disp); - params.set("action", action); - } - - // get element location vector, dirichlet flags and ownerships - std::vector lm; - std::vector lmowner; - std::vector lmstride; - actele->location_vector(*disc, lm, lmowner, lmstride); - // get dimension of element matrices and vectors - // Reshape element matrices and vectors and init to zero - const int eledim = (int)lm.size(); - elematrix1.shape(eledim, eledim); - elevector1.size(eledim); - elevector3.size(1); - params.set("ConditionID", eid); - - // call the element evaluate method - int err = actele->evaluate( - params, *disc, lm, elematrix1, elematrix2, elevector1, elevector2, elevector3); - if (err) - FOUR_C_THROW("Proc {}: Element {} returned err={}", - Core::Communication::my_mpi_rank(disc->get_comm()), eid, err); - - // loadcurve business - const auto curvenum = cond->parameters().get>("curve"); - double curvefac = 1.0; - if (curvenum.has_value() && curvenum.value() > 0 && time >= 0.0) - { - // function_by_id takes a zero-based index - curvefac = Global::Problem::instance() - ->function_by_id(curvenum.value()) - .evaluate(time); - } - - double diff = (curvefac * (*initerror_).local_values_as_span()[eid] - - (*acterror_).local_values_as_span()[eid]); - elematrix1.scale(diff); - for (int i = 0; i < eledim; i++) - for (int j = 0; j < eledim; j++) elematrix1(i, j) += elevector1(i) * elevector1(j); - elematrix1.scale(2 * scStiff * penalties_[condID]); - - systemmatrix1->assemble(eid, lmstride, elematrix1, lm, lmowner); - elevector1.scale(2. * penalties_[condID] * diff); - Core::LinAlg::assemble(*systemvector1, elevector1, lm, lmowner); - } - } -} // end of evaluate_condition - -/*-----------------------------------------------------------------------* - *-----------------------------------------------------------------------*/ -void Constraints::MPConstraint3Penalty::evaluate_error(Core::FE::Discretization& disc, - Teuchos::ParameterList& params, Core::LinAlg::Vector& systemvector, bool init) -{ - if (!(disc.filled())) FOUR_C_THROW("fill_complete() was not called"); - if (!(disc.have_dofs())) FOUR_C_THROW("assign_degrees_of_freedom() was not called"); - - // define element matrices and vectors - Core::LinAlg::SerialDenseMatrix elematrix1; - Core::LinAlg::SerialDenseMatrix elematrix2; - Core::LinAlg::SerialDenseVector elevector1; - Core::LinAlg::SerialDenseVector elevector2; - Core::LinAlg::SerialDenseVector elevector3; - - // loop over column elements - const double time = params.get("total time", -1.0); - const int numcolele = disc.num_my_col_elements(); - for (int i = 0; i < numcolele; ++i) - { - // some useful data for computation - Core::Elements::Element* actele = disc.l_col_element(i); - int eid = actele->id(); - int condID = eletocond_id_.find(eid)->second; - const Core::Conditions::Condition* cond = constrcond_[eletocondvecindex_.find(eid)->second]; - params.set("condition", cond); - - // get element location vector, dirichlet flags and ownerships - std::vector lm; - std::vector lmowner; - std::vector lmstride; - actele->location_vector(disc, lm, lmowner, lmstride); - elevector3.size(1); - params.set("ConditionID", eid); - - if (absconstraint_.find(condID)->second && init) - { - elevector3[0] = cond->parameters().get("amplitude"); - } - else - { - // call the element evaluate method - int err = actele->evaluate( - params, disc, lm, elematrix1, elematrix2, elevector1, elevector2, elevector3); - if (err) - FOUR_C_THROW("Proc {}: Element {} returned err={}", - Core::Communication::my_mpi_rank(disc.get_comm()), eid, err); - } - - // assembly - std::vector constrlm; - std::vector constrowner; - constrlm.push_back(eid); - constrowner.push_back(actele->owner()); - Core::LinAlg::assemble(systemvector, elevector3, constrlm, constrowner); - - activecons_.find(condID)->second = true; - - if (Core::Communication::my_mpi_rank(actdisc_->get_comm()) == 0 && - (!(activecons_.find(condID)->second))) - { - std::cout << "Encountered a new active penalty mp condition (Id = " << condID - << ") at time t = " << time << std::endl; - } - } - - Core::LinAlg::Vector acterrdist(*errormap_); - acterrdist.export_to(systemvector, *errorexport_, Core::LinAlg::CombineMode::add); - systemvector.import(acterrdist, *errorimport_, Core::LinAlg::CombineMode::insert); - return; -} // end of evaluate_error - -FOUR_C_NAMESPACE_CLOSE diff --git a/src/constraint/4C_constraint_multipointconstraint3penalty.hpp b/src/constraint/4C_constraint_multipointconstraint3penalty.hpp deleted file mode 100644 index f4907718ccf..00000000000 --- a/src/constraint/4C_constraint_multipointconstraint3penalty.hpp +++ /dev/null @@ -1,142 +0,0 @@ -// This file is part of 4C multiphysics licensed under the -// GNU Lesser General Public License v3.0 or later. -// -// See the LICENSE.md file in the top-level for license information. -// -// SPDX-License-Identifier: LGPL-3.0-or-later - -#ifndef FOUR_C_CONSTRAINT_MULTIPOINTCONSTRAINT3PENALTY_HPP -#define FOUR_C_CONSTRAINT_MULTIPOINTCONSTRAINT3PENALTY_HPP - -#include "4C_config.hpp" - -#include "4C_constraint_multipointconstraint.hpp" - -FOUR_C_NAMESPACE_OPEN - - - -namespace Constraints -{ - /*! - \brief This class can handle multi point constraints in 3D. - It is derived from the basic multipointconstraint class. - */ - class MPConstraint3Penalty : public Constraints::MPConstraint - { - public: - /*! - \brief Standard Constructor - */ - MPConstraint3Penalty( - std::shared_ptr discr, ///< discretization constraint lives on - const std::string& CondName ///< Name of condition to create constraint from - ); - - /// unused - void initialize( - Teuchos::ParameterList& - params, ///< parameter list to communicate between elements and discretization - std::shared_ptr> - systemvector3 ///< distributed vector that may be filled - ///< by assembly of element contributions - ) override; - - /// initialization routine called by the manager ctor - void initialize(Teuchos::ParameterList& - params ///< parameter list to communicate between elements and discretization - ); - - /// initialization routine called at restart to activate the right conditions - void initialize(const double& time ///< current time - ) override; - - //! Evaluate routine to call from outside. In here the right action is determined and the - //! #evaluate_constraint routine is called - void evaluate( - Teuchos::ParameterList& - params, ///< parameter list to communicate between elements and discretization - std::shared_ptr - systemmatrix1, ///< sparse matrix that may be filled by assembly of element - ///< contributions - std::shared_ptr - systemmatrix2, ///< sparse (rectangular) matrix that may be filled by assembly of - ///< element contributions - std::shared_ptr> - systemvector1, ///< distributed vector that may be filled by - ///< assembly of element contributions - std::shared_ptr> - systemvector2, ///< distributed vector that may be filled by - ///< assembly of element contributions - std::shared_ptr> - systemvector3 ///< distributed vector that may be filled - ///< by assembly of element contributions - ) override; - - private: - // don't want = operator, cctor - MPConstraint3Penalty operator=(const MPConstraint3Penalty& old); - MPConstraint3Penalty(const MPConstraint3Penalty& old); - - //! Return the ConstrType based on the condition name - ConstrType get_constr_type(const std::string& Name); ///< condition name - - //! Evaluate constraint discretization and assemble the results - void evaluate_constraint( - std::shared_ptr disc, ///< discretization to evaluate - Teuchos::ParameterList& - params, ///< parameter list to communicate between elements and discretization - std::shared_ptr - systemmatrix1, ///< sparse matrix that may be filled by assembly of element - ///< contributions - std::shared_ptr - systemmatrix2, ///< sparse (rectangular) matrix that may be filled by assembly of - ///< element contributions - std::shared_ptr> - systemvector1, ///< distributed vector that may be filled by - ///< assembly of element contributions - std::shared_ptr> - systemvector2, ///< distributed vector that may be filled by - ///< assembly of element contributions - std::shared_ptr> systemvector3) - override; ///< distributed vector that may be filled by - ///< assembly of element contributions - - //! Initialize constraint discretization and assemble the results to the refbasevector - void evaluate_error(Core::FE::Discretization& disc, ///< discretization to evaluate - Teuchos::ParameterList& - params, ///< parameter list to communicate between elements and discretization - Core::LinAlg::Vector& systemvector3, ///< distributed vector that may be filled by - ///< aasembly of element contributions - bool init = false); - - //! creating a new discretization based on conditions containing constraint elements - std::map> create_discretization_from_condition( - std::shared_ptr actdisc, - std::span - constrcond, ///< conditions as discretization basis - const std::string& discret_name, ///< name of new discretization - const std::string& element_name, ///< name of element type to create - int& startID) override; - - // projected attributes - std::map absconstraint_; ///< maps condition ID to indicator if absolute values are - ///< to use for controlling - std::map - eletocond_id_; ///< maps element ID to condition ID, to allow use of other maps - std::map - eletocondvecindex_; ///< maps element ID to condition index in vector #constrcond_ - std::map penalties_; ///< maps condition ID to penalty factor - std::shared_ptr errorexport_; - std::shared_ptr errorimport_; - std::shared_ptr rederrormap_; - std::shared_ptr errormap_; - std::shared_ptr> initerror_; - std::shared_ptr> acterror_; - - - }; // class -} // namespace Constraints -FOUR_C_NAMESPACE_CLOSE - -#endif diff --git a/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.cpp b/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.cpp index a2fb1ec8ee6..dec2c462708 100644 --- a/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.cpp +++ b/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.cpp @@ -158,8 +158,6 @@ std::string_view Core::Conditions::to_string(const Core::Conditions::ConditionTy return "Multipoint constraint on a line"; case Core::Conditions::MPC_NormalComponent_3D: return "Node on plane constraint"; - case Core::Conditions::MPC_NormalComponent_3D_pen: - return "Node on plane penalty constraint"; case Core::Conditions::LJ_Potential_Volume: return "Lennard-Jones potential in a volume"; case Core::Conditions::LJ_Potential_Surface: diff --git a/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp b/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp index a755122a836..dee49eb5832 100644 --- a/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp +++ b/src/core/legacy_enum_definitions/4C_legacy_enum_definitions_conditions.hpp @@ -110,7 +110,6 @@ namespace Core::Conditions MPC_NodeOnPlane_3D, MPC_NodeOnLine_3D, MPC_NormalComponent_3D, - MPC_NormalComponent_3D_pen, MPC_NodeOnLine_2D, LJ_Potential_Volume, LJ_Potential_Surface, diff --git a/src/global_legacy_module/4C_global_legacy_module_validconditions.cpp b/src/global_legacy_module/4C_global_legacy_module_validconditions.cpp index 718268cd4a9..8871fcd496c 100644 --- a/src/global_legacy_module/4C_global_legacy_module_validconditions.cpp +++ b/src/global_legacy_module/4C_global_legacy_module_validconditions.cpp @@ -725,29 +725,6 @@ std::vector Global::valid_conditions() condlist.push_back(nodemasterconst3D); - /*--------------------------------------------------------------------*/ - // Multi point constraint in 3D, moving all constraint nodes synchronously, penalty based - - Core::Conditions::ConditionDefinition nodemasterconst3Dpen( - "DESIGN SURFACE NORMALDIR MULTIPNT CONSTRAINT 3D PEN", "MPC_NormalComponent_3D_Pen", - "Node on Plane Constraint Penalty", Core::Conditions::MPC_NormalComponent_3D_pen, false, - Core::Conditions::geometry_type_surface); - - - nodemasterconst3Dpen.add_component(parameter("ConditionID")); - nodemasterconst3Dpen.add_component(parameter("amplitude")); - nodemasterconst3Dpen.add_component(parameter>("curve", {.description = {}})); - nodemasterconst3Dpen.add_component(parameter("activeTime")); - nodemasterconst3Dpen.add_component(parameter("penalty")); - nodemasterconst3Dpen.add_component(parameter("masterNode")); - nodemasterconst3Dpen.add_component( - parameter>("direction", {.description = "direction", .size = 3})); - nodemasterconst3Dpen.add_component(deprecated_selection( - "value", {"disp", "x"}, {.description = "value", .default_value = "disp"})); - nodemasterconst3Dpen.add_component(deprecated_selection("control", {"rel", "abs"}, - {.description = "relative or absolute control", .default_value = "rel"})); - - condlist.push_back(nodemasterconst3Dpen); /*--------------------------------------------------------------------*/ // Multi point constraint in 2D for a node on a line Core::Conditions::ConditionDefinition nodeonlineconst2D("DESIGN LINE MULTIPNT CONSTRAINT 2D",