13 #if !defined(KRATOS_TRILINOS_LEVELSET_CONVECTION_PROCESS_INCLUDED )
14 #define KRATOS_TRILINOS_LEVELSET_CONVECTION_PROCESS_INCLUDED
19 #include "Epetra_MpiComm.h"
53 template<
unsigned int TDim,
class TSparseSpace,
class TDenseSpace,
class TLinearSolver >
81 Epetra_MpiComm& rEpetraCommunicator,
83 typename TLinearSolver::Pointer pLinearSolver,
87 rModel.GetModelPart(ThisParameters[
"model_part_name"].GetString()),
94 Epetra_MpiComm& rEpetraCommunicator,
96 typename TLinearSolver::Pointer pLinearSolver,
105 const int row_size_guess = (TDim == 2 ? 15 : 40);
106 auto p_builder_and_solver = Kratos::make_shared< TrilinosBlockBuilderAndSolver<TSparseSpace,TDenseSpace,TLinearSolver>>(
110 InitializeConvectionStrategy(p_builder_and_solver);
142 std::string
Info()
const override {
143 return "TrilinosLevelSetConvectionProcess";
148 rOStream <<
"TrilinosLevelSetConvectionProcess";
183 const auto base_buffer_size = rBaseModelPart.
GetBufferSize();
185 "Base model part buffer size is " << base_buffer_size <<
". Set it to a minimum value of 2." << std::endl;
210 Communicator::Pointer p_new_comm = r_base_comm.Create();
212 p_new_comm->SetNumberOfColors(r_base_comm.GetNumberOfColors());
213 p_new_comm->NeighbourIndices() = r_base_comm.NeighbourIndices();
214 p_new_comm->LocalMesh().SetNodes(r_base_comm.LocalMesh().pNodes());
215 p_new_comm->InterfaceMesh().SetNodes(r_base_comm.InterfaceMesh().pNodes());
216 p_new_comm->GhostMesh().SetNodes(r_base_comm.GhostMesh().pNodes());
217 for (
unsigned int i = 0;
i < r_base_comm.GetNumberOfColors(); ++
i){
218 p_new_comm->pInterfaceMesh(
i)->SetNodes(r_base_comm.pInterfaceMesh(
i)->pNodes());
219 p_new_comm->pLocalMesh(
i)->SetNodes(r_base_comm.pLocalMesh(
i)->pNodes());
220 p_new_comm->pGhostMesh(
i)->SetNodes(r_base_comm.pGhostMesh(
i)->pNodes());
232 it_elem->pGetGeometry(),
233 it_elem->pGetProperties());
303 KRATOS_ERROR_IF(r_base_model_part.GetCommunicator().GlobalNumberOfNodes() == 0) <<
"The model has no nodes." << std::endl;
304 KRATOS_ERROR_IF(r_base_model_part.GetCommunicator().GlobalNumberOfElements() == 0) <<
"The model has no elements." << std::endl;
307 if constexpr (TDim == 2){
309 KRATOS_ERROR_IF(has_incorrect_elems) <<
"In 2D the element type is expected to be a triangle" << std::endl;
310 }
else if constexpr (TDim == 3) {
312 KRATOS_ERROR_IF(has_incorrect_elems) <<
"In 3D the element type is expected to be a tetrahedra" << std::endl;
319 const bool calculate_reactions =
false;
320 const bool reform_dof_at_each_iteration =
false;
321 const bool calculate_norm_Dx_flag =
false;
322 auto p_scheme = Kratos::make_shared< ResidualBasedIncrementalUpdateStaticScheme< TSparseSpace,TDenseSpace > >();
328 reform_dof_at_each_iteration,
329 calculate_norm_Dx_flag);
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
The Commmunicator class manages communication for distributed ModelPart instances.
Definition: communicator.h:67
virtual Pointer Create(IndexType NewId, NodesArrayType const &ThisNodes, PropertiesType::Pointer pProperties) const
It creates a new element pointer.
Definition: element.h:202
Short class definition.
Definition: levelset_convection_process.h:71
Vector mError
Definition: levelset_convection_process.h:422
std::vector< array_1d< double, 3 > > mVelocityOld
Definition: levelset_convection_process.h:434
Vector mOldDistance
Definition: levelset_convection_process.h:424
bool mDistancePartIsInitialized
Definition: levelset_convection_process.h:436
Vector mSigmaPlus
Definition: levelset_convection_process.h:426
SolvingStrategyType::UniquePointer mpSolvingStrategy
Definition: levelset_convection_process.h:438
std::vector< array_1d< double, 3 > > mVelocity
Definition: levelset_convection_process.h:432
Vector mSigmaMinus
Definition: levelset_convection_process.h:428
const Element * mpConvectionFactoryElement
Definition: levelset_convection_process.h:444
const Variable< array_1d< double, 3 > > * mpConvectVar
Definition: levelset_convection_process.h:398
Vector mLimiter
Definition: levelset_convection_process.h:430
void InitializeDistanceModelPartDatabases()
Initializes the databases values This function initializes is intended to collect all the database in...
Definition: levelset_convection_process.h:586
const Variable< double > * mpLevelSetVar
Definition: levelset_convection_process.h:396
bool mIsBfecc
Definition: levelset_convection_process.h:406
ModelPart * mpDistanceModelPart
Definition: levelset_convection_process.h:394
ModelPart & mrBaseModelPart
Definition: levelset_convection_process.h:390
This class aims to manage different model parts across multi-physics simulations.
Definition: model.h:60
ModelPart & CreateModelPart(const std::string &ModelPartName, IndexType NewBufferSize=1)
This method creates a new model part contained in the current Model with a given name and buffer size...
Definition: model.cpp:37
void DeleteModelPart(const std::string &ModelPartName)
This method deletes a modelpart with a given name.
Definition: model.cpp:64
bool HasModelPart(const std::string &rFullModelPartName) const
This method checks if a certain a model part exists given a certain name.
Definition: model.cpp:178
This class aims to manage meshes for multi-physics simulations.
Definition: model_part.h:77
ElementIterator ElementsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1169
void SetCommunicator(Communicator::Pointer pNewCommunicator)
Definition: model_part.h:1836
void SetProcessInfo(ProcessInfo::Pointer pNewProcessInfo)
Definition: model_part.h:1766
void SetProperties(PropertiesContainerType::Pointer pOtherProperties, IndexType ThisIndex=0)
Definition: model_part.h:1013
ProcessInfo::Pointer pGetProcessInfo()
Definition: model_part.h:1756
Communicator & GetCommunicator()
Definition: model_part.h:1821
void SetBufferSize(IndexType NewBufferSize)
This method sets the suffer size of the model part database.
Definition: model_part.cpp:2171
IndexType GetBufferSize() const
This method gets the suffer size of the model part database.
Definition: model_part.h:1876
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
SizeType NumberOfElements(IndexType ThisIndex=0) const
Definition: model_part.h:1027
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
PropertiesContainerType::Pointer pProperties(IndexType ThisIndex=0)
Definition: model_part.h:1008
ElementIterator ElementsEnd(IndexType ThisIndex=0)
Definition: model_part.h:1179
TablesContainerType & Tables()
Definition: model_part.h:635
SizeType NumberOfNodes(IndexType ThisIndex=0) const
Definition: model_part.h:341
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Model & GetModel()
Definition: model_part.h:323
This class provides to Kratos a data structure for I/O based on the standard of JSON.
Definition: kratos_parameters.h:59
Short class definition.
Definition: trilinos_levelset_convection_process.h:56
TrilinosLevelSetConvectionProcess(Epetra_MpiComm &rEpetraCommunicator, ModelPart &rBaseModelPart, typename TLinearSolver::Pointer pLinearSolver, Parameters ThisParameters)
Definition: trilinos_levelset_convection_process.h:93
void PrintInfo(std::ostream &rOStream) const override
Print information about this object.
Definition: trilinos_levelset_convection_process.h:147
TrilinosLevelSetConvectionProcess(TrilinosLevelSetConvectionProcess const &rOther)=delete
Copy constructor.
KRATOS_CLASS_POINTER_DEFINITION(TrilinosLevelSetConvectionProcess)
Pointer definition of TrilinosLevelSetConvectionProcess.
KRATOS_DEFINE_LOCAL_FLAG(DO_EXPENSIVE_CHECKS)
LevelSetConvectionProcess< TDim, TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: trilinos_levelset_convection_process.h:65
void ReGenerateConvectionModelPart(ModelPart &rBaseModelPart) override
Definition: trilinos_levelset_convection_process.h:178
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Pointer BuilderSolverPointerType
Definition: trilinos_levelset_convection_process.h:67
Epetra_MpiComm & mrEpetraCommunicator
Definition: trilinos_levelset_convection_process.h:168
std::string Info() const override
Turn back information as a string.
Definition: trilinos_levelset_convection_process.h:142
TrilinosLevelSetConvectionProcess(Epetra_MpiComm &rEpetraCommunicator, Model &rModel, typename TLinearSolver::Pointer pLinearSolver, Parameters ThisParameters)
Definition: trilinos_levelset_convection_process.h:80
TLinearSolver::Pointer LinearSolverPointerType
Definition: trilinos_levelset_convection_process.h:66
KRATOS_DEFINE_LOCAL_FLAG(PERFORM_STEP1)
~TrilinosLevelSetConvectionProcess() override
Destructor.
Definition: trilinos_levelset_convection_process.h:119
This class implements a set of auxiliar, already parallelized, methods to perform some common tasks r...
Definition: variable_utils.h:63
int CheckVariableExists(const TVarType &rVariable, const NodesContainerType &rNodes)
Checks if all the nodes of a node set has the specified variable.
Definition: variable_utils.h:1051
void AddDof(const TVarType &rVar, ModelPart &rModelPart)
This function add dofs to the nodes in a model part. It is useful since addition is done in parallel.
Definition: variable_utils.h:1361
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
unique_ptr< C > make_unique(Args &&...args)
Definition: smart_pointers.h:45
int n_nodes
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:15
integer i
Definition: TensorModule.f:17