NLMech  0.1.0
util.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef TOOLS_PP_UTIL_H
10 #define TOOLS_PP_UTIL_H
11 
12 #include "inp/decks/fractureDeck.h" // definition of EdgeCrack
13 #include "util/point.h" // definition of Point3
14 #include <string>
15 #include <vector>
16 
17 namespace tools {
18 
19 namespace pp {
20 
24 struct JEnergy {
25 
31 
37 
43 
49 
56 
62 
67 
72 
73 
78 
83 
84  JEnergy()
89  d_pdFractureEnergy(0.) {};
90 };
91 
95 struct SortZ {
96 
98  size_t d_i;
99 
101  size_t d_r;
102 
104  double d_Z;
105 
106  SortZ() : d_i(0), d_r(0), d_Z(0.){};
107 };
108 
112 struct CrackTipData {
113 
115  int d_n;
116 
119 
122 
125 
129  CrackTipData() : d_n(0), d_p(util::Point3()), d_v(util::Point3()), d_d
130  (util::Point3()){};
131 
141  util::Point3())
142  : d_n(n), d_p(p), d_v(v), d_d(d){};
143 };
144 
148 struct TransformU {
150  double d_scale;
151 
155  TransformU() : d_scale(1.){};
156 };
157 
164 
167 
169  std::pair<util::Point3, util::Point3> d_markVRect;
170 
172  std::vector<util::Point3> d_markVPts;
173 
176 
178  std::vector<size_t> d_markVNodes;
179 
182 
185 
187  std::string d_symmAxis;
188 
190  double d_symmLine;
191 
196  : d_markVAsZero(false), d_markVInRectGiven(false),
198  d_combineMarkV(false), d_symmLine(0.){};
199 };
200 
207 
210 
215  std::string d_magStrainComp;
216 
221  std::vector<std::pair<size_t, double>> d_markMagStrainCells;
222 
227 };
228 
232 struct FindCrackTip {
233 
235  double d_timet;
236 
238  double d_timeb;
239 
242 
244  std::vector<inp::EdgeCrack> d_cracks;
245 
248 
251 
253  FILE *d_filet;
254 
256  FILE *d_fileb;
257 
262  : d_timet(0.), d_timeb(0.), d_updateCount(0), d_minZAllowed(1.),
263  d_maxZAllowed(50.), d_filet(nullptr), d_fileb(nullptr){};
264 };
265 
272 
275 
277  std::string d_crackTipFile;
278 
280  std::vector<tools::pp::CrackTipData> d_crackTipData;
281 
283  FILE *d_file;
284 
286  FILE *d_fileNew;
287 
290 
293 
299 
302 
304  std::vector<double> d_contourFactor;
305 
308 
310  std::pair<util::Point3, util::Point3> d_contour;
311 
316  : d_crackOrient(0), d_crackId(1), d_file(nullptr), d_fileNew(nullptr),
320 };
321 
326 
331  std::string d_tagFilename;
332 
337  std::string d_outFormat;
338 
340  int d_start;
341 
343  int d_end;
344 
350 
357 
363 
365  std::string d_compressType;
366 
369 
372 
375 
378 
381 
384 
387 
389  : d_outFormat("vtu"), d_start(-1), d_end(-1), d_interval(1),
390  d_outOnlyNodes(true), d_removeElements(false), d_transformU_p(nullptr),
391  d_transformV_p(nullptr), d_compStrain_p(nullptr),
392  d_findCrackTip_p(nullptr), d_damageAtNodes(false),
393  d_computeJInt_p(nullptr), d_calculateInRefConfig(false) {};
394 };
395 
396 } // namespace pp
397 
398 } // namespace tools
399 
400 #endif // TOOLS_PP_UTIL_H
Namespace consisting of libraries which are used either in pre-process or in post-process.
Definition: compute.h:49
Collection of methods useful in simulation.
Definition: DataManager.h:50
Data for J integral calculation computation.
Definition: util.h:269
std::vector< tools::pp::CrackTipData > d_crackTipData
Data to hold crack tip information.
Definition: util.h:280
int d_crackId
Specify crack id for which data to be read from file.
Definition: util.h:274
ComputeJIntegral()
Constructor.
Definition: util.h:315
int d_crackOrient
Specify orientation of crack. 1 for horizontal, -1 for vertical.
Definition: util.h:271
FILE * d_file
File to write J integral data.
Definition: util.h:283
FILE * d_fileNew
File to write J integral data.
Definition: util.h:286
bool d_setLateralCompVZero
Set lateral component of velocity of crack tip as zero.
Definition: util.h:289
std::vector< double > d_contourFactor
Factor of horizon for defining contour.
Definition: util.h:304
bool d_contourGiven
Contour given by rectangle.
Definition: util.h:307
double d_setLateralCompX
Set lateral component of crack tip location to given value (it should be initial value of lateral com...
Definition: util.h:298
bool d_setLateralCompUZero
Set lateral component of displacement of crack tip as zero.
Definition: util.h:292
std::string d_crackTipFile
Specify file from which crack tip information is to be read.
Definition: util.h:277
bool d_isCrackInclined
Specify if we inclined crack.
Definition: util.h:301
std::pair< util::Point3, util::Point3 > d_contour
Contour.
Definition: util.h:310
Data for strain and its magnitude computation operation.
Definition: util.h:204
ComputeStrain()
Constructor.
Definition: util.h:226
std::vector< std::pair< size_t, double > > d_markMagStrainCells
Specify element ids at which magnitude of strain should be marked.
Definition: util.h:221
bool d_computeStrain
Factor for scaling the displacement.
Definition: util.h:206
bool d_magStrainTensor
Compute magnitude of strain tensor.
Definition: util.h:209
std::string d_magStrainComp
Specify component (if any) of which absolute value is to be computed.
Definition: util.h:215
Datatype to hold crack tip data.
Definition: util.h:112
CrackTipData()
Constructor.
Definition: util.h:129
CrackTipData(size_t n, util::Point3 p, util::Point3 v, util::Point3 d=util::Point3())
Constructor.
Definition: util.h:140
util::Point3 d_p
Crack tip location.
Definition: util.h:118
util::Point3 d_d
Crack direction.
Definition: util.h:124
int d_n
Output time step.
Definition: util.h:115
util::Point3 d_v
Crack tip velocity.
Definition: util.h:121
Data for crack tip computation.
Definition: util.h:232
std::vector< inp::EdgeCrack > d_cracks
Set of edge cracks.
Definition: util.h:244
double d_maxZAllowed
Set of edge cracks.
Definition: util.h:250
double d_minZAllowed
Set of edge cracks.
Definition: util.h:247
FILE * d_fileb
File (for bottom tip) to which crack data will be written.
Definition: util.h:256
FILE * d_filet
File (for top tip) to which crack data will be written.
Definition: util.h:253
double d_timeb
Old update time for bottom (left) side of crack.
Definition: util.h:238
size_t d_updateCount
Total number of updates at current time.
Definition: util.h:241
FindCrackTip()
Constructor.
Definition: util.h:261
double d_timet
Old update time for top (right) side of crack.
Definition: util.h:235
Datatype to hold instructions for post-processing operation.
Definition: util.h:325
bool d_damageAtNodes
Computing damage at nodes operation.
Definition: util.h:380
tools::pp::ComputeStrain * d_compStrain_p
Compute strain and its magnitude operation.
Definition: util.h:374
bool d_outOnlyNodes
Flag for performing only nodal output and not full fem output (for large mesh, vtk produces error whe...
Definition: util.h:356
int d_interval
Number which indicates how many simulation file we skip after processing 1 simulation file....
Definition: util.h:349
tools::pp::ComputeJIntegral * d_computeJInt_p
J-integral calculation operation.
Definition: util.h:383
std::string d_tagFilename
Tag assigned to this compute instruction (used for creating output filename)
Definition: util.h:331
tools::pp::FindCrackTip * d_findCrackTip_p
Find crack tip and compute velocity operation.
Definition: util.h:377
int d_start
Start output step.
Definition: util.h:340
tools::pp::TransformVelocity * d_transformV_p
Transform velocity operation.
Definition: util.h:371
std::string d_compressType
Compression type for .vtu files.
Definition: util.h:365
bool d_removeElements
Flag for removing elements which contain damages quadrature point (currently this is not implemented)
Definition: util.h:362
int d_end
End output step.
Definition: util.h:343
bool d_calculateInRefConfig
Calculate in reference configuration.
Definition: util.h:386
tools::pp::TransformU * d_transformU_p
Transforming of displacement operation.
Definition: util.h:368
std::string d_outFormat
Specify format of the output file, e.g. msh, vtu, legacy_vtk.
Definition: util.h:337
Datatype for storing different components of J-integral energy.
Definition: util.h:24
double d_contourPdStrainEnergy
Contour integral of peridynamic strain energy along the direction of crack propagation.
Definition: util.h:30
double d_pdInternalWorkRate
Integral of product of work done by internal peridynamic force and material velocity over region insi...
Definition: util.h:61
double d_contourKineticEnergyRate
Contour integral of kinetic energy and crack velocity product.
Definition: util.h:42
double d_contourPdStrainEnergyRate
Contour integral of peridynamic strain energy and crack velocity product.
Definition: util.h:36
double d_lefmEnergyRate
LEFM fractur energy (Gc times crack velocity)
Definition: util.h:66
double d_pdInternalWork
Integral of product of work done by internal peridynamic force and derivative of displacement along t...
Definition: util.h:55
double d_contourElasticInternalWorkRate
Contour integral of product of elastic force and material velocity.
Definition: util.h:48
double d_pdStrainEnergyInsideContour
Strain energy and kinetic energy within contour.
Definition: util.h:71
double d_pdFractureEnergy
Peridynamic fracture energy.
Definition: util.h:82
double d_kineticEnergyInsideContour
Kintec energy and kinetic energy within contour.
Definition: util.h:77
Datatype used in sorting rectangles for crack tip search.
Definition: util.h:95
size_t d_r
Id of rectangle.
Definition: util.h:101
double d_Z
Damage associated to the node.
Definition: util.h:104
size_t d_i
Id of node.
Definition: util.h:98
Data for transforming displacement operation.
Definition: util.h:148
TransformU()
Constructor.
Definition: util.h:155
double d_scale
Factor for scaling the displacement.
Definition: util.h:150
Data for marking and symmetries of velocity operation.
Definition: util.h:161
bool d_markVAsZero
Specify if velocity is to be marked.
Definition: util.h:163
bool d_markVPtsAreInCurrentConfig
Are points provided in current configuration.
Definition: util.h:175
std::string d_symmAxis
Axis of symmetry, e.g. "x", "y".
Definition: util.h:187
std::vector< size_t > d_markVNodes
List of nodes at which velocities should be marked.
Definition: util.h:178
double d_symmLine
Specify the axis location.
Definition: util.h:190
bool d_symmetrizeV
Specify if velocity is to be Symmetric.
Definition: util.h:181
std::pair< util::Point3, util::Point3 > d_markVRect
Rectangle region for marking.
Definition: util.h:169
TransformVelocity()
Constructor.
Definition: util.h:195
bool d_markVInRectGiven
True if rectangle region for marking is specified.
Definition: util.h:166
bool d_combineMarkV
Specify if combine mark and Symmetric operation.
Definition: util.h:184
std::vector< util::Point3 > d_markVPts
List of points at which velocities should be marked.
Definition: util.h:172
A structure to represent 3d vectors.
Definition: point.h:29