41 const bool IsProjection,
42 const bool IsDualMortar,
43 const bool IsDestinationIsSlave
46 mIsProjection(IsProjection),
47 mIsDualMortar(IsDualMortar),
48 mIsDestinationIsSlave(IsDestinationIsSlave)
60 KRATOS_ERROR <<
"not implemented, needs checking" << std::endl;
65 return Kratos::make_unique<CouplingGeometryLocalSystem>(pGeometry, mIsProjection, mIsDualMortar, mIsDestinationIsSlave);
75 bool mIsDualMortar =
false;
76 bool mIsDestinationIsSlave =
true;
92 template<
class TSparseSpace,
class TDenseSpace>
132 : mrModelPartOrigin(rModelPartOrigin),
133 mrModelPartDestination(rModelPartDestination){}
149 double SearchRadius)
override
151 mpModeler->PrepareGeometryModel();
153 AssignInterfaceEquationIds();
163 if (MappingOptions.
Is(MapperFlags::USE_TRANSPOSE)) {
164 MappingOptions.
Reset(MapperFlags::USE_TRANSPOSE);
165 MappingOptions.
Set(MapperFlags::INTERNAL_USE_TRANSPOSE,
true);
166 GetInverseMapper()->Map(rDestinationVariable, rOriginVariable, MappingOptions);
168 else if (MappingOptions.
Is(MapperFlags::INTERNAL_USE_TRANSPOSE)) {
169 MapInternalTranspose(rOriginVariable, rDestinationVariable, MappingOptions);
172 MapInternal(rOriginVariable, rDestinationVariable, MappingOptions);
181 if (MappingOptions.
Is(MapperFlags::USE_TRANSPOSE)) {
182 MappingOptions.
Reset(MapperFlags::USE_TRANSPOSE);
183 MappingOptions.
Set(MapperFlags::INTERNAL_USE_TRANSPOSE,
true);
184 GetInverseMapper()->Map(rDestinationVariable, rOriginVariable, MappingOptions);
186 else if (MappingOptions.
Is(MapperFlags::INTERNAL_USE_TRANSPOSE)) {
187 MapInternalTranspose(rOriginVariable, rDestinationVariable, MappingOptions);
190 MapInternal(rOriginVariable, rDestinationVariable, MappingOptions);
199 if (MappingOptions.
Is(MapperFlags::USE_TRANSPOSE)) {
200 MapInternalTranspose(rOriginVariable, rDestinationVariable, MappingOptions);
203 GetInverseMapper()->Map(rDestinationVariable, rOriginVariable, MappingOptions);
212 if (MappingOptions.
Is(MapperFlags::USE_TRANSPOSE)) {
213 MapInternalTranspose(rOriginVariable, rDestinationVariable, MappingOptions);
216 GetInverseMapper()->Map(rDestinationVariable, rOriginVariable, MappingOptions);
226 if (mMapperSettings[
"precompute_mapping_matrix"].GetBool() || mMapperSettings[
"dual_mortar"].GetBool())
return *(mpMappingMatrix.get());
227 else KRATOS_ERROR <<
"'precompute_mapping_matrix' or 'dual_mortar' must be 'true' in your parameters to retrieve the computed mapping matrix!" << std::endl;
234 return Kratos::make_unique<CouplingGeometryMapper<TSparseSpace, TDenseSpace>>(
236 rModelPartDestination,
249 std::string
Info()
const override
251 return "CouplingGeometryMapper";
257 rOStream <<
"CouplingGeometryMapper";
283 typename Modeler::Pointer mpModeler =
nullptr;
288 ModelPart* mpCouplingInterfaceMaster =
nullptr;
289 ModelPart* mpCouplingInterfaceSlave =
nullptr;
312 void AssignInterfaceEquationIds()
318 void MapInternal(
const Variable<double>& rOriginVariable,
319 const Variable<double>& rDestinationVariable,
322 void MapInternalTranspose(
const Variable<double>& rOriginVariable,
323 const Variable<double>& rDestinationVariable,
326 void MapInternal(
const Variable<array_1d<double, 3>>& rOriginVariable,
327 const Variable<array_1d<double, 3>>& rDestinationVariable,
330 void MapInternalTranspose(
const Variable<array_1d<double, 3>>& rOriginVariable,
331 const Variable<array_1d<double, 3>>& rDestinationVariable,
334 void EnforceConsistencyWithScaling(
337 const double scalingLimit = 1.1);
339 void CreateLinearSolver();
343 Parameters GetMapperDefaultSettings()
const
345 return Parameters(R
"({
347 "dual_mortar" : false,
348 "precompute_mapping_matrix" : false,
349 "modeler_name" : "UNSPECIFIED",
350 "modeler_parameters" : {},
351 "consistency_scaling" : true,
352 "row_sum_tolerance" : 1e-12,
353 "destination_is_slave" : true,
354 "linear_solver_settings" : {}
364 if (!mpInverseMapper) {
365 InitializeInverseMapper();
367 return mpInverseMapper;
370 void InitializeInverseMapper()
372 KRATOS_ERROR <<
"Inverse Mapping is not supported yet!" << std::endl;
373 mpInverseMapper = this->
Clone(mrModelPartDestination,
Definition: coupling_geometry_mapper.h:37
CoordinatesArrayType & Coordinates() const override
Definition: coupling_geometry_mapper.h:56
CouplingGeometryLocalSystem(GeometryPointerType pGeom, const bool IsProjection, const bool IsDualMortar, const bool IsDestinationIsSlave)
Definition: coupling_geometry_mapper.h:40
void PairingInfo(std::ostream &rOStream, const int EchoLevel) const override
Turn back information as a string.
Definition: coupling_geometry_mapper.h:69
MapperLocalSystemUniquePointer Create(GeometryPointerType pGeometry) const override
Definition: coupling_geometry_mapper.h:63
void CalculateAll(MatrixType &rLocalMappingMatrix, EquationIdVectorType &rOriginIds, EquationIdVectorType &rDestinationIds, MapperLocalSystem::PairingStatus &rPairingStatus) const override
Definition: coupling_geometry_mapper.cpp:30
Definition: coupling_geometry_mapper.h:94
void InverseMap(const Variable< double > &rOriginVariable, const Variable< double > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Destination to Origin, Scalar Variable Data is exchanged on the Interface,...
Definition: coupling_geometry_mapper.h:194
void UpdateInterface(Kratos::Flags MappingOptions, double SearchRadius) override
Updates the mapping-system after the geometry/mesh has changed After changes in the topology (e....
Definition: coupling_geometry_mapper.h:147
Mapper< TSparseSpace, TDenseSpace > BaseType
Definition: coupling_geometry_mapper.h:105
TSparseSpace::VectorType TSystemVectorType
Definition: coupling_geometry_mapper.h:122
~CouplingGeometryMapper() override=default
Destructor.
CouplingGeometryMapper(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination)
Definition: coupling_geometry_mapper.h:130
ModelPart & GetInterfaceModelPartDestination() override
Definition: coupling_geometry_mapper.h:274
InterfaceVectorContainer< TSparseSpace, TDenseSpace > InterfaceVectorContainerType
Definition: coupling_geometry_mapper.h:110
Kratos::shared_ptr< LinearSolverType > LinearSolverSharedPointerType
Definition: coupling_geometry_mapper.h:120
LinearSolver< TSparseSpace, TDenseSpace > LinearSolverType
Definition: coupling_geometry_mapper.h:119
std::size_t IndexType
Definition: coupling_geometry_mapper.h:113
Kratos::unique_ptr< TSystemVectorType > TSystemVectorUniquePointerType
Definition: coupling_geometry_mapper.h:123
KRATOS_CLASS_POINTER_DEFINITION(CouplingGeometryMapper)
MapperUniquePointerType Clone(ModelPart &rModelPartOrigin, ModelPart &rModelPartDestination, Parameters JsonParameters) const override
Cloning the Mapper returns a clone of the current Mapper pure virtual, has to be implemented in every...
Definition: coupling_geometry_mapper.h:230
Kratos::unique_ptr< InterfaceVectorContainerType > InterfaceVectorContainerPointerType
Definition: coupling_geometry_mapper.h:111
Kratos::unique_ptr< MapperLocalSystem > MapperLocalSystemPointer
Definition: coupling_geometry_mapper.h:107
void Map(const Variable< array_1d< double, 3 > > &rOriginVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Origin to Destination, Vector Variable Same as Map, but maps an array3-variable.
Definition: coupling_geometry_mapper.h:176
void InverseMap(const Variable< array_1d< double, 3 > > &rOriginVariable, const Variable< array_1d< double, 3 > > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Destination to Origin, Vector Variable Same as InveseMap, but maps an array3-variable.
Definition: coupling_geometry_mapper.h:207
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: coupling_geometry_mapper.h:255
void PrintData(std::ostream &rOStream) const override
Print object's data.
Definition: coupling_geometry_mapper.h:261
void Map(const Variable< double > &rOriginVariable, const Variable< double > &rDestinationVariable, Kratos::Flags MappingOptions) override
Mapping from Origin to Destination, Scalar Variable Data is exchanged on the Interface,...
Definition: coupling_geometry_mapper.h:158
std::string Info() const override
Turn back information as a string.
Definition: coupling_geometry_mapper.h:249
std::vector< MapperLocalSystemPointer > MapperLocalSystemPointerVector
Definition: coupling_geometry_mapper.h:108
BaseType::MapperUniquePointerType MapperUniquePointerType
Definition: coupling_geometry_mapper.h:115
ModelPart & GetInterfaceModelPartOrigin() override
Definition: coupling_geometry_mapper.h:268
MappingMatrixType & GetMappingMatrix() override
This method returns the mapping-matrix.
Definition: coupling_geometry_mapper.h:224
Kratos::unique_ptr< MappingMatrixType > MappingMatrixUniquePointerType
Definition: coupling_geometry_mapper.h:117
BaseType::TMappingMatrixType MappingMatrixType
Definition: coupling_geometry_mapper.h:116
void Set(const Flags ThisFlag)
Definition: flags.cpp:33
bool Is(Flags const &rOther) const
Definition: flags.h:274
void Reset(const Flags ThisFlag)
Definition: flags.h:193
Geometry base class.
Definition: geometry.h:71
Short class definition.
Definition: interface_vector_container.h:40
Base class for all the linear solvers in Kratos.
Definition: linear_solver.h:65
Base Class for all Mappers.
Definition: mapper.h:43
TSparseSpace::MatrixType TMappingMatrixType
Definition: mapper.h:55
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: mapper.h:205
Kratos::unique_ptr< Mapper > MapperUniquePointerType
Definition: mapper.h:53
This is the "Condition" of the mappers.
Definition: mapper_local_system.h:39
PairingStatus
Definition: mapper_local_system.h:63
std::vector< int > EquationIdVectorType
Definition: mapper_local_system.h:53
MapperInterfaceInfo::CoordinatesArrayType CoordinatesArrayType
Definition: mapper_local_system.h:50
Kratos::unique_ptr< MapperLocalSystem > MapperLocalSystemUniquePointer
Definition: mapper_local_system.h:48
Matrix MatrixType
Definition: mapper_local_system.h:52
InterfaceObject::GeometryPointerType GeometryPointerType
Definition: mapper_local_system.h:56
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
Communicator & GetCommunicator()
Definition: model_part.h:1821
ModelPart & GetSubModelPart(std::string const &SubModelPartName)
Definition: model_part.cpp:2029
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_DEBUG_ERROR_IF_NOT(conditional)
Definition: exception.h:172
static int EchoLevel
Definition: co_sim_EMPIRE_API.h:42
void AssignInterfaceEquationIds(Communicator &rModelPartCommunicator)
Assigning INTERFACE_EQUATION_IDs to the nodes, with and without MPI This function assigns the INTERFA...
Definition: mapper_utilities.cpp:34
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::shared_ptr< T > shared_ptr
Definition: smart_pointers.h:27
std::unique_ptr< T > unique_ptr
Definition: smart_pointers.h:33