v0.16.3
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
EshelbianPlasticity.cpp File Reference
#include <IntegrationRules.hpp>
#include <MoFEM.hpp>
#include <CGGTonsorialBubbleBase.hpp>
#include <EshelbianPlasticity.hpp>
#include <EshelbianRestart.hpp>
#include <boost/math/constants/constants.hpp>
#include <cholesky.hpp>
#include <EshelbianAux.hpp>
#include <L2Rotation.hpp>
#include <EshelbianContact.hpp>
#include <PlasticIncrementalOptimization.hpp>
#include <impl/PlasticIncrementalOptimizationInternal.hpp>
#include <EshelbianTopologicalDerivative.hpp>
#include <TSElasticPreAndPostStep.hpp>
#include <phg-quadrule/quad.h>
#include <queue>
#include "impl/CGGUserPolynomialBase.cpp"
#include "impl/EshelbianMonitor.cpp"
#include "impl/EshelbianTestingMonitor.cpp"
#include "impl/SetUpSchurImpl.cpp"
#include <impl/EshelbianFracture.cpp>

Go to the source code of this file.

Classes

struct  EshelbianPlasticity::SetIntegrationAtFrontVolume
 
struct  EshelbianPlasticity::SetIntegrationAtFrontVolume::Fe
 
struct  EshelbianPlasticity::SetIntegrationAtFrontFace
 
struct  EshelbianPlasticity::SetIntegrationAtFrontFace::Fe
 
struct  EshelbianPlasticity::OpApplyPlasticFlowIncrement
 
struct  EshelbianPlasticity::solve_elastic_setup
 

Namespaces

namespace  EshelbianPlasticity
 

Macros

#define SINGULARITY
 

Functions

static auto send_type (MoFEM::Interface &m_field, Range r, const EntityType type)
 
static auto get_entities_by_handle (MoFEM::Interface &m_field, const std::string block_name)
 
static auto get_range_from_block (MoFEM::Interface &m_field, const std::string block_name, int dim)
 
static auto get_range_from_block_map (MoFEM::Interface &m_field, const std::string block_name, int dim)
 
static auto save_range (moab::Interface &moab, const std::string name, const Range r, std::vector< Tag > tags={})
 
static auto filter_true_skin (MoFEM::Interface &m_field, Range &&skin)
 
static auto filter_owners (MoFEM::Interface &m_field, Range skin)
 
static auto get_skin (MoFEM::Interface &m_field, Range body_ents)
 
static auto get_crack_front_edges (MoFEM::Interface &m_field, Range crack_faces)
 
static auto get_two_sides_of_crack_surface (MoFEM::Interface &m_field, Range crack_faces)
 
auto EshelbianPlasticity::vol_rule (int o)
 
auto EshelbianPlasticity::face_rule (int o)
 
static MoFEMErrorCode EshelbianPlasticity::RelaxationResidualMonitor (TS ts, PetscInt, PetscReal, Vec, void *)
 
static MoFEMErrorCode EshelbianPlasticity::checkDynamicToleranceCompatibility (TS ts)
 

Macro Definition Documentation

◆ SINGULARITY

#define SINGULARITY

Definition at line 12 of file EshelbianPlasticity.cpp.

Function Documentation

◆ filter_owners()

static auto filter_owners ( MoFEM::Interface &  m_field,
Range  skin 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 185 of file EshelbianPlasticity.cpp.

185 {
186 Range owner_ents;
187 ParallelComm *pcomm =
188 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
189 CHK_MOAB_THROW(pcomm->filter_pstatus(skin, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1,
190 &owner_ents),
191 "filter_pstatus");
192 return owner_ents;
193};
#define MYPCOMM_INDEX
default communicator number PCOMM
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
virtual moab::Interface & get_moab()=0

◆ filter_true_skin()

static auto filter_true_skin ( MoFEM::Interface &  m_field,
Range &&  skin 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp, mofem/atom_tests/tensor_divergence_operator.cpp, mofem/tutorials/adv-0_plasticity/plastic.cpp, mofem/tutorials/adv-5_poroelasticity/seepage.cpp, mofem/users_modules/adolc-plasticity/adolc_plasticity.cpp, plastic.cpp, thermo_elastic.cpp, and thermoplastic.cpp.

Definition at line 174 of file EshelbianPlasticity.cpp.

174 {
175 Range boundary_ents;
176 ParallelComm *pcomm =
177 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
178 CHK_MOAB_THROW(pcomm->filter_pstatus(skin,
179 PSTATUS_SHARED | PSTATUS_MULTISHARED,
180 PSTATUS_NOT, -1, &boundary_ents),
181 "filter_pstatus");
182 return boundary_ents;
183};

◆ get_crack_front_edges()

static auto get_crack_front_edges ( MoFEM::Interface &  m_field,
Range  crack_faces 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 202 of file EshelbianPlasticity.cpp.

203 {
204 ParallelComm *pcomm =
205 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
206 auto &moab = m_field.get_moab();
207 Range crack_skin_without_bdy;
208 if (pcomm->rank() == 0) {
209 Range crack_edges;
210 CHKERR moab.get_adjacencies(crack_faces, 1, true, crack_edges,
211 moab::Interface::UNION);
212 auto crack_skin = get_skin(m_field, crack_faces);
213 Range body_ents;
215 m_field.get_moab().get_entities_by_dimension(0, SPACE_DIM, body_ents),
216 "get_entities_by_dimension");
217 auto body_skin = get_skin(m_field, body_ents);
218 Range body_skin_edges;
219 CHK_MOAB_THROW(moab.get_adjacencies(body_skin, 1, true, body_skin_edges,
220 moab::Interface::UNION),
221 "get_adjacencies");
222 crack_skin_without_bdy = subtract(crack_skin, body_skin_edges);
223 auto front_edges_map = get_range_from_block_map(m_field, "FRONT", 1);
224 for (auto &m : front_edges_map) {
225 auto add_front = subtract(m.second, crack_edges);
226 auto i = intersect(m.second, crack_edges);
227 if (i.empty()) {
228 crack_skin_without_bdy.merge(add_front);
229 } else {
230 auto i_skin = get_skin(m_field, i);
231 Range adj_i_skin;
232 CHKERR moab.get_adjacencies(i_skin, 1, true, adj_i_skin,
233 moab::Interface::UNION);
234 adj_i_skin = subtract(intersect(adj_i_skin, m.second), crack_edges);
235 crack_skin_without_bdy.merge(adj_i_skin);
236 }
237 }
238 }
239 return send_type(m_field, crack_skin_without_bdy, MBEDGE);
240}
static auto send_type(MoFEM::Interface &m_field, Range r, const EntityType type)
static auto get_range_from_block_map(MoFEM::Interface &m_field, const std::string block_name, int dim)
static auto get_skin(MoFEM::Interface &m_field, Range body_ents)
constexpr int SPACE_DIM
#define CHKERR
Inline error check.
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'm', 3 > m

◆ get_entities_by_handle()

static auto get_entities_by_handle ( MoFEM::Interface &  m_field,
const std::string  block_name 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 96 of file EshelbianPlasticity.cpp.

97 {
98 Range r;
99
100 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
101 auto bcs = mesh_mng->getCubitMeshsetPtr(
102
103 std::regex((boost::format("%s(.*)") % block_name).str())
104
105 );
106
107 for (auto bc : bcs) {
108 auto meshset = bc->getMeshset();
109 CHK_MOAB_THROW(m_field.get_moab().get_entities_by_handle(meshset, r, true),
110 "get meshset ents");
111 }
112
113 return r;
114};
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
int r
Definition sdf.py:205
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ get_range_from_block()

static auto get_range_from_block ( MoFEM::Interface &  m_field,
const std::string  block_name,
int  dim 
)
static

Definition at line 116 of file EshelbianPlasticity.cpp.

117 {
118 Range r;
119
120 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
121 auto bcs = mesh_mng->getCubitMeshsetPtr(
122
123 std::regex((boost::format("%s(.*)") % block_name).str())
124
125 );
126
127 for (auto bc : bcs) {
128 Range faces;
129 CHK_MOAB_THROW(bc->getMeshsetIdEntitiesByDimension(m_field.get_moab(), dim,
130 faces, true),
131 "get meshset ents");
132 r.merge(faces);
133 }
134
135 return r;
136};

◆ get_range_from_block_map()

static auto get_range_from_block_map ( MoFEM::Interface &  m_field,
const std::string  block_name,
int  dim 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 138 of file EshelbianPlasticity.cpp.

139 {
140 std::map<std::string, Range> r;
141
142 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
143 auto bcs = mesh_mng->getCubitMeshsetPtr(
144
145 std::regex((boost::format("%s(.*)") % block_name).str())
146
147 );
148
149 for (auto bc : bcs) {
150 Range faces;
151 CHK_MOAB_THROW(bc->getMeshsetIdEntitiesByDimension(m_field.get_moab(), dim,
152 faces, true),
153 "get meshset ents");
154 r[bc->getName()] = faces;
155 }
156
157 return r;
158}

◆ get_skin()

static auto get_skin ( MoFEM::Interface &  m_field,
Range  body_ents 
)
static

Definition at line 195 of file EshelbianPlasticity.cpp.

195 {
196 Skinner skin(&m_field.get_moab());
197 Range skin_ents;
198 CHK_MOAB_THROW(skin.find_skin(0, body_ents, false, skin_ents), "find_skin");
199 return skin_ents;
200};

◆ get_two_sides_of_crack_surface()

static auto get_two_sides_of_crack_surface ( MoFEM::Interface &  m_field,
Range  crack_faces 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 242 of file EshelbianPlasticity.cpp.

243 {
244
245 ParallelComm *pcomm =
246 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
247
248 MOFEM_LOG("EP", Sev::noisy) << "get_two_sides_of_crack_surface";
249
250 if (!pcomm->rank()) {
251
252 auto impl = [&](auto &saids) {
254
255 auto &moab = m_field.get_moab();
256
257 auto get_adj = [&](auto e, auto dim) {
258 Range adj;
259 CHK_MOAB_THROW(m_field.get_moab().get_adjacencies(
260 e, dim, true, adj, moab::Interface::UNION),
261 "get adj");
262 return adj;
263 };
264
265 auto get_conn = [&](auto e) {
266 Range conn;
267 CHK_MOAB_THROW(m_field.get_moab().get_connectivity(e, conn, true),
268 "get connectivity");
269 return conn;
270 };
271
272 constexpr bool debug = false;
273 Range body_ents;
274 CHKERR m_field.get_moab().get_entities_by_dimension(0, SPACE_DIM,
275 body_ents);
276 auto body_skin = get_skin(m_field, body_ents);
277 auto body_skin_edges = get_adj(body_skin, 1);
278
279 auto crack_skin =
280 subtract(get_skin(m_field, crack_faces), body_skin_edges);
281 auto crack_skin_conn = get_conn(crack_skin);
282 auto crack_skin_conn_edges = get_adj(crack_skin_conn, 1);
283 auto crack_edges = get_adj(crack_faces, 1);
284 crack_edges = subtract(crack_edges, crack_skin);
285 auto all_tets = get_adj(crack_edges, 3);
286 crack_edges = subtract(crack_edges, crack_skin_conn_edges);
287 auto crack_conn = get_conn(crack_edges);
288 all_tets.merge(get_adj(crack_conn, 3));
289
290 if (debug) {
291 CHKERR save_range(m_field.get_moab(), "crack_faces.vtk", crack_faces);
292 CHKERR save_range(m_field.get_moab(), "all_crack_tets.vtk", all_tets);
293 CHKERR save_range(m_field.get_moab(), "crack_edges_all.vtk",
294 crack_edges);
295 }
296
297 if (crack_faces.size()) {
298 auto grow = [&](auto r) {
299 auto crack_faces_conn = get_conn(crack_faces);
300 Range v;
301 auto size_r = 0;
302 while (size_r != r.size() && r.size() > 0) {
303 size_r = r.size();
304 CHKERR moab.get_connectivity(r, v, true);
305 v = subtract(v, crack_faces_conn);
306 if (v.size()) {
307 CHKERR moab.get_adjacencies(v, SPACE_DIM, true, r,
308 moab::Interface::UNION);
309 r = intersect(r, all_tets);
310 }
311 if (r.empty()) {
312 break;
313 }
314 }
315 return r;
316 };
317
318 Range all_tets_ord = all_tets;
319 while (all_tets.size()) {
320 Range faces = get_adj(unite(saids.first, saids.second), 2);
321 faces = subtract(crack_faces, faces);
322 if (faces.size()) {
323 Range tets;
324 auto fit = faces.begin();
325 for (; fit != faces.end(); ++fit) {
326 tets = intersect(get_adj(Range(*fit, *fit), 3), all_tets);
327 if (tets.size() == 2) {
328 break;
329 }
330 }
331 if (tets.empty()) {
332 break;
333 } else {
334 saids.first.insert(tets[0]);
335 saids.first = grow(saids.first);
336 all_tets = subtract(all_tets, saids.first);
337 if (tets.size() == 2) {
338 saids.second.insert(tets[1]);
339 saids.second = grow(saids.second);
340 all_tets = subtract(all_tets, saids.second);
341 }
342 }
343 } else {
344 break;
345 }
346 }
347
348 saids.first = subtract(all_tets_ord, saids.second);
349 saids.second = subtract(all_tets_ord, saids.first);
350 }
351
353 };
354
355 std::pair<Range, Range> saids;
356 if (crack_faces.size())
357 CHK_THROW_MESSAGE(impl(saids), "get crack both sides");
358 return saids;
359 }
360
361 MOFEM_LOG("EP", Sev::noisy) << "get_two_sides_of_crack_surface <- done";
362
363 return std::pair<Range, Range>();
364}
#define CHK_THROW_MESSAGE(err, msg)
Check and throw MoFEM exception.
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
static const bool debug
#define MOFEM_LOG(channel, severity)
Log.
const double v
phase velocity of light in medium (cm/ns)
auto save_range

◆ save_range()

static auto save_range ( moab::Interface &  moab,
const std::string  name,
const Range  r,
std::vector< Tag >  tags = {} 
)
static

Definition at line 160 of file EshelbianPlasticity.cpp.

161 {}) {
163 auto out_meshset = get_temp_meshset_ptr(moab);
164 CHKERR moab.add_entities(*out_meshset, r);
165 if (r.size()) {
166 CHKERR moab.write_file(name.c_str(), "VTK", "", out_meshset->get_ptr(), 1,
167 tags.data(), tags.size());
168 } else {
169 MOFEM_LOG("SELF", Sev::warning) << "Empty range for " << name;
170 }
172};
std::string name
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.

◆ send_type()

static auto send_type ( MoFEM::Interface &  m_field,
Range  r,
const EntityType  type 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 50 of file EshelbianPlasticity.cpp.

51 {
52 ParallelComm *pcomm =
53 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
54
55 auto dim = CN::Dimension(type);
56
57 std::vector<int> sendcounts(pcomm->size());
58 std::vector<int> displs(pcomm->size());
59 std::vector<int> sendbuf(r.size());
60 if (pcomm->rank() == 0) {
61 for (auto p = 1; p != pcomm->size(); p++) {
62 auto part_ents = m_field.getInterface<CommInterface>()
63 ->getPartEntities(m_field.get_moab(), p)
64 .subset_by_dimension(SPACE_DIM);
65 Range faces;
66 CHKERR m_field.get_moab().get_adjacencies(part_ents, dim, true, faces,
67 moab::Interface::UNION);
68 faces = intersect(faces, r);
69 sendcounts[p] = faces.size();
70 displs[p] = sendbuf.size();
71 for (auto f : faces) {
72 auto id = id_from_handle(f);
73 sendbuf.push_back(id);
74 }
75 }
76 }
77
78 int recv_data;
79 MPI_Scatter(sendcounts.data(), 1, MPI_INT, &recv_data, 1, MPI_INT, 0,
80 pcomm->comm());
81 std::vector<int> recvbuf(recv_data);
82 MPI_Scatterv(sendbuf.data(), sendcounts.data(), displs.data(), MPI_INT,
83 recvbuf.data(), recv_data, MPI_INT, 0, pcomm->comm());
84
85 if (pcomm->rank() > 0) {
86 Range r;
87 for (auto &f : recvbuf) {
88 r.insert(ent_form_type_and_id(type, f));
89 }
90 return r;
91 }
92
93 return r;
94}
std::string type
auto id_from_handle(const EntityHandle h)
auto ent_form_type_and_id(const EntityType type, const EntityID id)
get entity handle from type and id
Managing BitRefLevels.