v0.15.0
Loading...
Searching...
No Matches
EshelbianPlasticity::TSElasticPostStep Struct Reference
Collaboration diagram for EshelbianPlasticity::TSElasticPostStep:
[legend]

Static Public Member Functions

static MoFEMErrorCode postStepInitialise (EshelbianCore *ep_ptr)
 
static MoFEMErrorCode postStepDestroy ()
 
static MoFEMErrorCode preStepFun (TS ts)
 
static MoFEMErrorCode postStepFun (TS ts)
 

Static Private Attributes

static SmartPetscObj< KSP > prjKsp
 
static SmartPetscObj< Vec > prjD
 
static SmartPetscObj< Vec > prjF
 
static SmartPetscObj< DM > prjDM
 
static EshelbianCoreepPtr
 
static boost::shared_ptr< FEMethodpreProcRhs
 

Detailed Description

Definition at line 10 of file EshelbianPlasticity.cpp.

Member Function Documentation

◆ postStepDestroy()

static MoFEMErrorCode EshelbianPlasticity::TSElasticPostStep::postStepDestroy ( )
inlinestatic

Definition at line 86 of file EshelbianPlasticity.cpp.

89 {
90 Range r;
91 for (auto &f : recvbuf) {
92 r.insert(ent_form_type_and_id(type, f));
93 }
94 return r;
auto ent_form_type_and_id(const EntityType type, const EntityID id)
get entity handle from type and id
int r
Definition sdf.py:8

◆ postStepFun()

static MoFEMErrorCode EshelbianPlasticity::TSElasticPostStep::postStepFun ( TS ts)
inlinestatic

Definition at line 224 of file EshelbianPlasticity.cpp.

235 {
236
237 ParallelComm *pcomm =
238 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
239
240 MOFEM_LOG("EP", Sev::noisy) << "get_two_sides_of_crack_surface";
241
242 if (!pcomm->rank()) {
243
244 auto impl = [&](auto &saids) {
246
247 auto &moab = m_field.get_moab();
248
249 auto get_adj = [&](auto e, auto dim) {
250 Range adj;
251 CHK_MOAB_THROW(m_field.get_moab().get_adjacencies(
252 e, dim, true, adj, moab::Interface::UNION),
253 "get adj");
254 return adj;
255 };
256
257 auto get_conn = [&](auto e) {
258 Range conn;
259 CHK_MOAB_THROW(m_field.get_moab().get_connectivity(e, conn, true),
260 "get connectivity");
261 return conn;
262 };
263
#define MYPCOMM_INDEX
default communicator number PCOMM
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
#define CHK_MOAB_THROW(err, msg)
Check error code of MoAB function and throw MoFEM exception.
#define MOFEM_LOG(channel, severity)
Log.

◆ postStepInitialise()

static MoFEMErrorCode EshelbianPlasticity::TSElasticPostStep::postStepInitialise ( EshelbianCore * ep_ptr)
inlinestatic

Definition at line 12 of file EshelbianPlasticity.cpp.

36 {
37#include <phg-quadrule/quad.h>
38}
39
40#include <queue>
41
42namespace EshelbianPlasticity {
43struct VolUserDataOperatorStabAssembly
44 : public VolumeElementForcesAndSourcesCore::UserDataOperator {
45 using VolumeElementForcesAndSourcesCore::UserDataOperator::UserDataOperator;
46};
47struct FaceUserDataOperatorStabAssembly
48 : public FaceElementForcesAndSourcesCore::UserDataOperator {
49 using FaceElementForcesAndSourcesCore::UserDataOperator::UserDataOperator;
50};
51
52} // namespace EshelbianPlasticity
53
54static auto send_type(MoFEM::Interface &m_field, Range r,
55 const EntityType type) {
56 ParallelComm *pcomm =
57 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
58
59 auto dim = CN::Dimension(type);
60
61 std::vector<int> sendcounts(pcomm->size());
62 std::vector<int> displs(pcomm->size());
63 std::vector<int> sendbuf(r.size());
64 if (pcomm->rank() == 0) {
65 for (auto p = 1; p != pcomm->size(); p++) {
66 auto part_ents = m_field.getInterface<CommInterface>()
67 ->getPartEntities(m_field.get_moab(), p)
68 .subset_by_dimension(SPACE_DIM);
69 Range faces;
70 CHKERR m_field.get_moab().get_adjacencies(part_ents, dim, true, faces,
71 moab::Interface::UNION);
72 faces = intersect(faces, r);
73 sendcounts[p] = faces.size();
74 displs[p] = sendbuf.size();
75 for (auto f : faces) {
76 auto id = id_from_handle(f);
77 sendbuf.push_back(id);
78 }
79 }
80 }
81
82 int recv_data;
83 MPI_Scatter(sendcounts.data(), 1, MPI_INT, &recv_data, 1, MPI_INT, 0,
84 pcomm->comm());
static auto send_type(MoFEM::Interface &m_field, Range r, const EntityType type)
constexpr int SPACE_DIM
#define CHKERR
Inline error check.
auto id_from_handle(const EntityHandle h)
Managing BitRefLevels.
virtual moab::Interface & get_moab()=0
Deprecated interface functions.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.

◆ preStepFun()

static MoFEMErrorCode EshelbianPlasticity::TSElasticPostStep::preStepFun ( TS ts)
inlinestatic

Definition at line 96 of file EshelbianPlasticity.cpp.

101 {
102 Range r;
103
104 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
105 auto bcs = mesh_mng->getCubitMeshsetPtr(
106
107 std::regex((boost::format("%s(.*)") % block_name).str())
108
109 );
110
111 for (auto bc : bcs) {
112 Range faces;
113 CHK_MOAB_THROW(bc->getMeshsetIdEntitiesByDimension(m_field.get_moab(), dim,
114 faces, true),
115 "get meshset ents");
116 r.merge(faces);
117 }
118
119 return r;
120};
121
122static auto get_range_from_block_map(MoFEM::Interface &m_field,
123 const std::string block_name, int dim) {
124 std::map<std::string, Range> r;
125
126 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
127 auto bcs = mesh_mng->getCubitMeshsetPtr(
128
129 std::regex((boost::format("%s(.*)") % block_name).str())
130
131 );
132
133 for (auto bc : bcs) {
134 Range faces;
135 CHK_MOAB_THROW(bc->getMeshsetIdEntitiesByDimension(m_field.get_moab(), dim,
136 faces, true),
137 "get meshset ents");
138 r[bc->getName()] = faces;
139 }
140
141 return r;
142}
143
144static auto get_block_meshset(MoFEM::Interface &m_field, const int ms_id,
145 const unsigned int cubit_bc_type) {
146 auto mesh_mng = m_field.getInterface<MeshsetsManager>();
147 EntityHandle meshset;
148 CHKERR mesh_mng->getMeshset(ms_id, cubit_bc_type, meshset);
149 return meshset;
150};
151
152static auto save_range(moab::Interface &moab, const std::string name,
153 const Range r, std::vector<Tag> tags = {}) {
155 auto out_meshset = get_temp_meshset_ptr(moab);
156 CHKERR moab.add_entities(*out_meshset, r);
157 if (r.size()) {
158 CHKERR moab.write_file(name.c_str(), "VTK", "", out_meshset->get_ptr(), 1,
159 tags.data(), tags.size());
160 } else {
161 MOFEM_LOG("SELF", Sev::warning) << "Empty range for " << name;
162 }
164};
165
166static auto filter_true_skin(MoFEM::Interface &m_field, Range &&skin) {
167 Range boundary_ents;
168 ParallelComm *pcomm =
169 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
170 CHK_MOAB_THROW(pcomm->filter_pstatus(skin,
171 PSTATUS_SHARED | PSTATUS_MULTISHARED,
172 PSTATUS_NOT, -1, &boundary_ents),
173 "filter_pstatus");
174 return boundary_ents;
175};
176
177static auto filter_owners(MoFEM::Interface &m_field, Range skin) {
178 Range owner_ents;
179 ParallelComm *pcomm =
180 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
181 CHK_MOAB_THROW(pcomm->filter_pstatus(skin, PSTATUS_NOT_OWNED, PSTATUS_NOT, -1,
182 &owner_ents),
183 "filter_pstatus");
184 return owner_ents;
185};
186
187static auto get_skin(MoFEM::Interface &m_field, Range body_ents) {
188 Skinner skin(&m_field.get_moab());
189 Range skin_ents;
190 CHK_MOAB_THROW(skin.find_skin(0, body_ents, false, skin_ents), "find_skin");
191 return skin_ents;
192};
193
194static auto get_crack_front_edges(MoFEM::Interface &m_field,
195 Range crack_faces) {
196 ParallelComm *pcomm =
197 ParallelComm::get_pcomm(&m_field.get_moab(), MYPCOMM_INDEX);
198 auto &moab = m_field.get_moab();
199 Range crack_skin_without_bdy;
200 if (pcomm->rank() == 0) {
201 Range crack_edges;
202 CHKERR moab.get_adjacencies(crack_faces, 1, true, crack_edges,
203 moab::Interface::UNION);
204 auto crack_skin = get_skin(m_field, crack_faces);
205 Range body_ents;
207 m_field.get_moab().get_entities_by_dimension(0, SPACE_DIM, body_ents),
208 "get_entities_by_dimension");
209 auto body_skin = get_skin(m_field, body_ents);
210 Range body_skin_edges;
211 CHK_MOAB_THROW(moab.get_adjacencies(body_skin, 1, true, body_skin_edges,
212 moab::Interface::UNION),
213 "get_adjacencies");
214 crack_skin_without_bdy = subtract(crack_skin, body_skin_edges);
215 auto front_edges_map = get_range_from_block_map(m_field, "FRONT", 1);
216 for (auto &m : front_edges_map) {
217 auto add_front = subtract(m.second, crack_edges);
218 auto i = intersect(m.second, crack_edges);
219 if (i.empty()) {
220 crack_skin_without_bdy.merge(add_front);
221 } else {
222 auto i_skin = get_skin(m_field, i);
static auto get_block_meshset(MoFEM::Interface &m_field, const int ms_id, const unsigned int cubit_bc_type)
static auto get_range_from_block_map(MoFEM::Interface &m_field, const std::string block_name, int dim)
static auto filter_owners(MoFEM::Interface &m_field, Range skin)
static auto filter_true_skin(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)
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
MoFEMErrorCode getCubitMeshsetPtr(const int ms_id, const CubitBCType cubit_bc_type, const CubitMeshSets **cubit_meshset_ptr) const
get cubit meshset
FTensor::Index< 'i', SPACE_DIM > i
auto get_temp_meshset_ptr(moab::Interface &moab)
Create smart pointer to temporary meshset.
FTensor::Index< 'm', 3 > m
Interface for managing meshsets containing materials and boundary conditions.
auto save_range

Member Data Documentation

◆ epPtr

EshelbianCore * TSElasticPostStep::epPtr
staticprivate

Definition at line 270 of file EshelbianPlasticity.cpp.

◆ preProcRhs

boost::shared_ptr< FEMethod > TSElasticPostStep::preProcRhs
staticprivate

Definition at line 272 of file EshelbianPlasticity.cpp.

◆ prjD

SmartPetscObj< Vec > TSElasticPostStep::prjD
staticprivate

Definition at line 267 of file EshelbianPlasticity.cpp.

◆ prjDM

SmartPetscObj< DM > TSElasticPostStep::prjDM
staticprivate

Definition at line 269 of file EshelbianPlasticity.cpp.

◆ prjF

SmartPetscObj< Vec > TSElasticPostStep::prjF
staticprivate

Definition at line 268 of file EshelbianPlasticity.cpp.

◆ prjKsp

SmartPetscObj< KSP > TSElasticPostStep::prjKsp
staticprivate

Definition at line 266 of file EshelbianPlasticity.cpp.


The documentation for this struct was generated from the following file: