v0.14.0
Loading...
Searching...
No Matches
MultifieldPlasticity.hpp
Go to the documentation of this file.
1/** \file MultifieldPlasticity
2 * \brief Multifield plasticity
3
4*/
5
6/* This file is part of MoFEM.
7 * MoFEM is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * MoFEM is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>. */
19
20namespace MoFEM {
21
22extern boost::weak_ptr<BlockMatContainer> block_mat_container_ptr;
23
24template <typename EleOp>
26 : public OpBaseImpl<LAST_ASSEMBLE, EleOp> {
28
29protected:
30
33 const bool transpose) {
35
36 if (transpose) {
37 this->locMatTranspose.resize(this->locMat.size2(), this->locMat.size1(),
38 false);
39 noalias(this->locMatTranspose) = trans(this->locMat);
40 }
41
42 if (auto bmc_ptr = block_mat_container_ptr.lock()) {
43 // if (true) {
44 // if (this->rowFieldName == "SIGMA" || this->colFieldName == "SIGMA") {
45 // // cout << "WE ARE ADDING THE BLOCK" << endl;
46 // // cout << this->rowFieldName << " " << this->colFieldName << endl;
47
48 // }
49 auto &bmc = *bmc_ptr;
50 int *row_ind_ptr = &*row_data.getIndices().begin();
51 int *col_ind_ptr = &*col_data.getIndices().begin();
52 int row_nb_dofs = row_data.getIndices().size();
53 int col_nb_dofs = col_data.getIndices().size();
54 auto &K = this->locMat;
55 auto &transK = this->locMatTranspose;
56
57 auto set_block = [&](auto &row_name, auto &col_name, auto row_side,
58 auto col_side, auto row_type, auto col_type,
59 const auto &m, const auto &row_ind,
60 const auto &col_ind) {
61 auto it = bmc.get<0>().find(boost::make_tuple(
62 row_name, col_name, row_type, col_type, row_side, col_side));
63 if (it != bmc.get<0>().end()) {
64 it->setMat(m);
65 it->setInd(row_ind, col_ind);
66 it->setSetAtElement();
67 } else
68 bmc.insert(BlockMatData(row_name, col_name, row_type, col_type,
69 row_side, col_side, m, row_ind, col_ind));
70 };
71 //FIXME: for contact fieldsplit
72 if (/* true || */ this->rowFieldName != "SIGMA" &&
73 this->colFieldName != "SIGMA") {
74 if (auto e_ptr = row_data.getFieldEntities()[0]) {
75 if (auto stored_data_ptr =
76 e_ptr->getSharedStoragePtr<EssentialBcStorage>()) {
77 if (!this->onlyTranspose)
78 set_block(this->rowFieldName, this->colFieldName, this->rowSide,
79 this->colSide, this->rowType, this->colType, K,
80 stored_data_ptr->entityIndices, col_data.getIndices());
81 if (transpose)
82 set_block(this->colFieldName, this->rowFieldName, this->colSide,
83 this->rowSide, this->colType, this->rowType, transK,
84 col_data.getIndices(), stored_data_ptr->entityIndices);
85 } else {
86 if (!this->onlyTranspose)
87 set_block(this->rowFieldName, this->colFieldName, this->rowSide,
88 this->colSide, this->rowType, this->colType, K,
89 row_data.getIndices(), col_data.getIndices());
90
91 if (transpose)
92 set_block(this->colFieldName, this->rowFieldName, this->colSide,
93 this->rowSide, this->colType, this->rowType, transK,
94 col_data.getIndices(), row_data.getIndices());
95 }
96 } else
97 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY,
98 "No field entities for assembly");
99 }
100 }
101
102 // Assemble transpose
103 if (transpose) {
105 this->getKSPB(), col_data, row_data,
106 &*this->locMatTranspose.data().begin(), ADD_VALUES);
107 }
108
109 if (!this->onlyTranspose) {
110 // assemble local matrix
112 this->getKSPB(), row_data, col_data, &*this->locMat.data().begin(),
113 ADD_VALUES);
114 }
115
117 }
118
121 this->getKSPf(), data, &*this->locF.data().begin(), ADD_VALUES);
122 }
123};
124
126
131
136
141
146
147
150 SmartPetscObj<DM> &dm_plastic);
153 SmartPetscObj<DM> &dm_plastic_tau);
155 SmartPetscObj<DM> &dm_contact);
156
157} // namespace MoFEM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
#define CHKERR
Inline error check.
Definition: definitions.h:535
FTensor::Index< 'm', SPACE_DIM > m
MoFEMErrorCode VecSetValues< EssentialBcStorage >(Vec V, const EntitiesFieldData::EntData &data, const double *ptr, InsertMode iora)
Set values to vector in operator.
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEMErrorCode set_contact_dm(MoFEM::Interface &m_field, SmartPetscObj< DM > &dm, SmartPetscObj< DM > &dm_contact)
boost::weak_ptr< BlockMatContainer > block_mat_container_ptr
MoFEMErrorCode MatSetValues< EssentialBcStorage >(Mat M, const EntitiesFieldData::EntData &row_data, const EntitiesFieldData::EntData &col_data, const double *ptr, InsertMode iora)
Set values to matrix in operator.
MoFEMErrorCode set_plastic_tau_dm(MoFEM::Interface &m_field, SmartPetscObj< DM > &dm, SmartPetscObj< DM > &dm_plastic_tau)
MoFEMErrorCode set_plastic_ep_dm(MoFEM::Interface &m_field, SmartPetscObj< DM > &dm, SmartPetscObj< DM > &dm_plastic)
OpBaseImpl< PETSC, EdgeEleOp > OpBase
Definition: radiation.cpp:29
Deprecated interface functions.
Data on single entity (This is passed as argument to DataOperator::doWork)
const VectorFieldEntities & getFieldEntities() const
get field entities
const VectorInt & getIndices() const
Get global indices of dofs on entity.
[Storage and set boundary conditions]
MoFEMErrorCode aSsemble(EntitiesFieldData::EntData &row_data, EntitiesFieldData::EntData &col_data, const bool transpose)
MoFEMErrorCode aSsemble(EntitiesFieldData::EntData &data)
VectorDouble locF
local entity vector
MatrixDouble locMatTranspose
local entity block matrix
int rowSide
row side number
int colSide
column side number
EntityType colType
column type
MatrixDouble locMat
local entity block matrix
EntityType rowType
row type
intrusive_ptr for managing petsc objects
Base volume element used to integrate on skeleton.