14 #if !defined(KRATOS_NODAL_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER)
15 #define KRATOS_NODAL_RESIDUAL_BASED_ELIMINATION_BUILDER_AND_SOLVER
25 #ifdef USE_GOOGLE_HASH
26 #include "sparsehash/dense_hash_set"
28 #include <unordered_set>
74 template <
class TSparseSpace,
123 typename TLinearSolver::Pointer pNewLinearSystemSolver)
124 :
BuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>(pNewLinearSystemSolver)
146 double &deviatoricCoeff,
147 double &volumetricCoeff,
152 deviatoricCoeff = itNode->FastGetSolutionStepValue(DEVIATORIC_COEFFICIENT);
153 density = itNode->FastGetSolutionStepValue(DENSITY);
155 volumetricCoeff = timeInterval * itNode->FastGetSolutionStepValue(BULK_MODULUS);
157 if (volumetricCoeff > 0)
159 volumetricCoeff = timeInterval * itNode->FastGetSolutionStepValue(BULK_MODULUS);
160 double bulkReduction =
density * nodalVolume / (timeInterval * volumetricCoeff);
161 volumetricCoeff *= bulkReduction;
166 typename TSchemeType::Pointer pScheme,
184 const double timeInterval = CurrentProcessInfo[DELTA_TIME];
185 const double FourThirds = 4.0 / 3.0;
186 const double nTwoThirds = -2.0 / 3.0;
198 unsigned int firstRow = 0;
199 unsigned int firstCol = 0;
202 double deviatoricCoeff = 0;
203 double volumetricCoeff = 0;
215 Vector nodalSFDneighboursId = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS_ORDER);
217 const unsigned int neighSize = nodalSFDneighboursId.size();
218 const double nodalVolume = itNode->FastGetSolutionStepValue(NODAL_VOLUME);
220 if (neighSize > 1 && nodalVolume > 0)
223 const unsigned int localSize = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS).size();
225 if (LHS_Contribution.size1() != localSize)
226 LHS_Contribution.
resize(localSize, localSize,
false);
228 if (RHS_Contribution.size() != localSize)
229 RHS_Contribution.resize(localSize,
false);
231 if (EquationId.size() != localSize)
232 EquationId.resize(localSize,
false);
245 LHS_Contribution(0, 0) += nodalVolume *
density * 2.0 / timeInterval;
246 LHS_Contribution(1, 1) += nodalVolume *
density * 2.0 / timeInterval;
250 Acc = 2.0 * (itNode->FastGetSolutionStepValue(VELOCITY, 0) - itNode->FastGetSolutionStepValue(VELOCITY, 1)) / timeInterval -
251 itNode->FastGetSolutionStepValue(ACCELERATION, 0);
253 RHS_Contribution[0] += -nodalVolume *
density * Acc[0];
254 RHS_Contribution[1] += -nodalVolume *
density * Acc[1];
258 array_1d<double, 3> &VolumeAcceleration = itNode->FastGetSolutionStepValue(VOLUME_ACCELERATION);
274 RHS_Contribution[0] += nodalVolume *
density * VolumeAcceleration[0];
275 RHS_Contribution[1] += nodalVolume *
density * VolumeAcceleration[1];
279 Sigma = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS);
281 pressure = itNode->FastGetSolutionStepValue(PRESSURE, 0) * theta + itNode->FastGetSolutionStepValue(PRESSURE, 1) * (1 - theta);
282 Sigma[0] = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[0] +
pressure;
283 Sigma[1] = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[1] +
pressure;
285 const unsigned int xDofPos = itNode->GetDofPosition(VELOCITY_X);
286 EquationId[0] = itNode->GetDof(VELOCITY_X, xDofPos).EquationId();
287 EquationId[1] = itNode->GetDof(VELOCITY_Y, xDofPos + 1).EquationId();
289 for (
unsigned int i = 0;
i < neighSize;
i++)
291 dNdXi = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstCol];
292 dNdYi = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstCol + 1];
294 RHS_Contribution[firstCol] += -nodalVolume * (dNdXi * Sigma[0] + dNdYi * Sigma[2]);
295 RHS_Contribution[firstCol + 1] += -nodalVolume * (dNdYi * Sigma[1] + dNdXi * Sigma[2]);
297 for (
unsigned int j = 0;
j < neighSize;
j++)
299 dNdXj = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstRow];
300 dNdYj = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstRow + 1];
302 LHS_Contribution(firstRow, firstCol) += nodalVolume * ((FourThirds * deviatoricCoeff + volumetricCoeff) * dNdXj * dNdXi + dNdYj * dNdYi * deviatoricCoeff) * theta;
303 LHS_Contribution(firstRow, firstCol + 1) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdXj * dNdYi + dNdYj * dNdXi * deviatoricCoeff) * theta;
305 LHS_Contribution(firstRow + 1, firstCol) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdYj * dNdXi + dNdXj * dNdYi * deviatoricCoeff) * theta;
306 LHS_Contribution(firstRow + 1, firstCol + 1) += nodalVolume * ((FourThirds * deviatoricCoeff + volumetricCoeff) * dNdYj * dNdYi + dNdXj * dNdXi * deviatoricCoeff) * theta;
314 if (
i < neighb_nodes.
size())
316 EquationId[firstCol] = neighb_nodes[
i].GetDof(VELOCITY_X, xDofPos).EquationId();
317 EquationId[firstCol + 1] = neighb_nodes[
i].GetDof(VELOCITY_Y, xDofPos + 1).EquationId();
324 LHS_Contribution(0, 0) += nodalVolume *
density * 2.0 / timeInterval;
325 LHS_Contribution(1, 1) += nodalVolume *
density * 2.0 / timeInterval;
326 LHS_Contribution(2, 2) += nodalVolume *
density * 2.0 / timeInterval;
330 Acc = 2.0 * (itNode->FastGetSolutionStepValue(VELOCITY, 0) - itNode->FastGetSolutionStepValue(VELOCITY, 1)) / timeInterval -
331 itNode->FastGetSolutionStepValue(ACCELERATION, 0);
333 RHS_Contribution[0] += -nodalVolume *
density * Acc[0];
334 RHS_Contribution[1] += -nodalVolume *
density * Acc[1];
335 RHS_Contribution[2] += -nodalVolume *
density * Acc[2];
339 array_1d<double, 3> &VolumeAcceleration = itNode->FastGetSolutionStepValue(VOLUME_ACCELERATION);
341 RHS_Contribution[0] += nodalVolume *
density * VolumeAcceleration[0];
342 RHS_Contribution[1] += nodalVolume *
density * VolumeAcceleration[1];
343 RHS_Contribution[2] += nodalVolume *
density * VolumeAcceleration[2];
348 Sigma = itNode->FastGetSolutionStepValue(NODAL_CAUCHY_STRESS);
350 pressure = itNode->FastGetSolutionStepValue(PRESSURE, 0) * theta + itNode->FastGetSolutionStepValue(PRESSURE, 1) * (1 - theta);
351 Sigma[0] = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[0] +
pressure;
352 Sigma[1] = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[1] +
pressure;
353 Sigma[2] = itNode->FastGetSolutionStepValue(NODAL_DEVIATORIC_CAUCHY_STRESS)[2] +
pressure;
355 const unsigned int xDofPos = itNode->GetDofPosition(VELOCITY_X);
356 EquationId[0] = itNode->GetDof(VELOCITY_X, xDofPos).EquationId();
357 EquationId[1] = itNode->GetDof(VELOCITY_Y, xDofPos + 1).EquationId();
358 EquationId[2] = itNode->GetDof(VELOCITY_Z, xDofPos + 2).EquationId();
360 for (
unsigned int i = 0;
i < neighSize;
i++)
362 dNdXi = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstCol];
363 dNdYi = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstCol + 1];
364 dNdZi = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstCol + 2];
366 RHS_Contribution[firstCol] += -nodalVolume * (dNdXi * Sigma[0] + dNdYi * Sigma[3] + dNdZi * Sigma[4]);
367 RHS_Contribution[firstCol + 1] += -nodalVolume * (dNdYi * Sigma[1] + dNdXi * Sigma[3] + dNdZi * Sigma[5]);
368 RHS_Contribution[firstCol + 2] += -nodalVolume * (dNdZi * Sigma[2] + dNdXi * Sigma[4] + dNdYi * Sigma[5]);
370 for (
unsigned int j = 0;
j < neighSize;
j++)
373 dNdXj = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstRow];
374 dNdYj = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstRow + 1];
375 dNdZj = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS)[firstRow + 2];
377 LHS_Contribution(firstRow, firstCol) += nodalVolume * ((FourThirds * deviatoricCoeff + volumetricCoeff) * dNdXj * dNdXi + (dNdYj * dNdYi + dNdZj * dNdZi) * deviatoricCoeff) * theta;
378 LHS_Contribution(firstRow, firstCol + 1) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdXj * dNdYi + dNdYj * dNdXi * deviatoricCoeff) * theta;
379 LHS_Contribution(firstRow, firstCol + 2) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdXj * dNdZi + dNdZj * dNdXi * deviatoricCoeff) * theta;
381 LHS_Contribution(firstRow + 1, firstCol) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdYj * dNdXi + dNdXj * dNdYi * deviatoricCoeff) * theta;
382 LHS_Contribution(firstRow + 1, firstCol + 1) += nodalVolume * ((FourThirds * deviatoricCoeff + volumetricCoeff) * dNdYj * dNdYi + (dNdXj * dNdXi + dNdZj * dNdZi) * deviatoricCoeff) * theta;
383 LHS_Contribution(firstRow + 1, firstCol + 2) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdYj * dNdZi + dNdZj * dNdYi * deviatoricCoeff) * theta;
385 LHS_Contribution(firstRow + 2, firstCol) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdZj * dNdXi + dNdXj * dNdZi * deviatoricCoeff) * theta;
386 LHS_Contribution(firstRow + 2, firstCol + 1) += nodalVolume * ((nTwoThirds * deviatoricCoeff + volumetricCoeff) * dNdZj * dNdYi + dNdYj * dNdZi * deviatoricCoeff) * theta;
387 LHS_Contribution(firstRow + 2, firstCol + 2) += nodalVolume * ((FourThirds * deviatoricCoeff + volumetricCoeff) * dNdZj * dNdZi + (dNdXj * dNdXi + dNdYj * dNdYi) * deviatoricCoeff) * theta;
395 if (
i < neighb_nodes.
size())
397 EquationId[firstCol] = neighb_nodes[
i].GetDof(VELOCITY_X, xDofPos).EquationId();
398 EquationId[firstCol + 1] = neighb_nodes[
i].GetDof(VELOCITY_Y, xDofPos + 1).EquationId();
399 EquationId[firstCol + 2] = neighb_nodes[
i].GetDof(VELOCITY_Z, xDofPos + 2).EquationId();
405 Assemble(
A,
b, LHS_Contribution, RHS_Contribution, EquationId, mlock_array);
407 Assemble(
A,
b, LHS_Contribution, RHS_Contribution, EquationId);
442 TSparseSpace::SetToZero(Dx);
482 TSparseSpace::SetToZero(Dx);
503 typename TSchemeType::Pointer pScheme,
521 <<
"\nSystem Matrix = " << A <<
"\nUnknowns vector = " << Dx <<
"\nRHS vector = " <<
b << std::endl;
526 <<
"\nSystem Matrix = " << A <<
"\nUnknowns vector = " << Dx <<
"\nRHS vector = " <<
b << std::endl;
540 typename TSchemeType::Pointer pScheme,
549 const int nelements =
static_cast<int>(pElements.size());
557 #ifdef USE_GOOGLE_HASH
558 typedef google::dense_hash_set<NodeType::DofType::Pointer, DofPointerHasher> set_type;
560 typedef std::unordered_set<NodeType::DofType::Pointer, DofPointerHasher> set_type;
564 std::vector<set_type> dofs_aux_list(nthreads);
567 for (
int i = 0; i < static_cast<int>(nthreads);
i++)
569 #ifdef USE_GOOGLE_HASH
572 dofs_aux_list[
i].reserve(nelements);
576 for (
int i = 0; i < static_cast<int>(nelements); ++
i)
578 auto it_elem = pElements.begin() +
i;
582 pScheme->GetDofList(*it_elem, ElementalDofList, CurrentProcessInfo);
584 dofs_aux_list[this_thread_id].insert(ElementalDofList.begin(), ElementalDofList.end());
588 const int nconditions =
static_cast<int>(pConditions.size());
589 #pragma omp parallel for firstprivate(nconditions, ElementalDofList)
590 for (
int i = 0;
i < nconditions; ++
i)
592 auto it_cond = pConditions.begin() +
i;
596 pScheme->GetDofList(*it_cond, ElementalDofList, CurrentProcessInfo);
597 dofs_aux_list[this_thread_id].insert(ElementalDofList.begin(), ElementalDofList.end());
601 unsigned int old_max = nthreads;
602 unsigned int new_max = ceil(0.5 *
static_cast<double>(old_max));
603 while (new_max >= 1 && new_max != old_max)
606 #pragma omp parallel for
607 for (
int i = 0; i < static_cast<int>(new_max);
i++)
609 if (
i + new_max < old_max)
611 dofs_aux_list[
i].insert(dofs_aux_list[
i + new_max].begin(), dofs_aux_list[
i + new_max].end());
612 dofs_aux_list[
i + new_max].clear();
617 new_max = ceil(0.5 *
static_cast<double>(old_max));
623 Doftemp.
reserve(dofs_aux_list[0].size());
624 for (
auto it = dofs_aux_list[0].begin(); it != dofs_aux_list[0].end(); it++)
640 if (mlock_array.size() != 0)
642 for (
int i = 0; i < static_cast<int>(mlock_array.size());
i++)
643 omp_destroy_lock(&mlock_array[
i]);
648 for (
int i = 0; i < static_cast<int>(mlock_array.size());
i++)
649 omp_init_lock(&mlock_array[
i]);
659 KRATOS_ERROR_IF_NOT(dof_iterator->HasReaction()) <<
"Reaction variable not set for the following : " << std::endl
660 <<
"Node : " << dof_iterator->Id() << std::endl
661 <<
"Dof : " << (*dof_iterator) << std::endl
662 <<
"Not possible to calculate reactions." << std::endl;
688 if (dof_iterator->IsFixed())
689 dof_iterator->SetEquationId(--fix_id);
691 dof_iterator->SetEquationId(free_id++);
700 typename TSchemeType::Pointer pScheme,
745 KRATOS_WATCH(
"it should not come here!!!!!!!! ... this is SLOW");
746 KRATOS_ERROR <<
"The equation system size has changed during the simulation. This is not permited." << std::endl;
783 typename TSchemeType::Pointer pScheme,
804 KRATOS_INFO_IF(
"NodalResidualBasedEliminationBuilderAndSolver", this->
GetEchoLevel() > 1) <<
"Clear Function called" << std::endl;
860 std::vector<omp_lock_t> &lock_array
864 unsigned int local_size = LHS_Contribution.size1();
866 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
868 unsigned int i_global = EquationId[i_local];
873 omp_set_lock(&lock_array[i_global]);
875 b[i_global] += RHS_Contribution(i_local);
876 for (
unsigned int j_local = 0; j_local <
local_size; j_local++)
878 unsigned int j_global = EquationId[j_local];
881 A(i_global, j_global) += LHS_Contribution(i_local, j_local);
885 omp_unset_lock(&lock_array[i_global]);
894 typename TSchemeType::Pointer pScheme,
905 const int nconditions =
static_cast<int>(rModelPart.
Conditions().size());
906 ModelPart::ConditionsContainerType::iterator cond_begin = rModelPart.
ConditionsBegin();
910 #ifdef USE_GOOGLE_HASH
911 std::vector<google::dense_hash_set<std::size_t>> indices(equation_size);
912 const std::size_t empty_key = 2 * equation_size + 10;
914 std::vector<std::unordered_set<std::size_t>> indices(equation_size);
917 #pragma omp parallel for firstprivate(equation_size)
918 for (
int iii = 0; iii < static_cast<int>(equation_size); iii++)
920 #ifdef USE_GOOGLE_HASH
921 indices[iii].set_empty_key(empty_key);
923 indices[iii].reserve(40);
935 const unsigned int localSize = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS).size();
938 Vector nodalSFDneighboursId = itNode->FastGetSolutionStepValue(NODAL_SFD_NEIGHBOURS_ORDER);
940 if (EquationId.size() != localSize)
941 EquationId.
resize(localSize,
false);
943 unsigned int firstCol = 0;
945 const unsigned int xDofPos = itNode->GetDofPosition(VELOCITY_X);
946 EquationId[0] = itNode->GetDof(VELOCITY_X, xDofPos).EquationId();
947 EquationId[1] = itNode->GetDof(VELOCITY_Y, xDofPos + 1).EquationId();
949 EquationId[2] = itNode->GetDof(VELOCITY_Z, xDofPos + 2).EquationId();
952 for (
unsigned int i = 0;
i < neighb_nodes.
size();
i++)
955 EquationId[firstCol] = neighb_nodes[
i].GetDof(VELOCITY_X, xDofPos).EquationId();
956 EquationId[firstCol + 1] = neighb_nodes[
i].GetDof(VELOCITY_Y, xDofPos + 1).EquationId();
959 EquationId[firstCol + 2] = neighb_nodes[
i].GetDof(VELOCITY_Z, xDofPos + 2).EquationId();
963 for (std::size_t
i = 0;
i < EquationId.size();
i++)
968 omp_set_lock(&mlock_array[EquationId[
i]]);
971 auto &row_indices = indices[EquationId[
i]];
972 for (
auto it = EquationId.begin(); it != EquationId.end(); it++)
977 row_indices.insert(*it);
981 omp_unset_lock(&mlock_array[EquationId[
i]]);
989 #pragma omp parallel for firstprivate(nconditions, ids)
990 for (
int iii = 0; iii < nconditions; iii++)
992 typename ConditionsArrayType::iterator i_condition = cond_begin + iii;
993 pScheme->EquationId(*i_condition, ids, CurrentProcessInfo);
994 for (std::size_t
i = 0;
i < ids.size();
i++)
999 omp_set_lock(&mlock_array[ids[
i]]);
1001 auto &row_indices = indices[ids[
i]];
1002 for (
auto it = ids.begin(); it != ids.end(); it++)
1005 row_indices.insert(*it);
1008 omp_unset_lock(&mlock_array[ids[
i]]);
1015 unsigned int nnz = 0;
1016 for (
unsigned int i = 0;
i < indices.size();
i++)
1017 nnz += indices[
i].size();
1019 A = boost::numeric::ublas::compressed_matrix<double>(indices.size(), indices.size(), nnz);
1021 double *Avalues =
A.value_data().begin();
1022 std::size_t *Arow_indices =
A.index1_data().begin();
1023 std::size_t *Acol_indices =
A.index2_data().begin();
1026 Arow_indices[0] = 0;
1027 for (
int i = 0; i < static_cast<int>(
A.size1());
i++)
1028 Arow_indices[
i + 1] = Arow_indices[
i] + indices[
i].size();
1030 #pragma omp parallel for
1031 for (
int i = 0; i < static_cast<int>(
A.size1());
i++)
1033 const unsigned int row_begin = Arow_indices[
i];
1034 const unsigned int row_end = Arow_indices[
i + 1];
1035 unsigned int k = row_begin;
1036 for (
auto it = indices[
i].begin(); it != indices[
i].end(); it++)
1038 Acol_indices[
k] = *it;
1043 std::sort(&Acol_indices[row_begin], &Acol_indices[row_end]);
1046 A.set_filled(indices.size() + 1, nnz);
1056 unsigned int local_size = LHS_Contribution.size1();
1058 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1060 unsigned int i_global = EquationId[i_local];
1063 for (
unsigned int j_local = 0; j_local <
local_size; j_local++)
1065 unsigned int j_global = EquationId[j_local];
1067 A(i_global, j_global) += LHS_Contribution(i_local, j_local);
1095 std::vector<omp_lock_t> mlock_array;
1105 inline void AddUnique(std::vector<std::size_t> &
v,
const std::size_t &candidate)
1107 std::vector<std::size_t>::iterator
i =
v.begin();
1108 std::vector<std::size_t>::iterator endit =
v.end();
1109 while (
i != endit && (*
i) != candidate)
1115 v.push_back(candidate);
1124 unsigned int local_size = RHS_Contribution.size();
1128 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1130 const unsigned int i_global = EquationId[i_local];
1135 double &b_value =
b[i_global];
1136 const double &rhs_value = RHS_Contribution[i_local];
1139 b_value += rhs_value;
1146 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1148 const unsigned int i_global = EquationId[i_local];
1153 double &b_value =
b[i_global];
1154 const double &rhs_value = RHS_Contribution[i_local];
1157 b_value += rhs_value;
1162 const double &rhs_value = RHS_Contribution[i_local];
1165 b_value += rhs_value;
1173 void AssembleLHS_CompleteOnFreeRows(
1178 unsigned int local_size = LHS_Contribution.size1();
1179 for (
unsigned int i_local = 0; i_local <
local_size; i_local++)
1181 unsigned int i_global = EquationId[i_local];
1184 for (
unsigned int j_local = 0; j_local <
local_size; j_local++)
1186 int j_global = EquationId[j_local];
1187 A(i_global, j_global) += LHS_Contribution(i_local, j_local);
Current class provides an implementation for the base builder and solving operations.
Definition: builder_and_solver.h:64
std::size_t IndexType
Definition of the index type.
Definition: builder_and_solver.h:76
bool mDofSetIsInitialized
If the matrix is reshaped each step.
Definition: builder_and_solver.h:743
TSparseSpace::VectorType TSystemVectorType
Definition of the vector size.
Definition: builder_and_solver.h:85
ModelPart::NodesContainerType NodesArrayType
The containers of the entities.
Definition: builder_and_solver.h:109
bool GetCalculateReactionsFlag() const
This method returns the flag mCalculateReactionsFlag.
Definition: builder_and_solver.h:184
TSparseSpace::MatrixType TSystemMatrixType
Definition of the sparse matrix.
Definition: builder_and_solver.h:82
ModelPart::ConditionsContainerType ConditionsArrayType
Definition: builder_and_solver.h:111
TSystemVectorPointerType mpReactionsVector
Definition: builder_and_solver.h:751
bool GetReshapeMatrixFlag() const
This method returns the flag mReshapeMatrixFlag.
Definition: builder_and_solver.h:220
TDenseSpace::MatrixType LocalSystemMatrixType
The local matrix definition.
Definition: builder_and_solver.h:94
TSparseSpace::VectorPointerType TSystemVectorPointerType
Definition of the pointer to the vector.
Definition: builder_and_solver.h:91
TSparseSpace::DataType TDataType
Definition of the data type.
Definition: builder_and_solver.h:79
TLinearSolver::Pointer mpLinearSystemSolver
Definition: builder_and_solver.h:737
DofsArrayType mDofSet
Pointer to the linear solver.
Definition: builder_and_solver.h:739
TDenseSpace::VectorType LocalSystemVectorType
The local vector definition.
Definition: builder_and_solver.h:97
TSparseSpace::MatrixPointerType TSystemMatrixPointerType
Definition of the pointer to the sparse matrix.
Definition: builder_and_solver.h:88
bool mCalculateReactionsFlag
Flag taking care if the dof set was initialized ot not.
Definition: builder_and_solver.h:745
int GetEchoLevel() const
It returns the echo level.
Definition: builder_and_solver.h:674
unsigned int mEquationSystemSize
Flag taking in account if it is needed or not to calculate the reactions.
Definition: builder_and_solver.h:747
ModelPart::ElementsContainerType ElementsArrayType
Definition: builder_and_solver.h:110
virtual int MyPID() const
Definition: communicator.cpp:91
Dof * Pointer
Pointer definition of Dof.
Definition: dof.h:93
std::vector< DofType::Pointer > DofsVectorType
Definition: element.h:100
std::vector< std::size_t > EquationIdVectorType
Definition: element.h:98
This class is a vector which stores global pointers.
Definition: global_pointers_vector.h:61
size_type size() const
Definition: global_pointers_vector.h:307
void resize(std::size_t NewSize1, std::size_t NewSize2, bool preserve=0)
Definition: amatrix_interface.h:224
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
ConditionIterator ConditionsBegin(IndexType ThisIndex=0)
Definition: model_part.h:1361
Communicator & GetCommunicator()
Definition: model_part.h:1821
ConditionsContainerType & Conditions(IndexType ThisIndex=0)
Definition: model_part.h:1381
ProcessInfo & GetProcessInfo()
Definition: model_part.h:1746
MeshType::NodeIterator NodeIterator
Definition: model_part.h:134
ElementsContainerType & Elements(IndexType ThisIndex=0)
Definition: model_part.h:1189
NodesContainerType & Nodes(IndexType ThisIndex=0)
Definition: model_part.h:507
Current class provides an implementation for standard builder and solving operations.
Definition: nodal_residualbased_elimination_builder_and_solver.h:80
Node NodeType
Definition: nodal_residualbased_elimination_builder_and_solver.h:105
BaseType::TSystemVectorPointerType TSystemVectorPointerType
Definition: nodal_residualbased_elimination_builder_and_solver.h:103
void SetUpSystem(ModelPart &rModelPart) override
Organises the dofset in order to speed up the building phase.
Definition: nodal_residualbased_elimination_builder_and_solver.h:674
KRATOS_CLASS_POINTER_DEFINITION(NodalResidualBasedEliminationBuilderAndSolver)
BaseType::ElementsContainerType ElementsContainerType
Definition: nodal_residualbased_elimination_builder_and_solver.h:111
void SystemSolveWithPhysics(TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b, ModelPart &rModelPart)
This is a call to the linear system solver (taking into account some physical particularities of the ...
Definition: nodal_residualbased_elimination_builder_and_solver.h:457
BaseType::TSystemMatrixType TSystemMatrixType
Definition: nodal_residualbased_elimination_builder_and_solver.h:94
void BuildFluidNodally(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &b)
Definition: nodal_residualbased_elimination_builder_and_solver.h:165
GlobalPointersVector< Node > NodeWeakPtrVectorType
Definition: nodal_residualbased_elimination_builder_and_solver.h:114
BaseType::DofsArrayType DofsArrayType
Definition: nodal_residualbased_elimination_builder_and_solver.h:92
BaseType::LocalSystemVectorType LocalSystemVectorType
Definition: nodal_residualbased_elimination_builder_and_solver.h:98
BaseType::TSystemMatrixPointerType TSystemMatrixPointerType
Definition: nodal_residualbased_elimination_builder_and_solver.h:102
void SetUpDofSet(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart) override
Builds the list of the DofSets involved in the problem by "asking" to each element and condition its ...
Definition: nodal_residualbased_elimination_builder_and_solver.h:539
void ResizeAndInitializeVectors(typename TSchemeType::Pointer pScheme, TSystemMatrixPointerType &pA, TSystemVectorPointerType &pDx, TSystemVectorPointerType &pb, ModelPart &rModelPart) override
This method initializes and resizes the system of equations.
Definition: nodal_residualbased_elimination_builder_and_solver.h:699
void Assemble(TSystemMatrixType &A, TSystemVectorType &b, const LocalSystemMatrixType &LHS_Contribution, const LocalSystemVectorType &RHS_Contribution, const Element::EquationIdVectorType &EquationId)
Definition: nodal_residualbased_elimination_builder_and_solver.h:852
BaseType::ConditionsArrayType ConditionsArrayType
Definition: nodal_residualbased_elimination_builder_and_solver.h:109
BaseType::TSystemVectorType TSystemVectorType
Definition: nodal_residualbased_elimination_builder_and_solver.h:96
BaseType::NodesArrayType NodesArrayType
Definition: nodal_residualbased_elimination_builder_and_solver.h:107
void Clear() override
This function is intended to be called at the end of the solution step to clean up memory storage not...
Definition: nodal_residualbased_elimination_builder_and_solver.h:794
void SystemSolve(TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
This is a call to the linear system solver.
Definition: nodal_residualbased_elimination_builder_and_solver.h:423
int Check(ModelPart &rModelPart) override
This function is designed to be called once to perform all the checks needed on the input provided....
Definition: nodal_residualbased_elimination_builder_and_solver.h:814
NodalResidualBasedEliminationBuilderAndSolver(typename TLinearSolver::Pointer pNewLinearSystemSolver)
Definition: nodal_residualbased_elimination_builder_and_solver.h:122
void ApplyDirichletConditions(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Applies the dirichlet conditions. This operation may be very heavy or completely unexpensive dependin...
Definition: nodal_residualbased_elimination_builder_and_solver.h:782
BaseType::LocalSystemMatrixType LocalSystemMatrixType
Definition: nodal_residualbased_elimination_builder_and_solver.h:100
void BuildAndSolve(typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &A, TSystemVectorType &Dx, TSystemVectorType &b) override
Function to perform the building and solving phase at the same time.
Definition: nodal_residualbased_elimination_builder_and_solver.h:502
void SetMaterialPropertiesToFluid(ModelPart::NodeIterator itNode, double &density, double &deviatoricCoeff, double &volumetricCoeff, double timeInterval, double nodalVolume)
Definition: nodal_residualbased_elimination_builder_and_solver.h:143
BaseType::TDataType TDataType
Definition: nodal_residualbased_elimination_builder_and_solver.h:90
void AssembleLHS(TSystemMatrixType &A, LocalSystemMatrixType &LHS_Contribution, Element::EquationIdVectorType &EquationId)
Definition: nodal_residualbased_elimination_builder_and_solver.h:1051
BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > BaseType
Definition: nodal_residualbased_elimination_builder_and_solver.h:86
BaseType::ElementsArrayType ElementsArrayType
Definition: nodal_residualbased_elimination_builder_and_solver.h:108
BaseType::TSchemeType TSchemeType
Definition: nodal_residualbased_elimination_builder_and_solver.h:88
Vector VectorType
Definition: nodal_residualbased_elimination_builder_and_solver.h:113
virtual void ConstructMatrixStructure(typename TSchemeType::Pointer pScheme, TSystemMatrixType &A, ModelPart &rModelPart)
Definition: nodal_residualbased_elimination_builder_and_solver.h:893
~NodalResidualBasedEliminationBuilderAndSolver() override
Definition: nodal_residualbased_elimination_builder_and_solver.h:131
This class defines the node.
Definition: node.h:65
static int ThisThread()
Wrapper for omp_get_thread_num().
Definition: openmp_utils.h:108
static void PartitionedIterators(TVector &rVector, typename TVector::iterator &rBegin, typename TVector::iterator &rEnd)
Generate a partition for an std::vector-like array, providing iterators to the begin and end position...
Definition: openmp_utils.h:179
static int GetNumThreads()
Returns the current number of threads.
Definition: parallel_utilities.cpp:34
A sorted associative container similar to an STL set, but uses a vector to store pointers to its data...
Definition: pointer_vector_set.h:72
boost::indirect_iterator< typename TContainerType::iterator > iterator
Definition: pointer_vector_set.h:95
size_type size() const
Returns the number of elements in the container.
Definition: pointer_vector_set.h:502
void Sort()
Sort the elements in the set.
Definition: pointer_vector_set.h:753
void push_back(TPointerType x)
Adds a pointer to the end of the set.
Definition: pointer_vector_set.h:544
void reserve(int reservedsize)
Reserves memory for a specified number of elements.
Definition: pointer_vector_set.h:733
iterator end()
Returns an iterator pointing to the end of the container.
Definition: pointer_vector_set.h:314
ProcessInfo holds the current value of different solution parameters.
Definition: process_info.h:59
This class provides the implementation of the basic tasks that are needed by the solution strategy.
Definition: scheme.h:56
static void Start(std::string const &rIntervalName)
This method starts the timer meassures.
Definition: timer.cpp:109
static void Stop(std::string const &rIntervalName)
This method stops the timer meassures.
Definition: timer.cpp:125
#define KRATOS_CATCH(MoreInfo)
Definition: define.h:110
#define KRATOS_WATCH(variable)
Definition: define.h:806
#define KRATOS_TRY
Definition: define.h:109
#define KRATOS_ERROR
Definition: exception.h:161
#define KRATOS_ERROR_IF_NOT(conditional)
Definition: exception.h:163
#define KRATOS_ERROR_IF(conditional)
Definition: exception.h:162
#define KRATOS_INFO_IF(label, conditional)
Definition: logger.h:251
#define KRATOS_WARNING_IF(label, conditional)
Definition: logger.h:266
double TwoNorm(SparseSpaceType &dummy, SparseSpaceType::VectorType &x)
Definition: add_strategies_to_python.cpp:164
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
KratosZeroVector< double > ZeroVector
Definition: amatrix_interface.h:561
KratosZeroMatrix< double > ZeroMatrix
Definition: amatrix_interface.h:559
T & noalias(T &TheMatrix)
Definition: amatrix_interface.h:484
float density
Definition: face_heat.py:56
v
Definition: generate_convection_diffusion_explicit_element.py:114
int local_size
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:17
b
Definition: generate_total_lagrangian_mixed_volumetric_strain_element.py:31
int dimension
Definition: isotropic_damage_automatic_differentiation.py:123
int k
Definition: quadrature.py:595
int j
Definition: quadrature.py:648
A
Definition: sensitivityMatrix.py:70
integer i
Definition: TensorModule.f:17
float pressure
Definition: test_pureconvectionsolver_benchmarking.py:101