v0.16.0
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
EshelbianPlasticity.cpp File Reference
#include <MoFEM.hpp>
#include <IntegrationRules.hpp>
#include <CGGTonsorialBubbleBase.hpp>
#include <EshelbianPlasticity.hpp>
#include <boost/math/constants/constants.hpp>
#include <cholesky.hpp>
#include <EshelbianAux.hpp>
#include <EshelbianCohesive.hpp>
#include <EshelbianContact.hpp>
#include <EshelbianTopologicalDerivative.hpp>
#include <TSElasticPostStep.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::VolUserDataOperatorStabAssembly
 
struct  EshelbianPlasticity::FaceUserDataOperatorStabAssembly
 
struct  EshelbianPlasticity::SetIntegrationAtFrontVolume
 
struct  EshelbianPlasticity::SetIntegrationAtFrontVolume::Fe
 
struct  EshelbianPlasticity::SetIntegrationAtFrontFace
 
struct  EshelbianPlasticity::SetIntegrationAtFrontFace::Fe
 
struct  EshelbianPlasticity::VolRule
 Set integration rule on element. More...
 
struct  EshelbianPlasticity::FaceRule
 
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 get_block_meshset (MoFEM::Interface &m_field, const int ms_id, const unsigned int cubit_bc_type)
 
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)
 

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 202 of file EshelbianPlasticity.cpp.

202 {
203 Range owner_ents;
204 ParallelComm *pcomm =
205 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
206 CHK_MOAB_THROW(pcomm->filter_pstatus(skin, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1,
207 &owner_ents),
208 "filter_pstatus");
209 return owner_ents;
210};
#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 191 of file EshelbianPlasticity.cpp.

191 {
192 Range boundary_ents;
193 ParallelComm *pcomm =
194 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
195 CHK_MOAB_THROW(pcomm->filter_pstatus(skin,
196 PSTATUS_SHARED | PSTATUS_MULTISHARED,
197 PSTATUS_NOT, -1, &boundary_ents),
198 "filter_pstatus");
199 return boundary_ents;
200};

◆ get_block_meshset()

static auto get_block_meshset ( MoFEM::Interface m_field,
const int  ms_id,
const unsigned int  cubit_bc_type 
)
static
Examples
/home/lk58p/mofem_install/vanilla_dev_release/mofem-cephas/mofem/users_modules/eshelbian_plasticity/src/impl/EshelbianPlasticity.cpp.

Definition at line 169 of file EshelbianPlasticity.cpp.

170 {
171 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
172 EntityHandle meshset;
173 CHKERR mesh_mng->getMeshset(ms_id, cubit_bc_type, meshset);
174 return meshset;
175};
#define CHKERR
Inline error check.
MoFEMErrorCode getMeshset(const int ms_id, const unsigned int cubit_bc_type, EntityHandle &meshset) const
get meshset from CUBIT Id and CUBIT type
Interface for managing meshsets containing materials and boundary conditions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ 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 219 of file EshelbianPlasticity.cpp.

220 {
221 ParallelComm *pcomm =
222 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
223 auto &moab = m_field.get_moab();
224 Range crack_skin_without_bdy;
225 if (pcomm->rank() == 0) {
226 Range crack_edges;
227 CHKERR moab.get_adjacencies(crack_faces, 1, true, crack_edges,
228 moab::Interface::UNION);
229 auto crack_skin = get_skin(m_field, crack_faces);
230 Range body_ents;
232 m_field.get_moab().get_entities_by_dimension(0, SPACE_DIM, body_ents),
233 "get_entities_by_dimension");
234 auto body_skin = get_skin(m_field, body_ents);
235 Range body_skin_edges;
236 CHK_MOAB_THROW(moab.get_adjacencies(body_skin, 1, true, body_skin_edges,
237 moab::Interface::UNION),
238 "get_adjacencies");
239 crack_skin_without_bdy = subtract(crack_skin, body_skin_edges);
240 auto front_edges_map = get_range_from_block_map(m_field, "FRONT", 1);
241 for (auto &m : front_edges_map) {
242 auto add_front = subtract(m.second, crack_edges);
243 auto i = intersect(m.second, crack_edges);
244 if (i.empty()) {
245 crack_skin_without_bdy.merge(add_front);
246 } else {
247 auto i_skin = get_skin(m_field, i);
248 Range adj_i_skin;
249 CHKERR moab.get_adjacencies(i_skin, 1, true, adj_i_skin,
250 moab::Interface::UNION);
251 adj_i_skin = subtract(intersect(adj_i_skin, m.second), crack_edges);
252 crack_skin_without_bdy.merge(adj_i_skin);
253 }
254 }
255 }
256 return send_type(m_field, crack_skin_without_bdy, MBEDGE);
257}
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
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 105 of file EshelbianPlasticity.cpp.

106 {
107 Range r;
108
109 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
110 auto bcs = mesh_mng->getCubitMeshsetPtr(
111
112 std::regex((boost::format("%s(.*)") % block_name).str())
113
114 );
115
116 for (auto bc : bcs) {
117 auto meshset = bc->getMeshset();
118 CHK_MOAB_THROW(m_field.get_moab().get_entities_by_handle(meshset, r, true),
119 "get meshset ents");
120 }
121
122 return r;
123};
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

◆ 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 125 of file EshelbianPlasticity.cpp.

126 {
127 Range r;
128
129 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
130 auto bcs = mesh_mng->getCubitMeshsetPtr(
131
132 std::regex((boost::format("%s(.*)") % block_name).str())
133
134 );
135
136 for (auto bc : bcs) {
137 Range faces;
138 CHK_MOAB_THROW(bc->getMeshsetIdEntitiesByDimension(m_field.get_moab(), dim,
139 faces, true),
140 "get meshset ents");
141 r.merge(faces);
142 }
143
144 return r;
145};

◆ 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 147 of file EshelbianPlasticity.cpp.

148 {
149 std::map<std::string, Range> r;
150
151 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
152 auto bcs = mesh_mng->getCubitMeshsetPtr(
153
154 std::regex((boost::format("%s(.*)") % block_name).str())
155
156 );
157
158 for (auto bc : bcs) {
159 Range faces;
160 CHK_MOAB_THROW(bc->getMeshsetIdEntitiesByDimension(m_field.get_moab(), dim,
161 faces, true),
162 "get meshset ents");
163 r[bc->getName()] = faces;
164 }
165
166 return r;
167}

◆ get_skin()

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

Definition at line 212 of file EshelbianPlasticity.cpp.

212 {
213 Skinner skin(&m_field.get_moab());
214 Range skin_ents;
215 CHK_MOAB_THROW(skin.find_skin(0, body_ents, false, skin_ents), "find_skin");
216 return skin_ents;
217};

◆ 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 259 of file EshelbianPlasticity.cpp.

260 {
261
262 ParallelComm *pcomm =
263 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
264
265 MOFEM_LOG("EP", Sev::noisy) << "get_two_sides_of_crack_surface";
266
267 if (!pcomm->rank()) {
268
269 auto impl = [&](auto &saids) {
271
272 auto &moab = m_field.get_moab();
273
274 auto get_adj = [&](auto e, auto dim) {
275 Range adj;
276 CHK_MOAB_THROW(m_field.get_moab().get_adjacencies(
277 e, dim, true, adj, moab::Interface::UNION),
278 "get adj");
279 return adj;
280 };
281
282 auto get_conn = [&](auto e) {
283 Range conn;
284 CHK_MOAB_THROW(m_field.get_moab().get_connectivity(e, conn, true),
285 "get connectivity");
286 return conn;
287 };
288
289 constexpr bool debug = false;
290 Range body_ents;
291 CHKERR m_field.get_moab().get_entities_by_dimension(0, SPACE_DIM,
292 body_ents);
293 auto body_skin = get_skin(m_field, body_ents);
294 auto body_skin_edges = get_adj(body_skin, 1);
295
296 auto crack_skin =
297 subtract(get_skin(m_field, crack_faces), body_skin_edges);
298 auto crack_skin_conn = get_conn(crack_skin);
299 auto crack_skin_conn_edges = get_adj(crack_skin_conn, 1);
300 auto crack_edges = get_adj(crack_faces, 1);
301 crack_edges = subtract(crack_edges, crack_skin);
302 auto all_tets = get_adj(crack_edges, 3);
303 crack_edges = subtract(crack_edges, crack_skin_conn_edges);
304 auto crack_conn = get_conn(crack_edges);
305 all_tets.merge(get_adj(crack_conn, 3));
306
307 if (debug) {
308 CHKERR save_range(m_field.get_moab(), "crack_faces.vtk", crack_faces);
309 CHKERR save_range(m_field.get_moab(), "all_crack_tets.vtk", all_tets);
310 CHKERR save_range(m_field.get_moab(), "crack_edges_all.vtk",
311 crack_edges);
312 }
313
314 if (crack_faces.size()) {
315 auto grow = [&](auto r) {
316 auto crack_faces_conn = get_conn(crack_faces);
317 Range v;
318 auto size_r = 0;
319 while (size_r != r.size() && r.size() > 0) {
320 size_r = r.size();
321 CHKERR moab.get_connectivity(r, v, true);
322 v = subtract(v, crack_faces_conn);
323 if (v.size()) {
324 CHKERR moab.get_adjacencies(v, SPACE_DIM, true, r,
325 moab::Interface::UNION);
326 r = intersect(r, all_tets);
327 }
328 if (r.empty()) {
329 break;
330 }
331 }
332 return r;
333 };
334
335 Range all_tets_ord = all_tets;
336 while (all_tets.size()) {
337 Range faces = get_adj(unite(saids.first, saids.second), 2);
338 faces = subtract(crack_faces, faces);
339 if (faces.size()) {
340 Range tets;
341 auto fit = faces.begin();
342 for (; fit != faces.end(); ++fit) {
343 tets = intersect(get_adj(Range(*fit, *fit), 3), all_tets);
344 if (tets.size() == 2) {
345 break;
346 }
347 }
348 if (tets.empty()) {
349 break;
350 } else {
351 saids.first.insert(tets[0]);
352 saids.first = grow(saids.first);
353 all_tets = subtract(all_tets, saids.first);
354 if (tets.size() == 2) {
355 saids.second.insert(tets[1]);
356 saids.second = grow(saids.second);
357 all_tets = subtract(all_tets, saids.second);
358 }
359 }
360 } else {
361 break;
362 }
363 }
364
365 saids.first = subtract(all_tets_ord, saids.second);
366 saids.second = subtract(all_tets_ord, saids.first);
367 }
368
370 };
371
372 std::pair<Range, Range> saids;
373 if (crack_faces.size())
374 CHK_THROW_MESSAGE(impl(saids), "get crack both sides");
375 return saids;
376 }
377
378 MOFEM_LOG("EP", Sev::noisy) << "get_two_sides_of_crack_surface <- done";
379
380 return std::pair<Range, Range>();
381}
#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()
#define MOFEM_LOG(channel, severity)
Log.
const double v
phase velocity of light in medium (cm/ns)
static const bool debug
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 177 of file EshelbianPlasticity.cpp.

178 {}) {
180 auto out_meshset = get_temp_meshset_ptr(moab);
181 CHKERR moab.add_entities(*out_meshset, r);
182 if (r.size()) {
183 CHKERR moab.write_file(name.c_str(), "VTK", "", out_meshset->get_ptr(), 1,
184 tags.data(), tags.size());
185 } else {
186 MOFEM_LOG("SELF", Sev::warning) << "Empty range for " << name;
187 }
189};
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 59 of file EshelbianPlasticity.cpp.

60 {
61 ParallelComm *pcomm =
62 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
63
64 auto dim = CN::Dimension(type);
65
66 std::vector<int> sendcounts(pcomm->size());
67 std::vector<int> displs(pcomm->size());
68 std::vector<int> sendbuf(r.size());
69 if (pcomm->rank() == 0) {
70 for (auto p = 1; p != pcomm->size(); p++) {
71 auto part_ents = m_field.getInterface<CommInterface>()
72 ->getPartEntities(m_field.get_moab(), p)
73 .subset_by_dimension(SPACE_DIM);
74 Range faces;
75 CHKERR m_field.get_moab().get_adjacencies(part_ents, dim, true, faces,
76 moab::Interface::UNION);
77 faces = intersect(faces, r);
78 sendcounts[p] = faces.size();
79 displs[p] = sendbuf.size();
80 for (auto f : faces) {
81 auto id = id_from_handle(f);
82 sendbuf.push_back(id);
83 }
84 }
85 }
86
87 int recv_data;
88 MPI_Scatter(sendcounts.data(), 1, MPI_INT, &recv_data, 1, MPI_INT, 0,
89 pcomm->comm());
90 std::vector<int> recvbuf(recv_data);
91 MPI_Scatterv(sendbuf.data(), sendcounts.data(), displs.data(), MPI_INT,
92 recvbuf.data(), recv_data, MPI_INT, 0, pcomm->comm());
93
94 if (pcomm->rank() > 0) {
95 Range r;
96 for (auto &f : recvbuf) {
97 r.insert(ent_form_type_and_id(type, f));
98 }
99 return r;
100 }
101
102 return r;
103}
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.