39 #define HPP_POLE_FIG_HIST_DIM 512 44 explicit CrystalError (
const std::string &val) : std::runtime_error::runtime_error(val) {}
109 template <
typename U>
124 std::vector<std::vector<U>>
m_0;
125 std::vector<std::vector<U>>
n_0;
126 std::vector<hpp::Tensor2<U>>
S_0;
131 template <
typename U>
170 for (
unsigned int i=0; i<4; i++) {
171 for (
unsigned int j=0; j<4; j++) {
178 for (
unsigned int k=0; k<3; k++) {
179 for (
unsigned int l=0; l<3; l++) {
180 Q(3*i+k,3*j+l) = val;
188 std::vector<std::vector<U>> m_0(props.
n_alpha);
201 m_0 = m_0/std::sqrt((U)2.0);
205 std::vector<std::vector<U>> n_0(props.
n_alpha);
206 for (
int i=0; i<3; i++) {
209 for (
int i=3; i<6; i++) {
212 for (
int i=6; i<9; i++) {
215 for (
int i=9; i<12; i++) {
218 n_0 = n_0/std::sqrt((U)3.0);
222 std::vector<hpp::Tensor2<U>> S_0(props.
n_alpha);
223 for (
unsigned int i=0; i<props.
n_alpha; i++) {
235 template <
typename U>
239 for (
unsigned int i=0; i<propsOld.
n_alpha; i++) {
240 propsNew.
m_0[i] = rotTensor*propsOld.
m_0[i];
241 propsNew.
n_0[i] = rotTensor*propsOld.
n_0[i];
248 template <
typename U>
265 U DT_tol_factor = 1e-4;
267 U Ds_tol_factor = 1e-3;
270 U DT_max_factor = (2.0/3.0);
273 bool verbose =
false;
275 template <
typename U>
286 template <
typename U>
302 bool verbose =
false;
305 template <
typename U>
314 void setS0(
const U& s_0) {this->s_0 = s_0;}
318 template <
typename U>
324 init.
F_p_0 = hpp::identityTensor2<U>(3);
334 template <
typename T>
342 template <
typename U>
359 U recommendNextTimestepSize(U dt);
362 std::vector<std::vector<U>> getM_alphas()
const;
363 std::vector<std::vector<U>> getN_alphas()
const;
365 return (F_e*T)*(F_e.trans())/F_e.
det();
377 std::vector<U> getShearStrainRates();
382 void applyInitialConditions();
406 bool step_accepted =
false;
407 bool step_rejected =
false;
417 void assertAcceptedOrRejectedStep();
437 template <
typename U>
439 throw std::runtime_error(
"No implementation of crystal comparison function. " 440 "This was only put here to allow the boost Python vector indexing suite to" 441 "make a vector of crystals available as a Python container.");
452 bool verbose =
false;
453 bool writeTextureHistory =
false;
454 double textureHistoryTimeInterval = 1e-15;
457 template <
typename U>
465 U recommendNextTimestepSize(U dt);
466 void evolve(U t_start, U t_end, U dt_initial, std::function<
hpp::Tensor2<U>(U t)> F_of_t);
470 return crystal_list.at(i);
474 void writeResultHDF5(std::string filename);
480 void resetHistories();
481 void resetRandomOrientations(U init_s,
unsigned long int seed);
482 void resetGivenOrientations(U init_s,
const std::vector<
EulerAngles<U>>& angleList);
484 std::vector<EulerAngles<U>> getEulerAnglesZXZActive();
494 void updateDerivedQuantities();
498 void applyInitialConditions();
511 void addTextureToHistory();
525 template <
typename U>
530 template <
typename U>
566 template <
typename U>
576 return crystal_list.at(i);
583 void writeResultNumpy(std::string filename);
595 unsigned int nOmpThreads = 1;
SpectralCrystal< U > getCrystal(int i)
Definition: crystal.h:575
std::vector< hpp::Tensor2< U > > S_0
Definition: crystal.h:126
U r_t
Defined on journal page 547 of Kalidindi1992.
Definition: crystal.h:261
Tensor2< T > transformOutOfFrame(const Tensor2< T > &A_star, const Tensor2< T > &Q)
Transform tensor out of the frame given by the columns of .
Definition: tensor.h:1613
std::vector< U > s_alphas_next
Definition: crystal.h:425
CrystalProperties< U > rotate(const CrystalProperties< U > &propsOld, hpp::Tensor2< U > rotTensor)
Definition: crystal.h:236
U kappa
Definition: crystal.h:115
hpp::Tensor2< U > F_p_next
Definition: crystal.h:426
hpp::Tensor2< U > T
Definition: crystal.h:403
HardeningLaw hardeningLaw
Definition: crystal.h:112
Tensor2< T > outer(const std::vector< T > &A, const std::vector< T > &B)
Definition: tensor.h:640
std::vector< SpectralDatasetID > defaultCrystalSpectralDatasetIDs()
Definition: crystal.cpp:5
U gammadot_0
Definition: crystal.h:118
PolycrystalOutputConfig outputConfig
Definition: crystal.h:491
std::vector< Tensor2< U > > T_cauchy_history
Definition: crystal.h:505
EulerAngles< U > getEulerAngles() const
Definition: crystal.h:315
Definition: crystal.h:531
std::vector< std::vector< U > > m_0
Definition: crystal.h:124
Definition: crystal.h:110
Definition: casesUtils.cpp:4
T det() const
The determinant of the tensor.
Definition: tensor.cpp:471
SpectralCrystalSolverConfig< U > config
Definition: crystal.h:563
U s_0
Definition: crystal.h:308
U r_max
Defined on journal page 546 of Kalidindi1992.
Definition: crystal.h:256
CrystalOutputConfig outputConfig
Definition: crystal.h:392
std::vector< hpp::Tensor2< U > > T_cauchy_history
Definition: crystal.h:592
CrystalError(const std::string &val)
Definition: crystal.h:44
Tensor2< T > R
Definition: tensor.h:310
Definition: spectralUtils.h:225
unsigned int nTerms
Definition: crystal.h:527
#define MPA
Definition: continuum.h:13
constexpr int nSlipSystems(CrystalType crystalType)
Definition: crystal.h:52
U m
Definition: crystal.h:117
Crystal< U > getCrystal(int i)
Definition: crystal.h:469
Definition: crystal.h:249
U q
Definition: crystal.h:122
CrystalSolverConfig< U > config
Definition: crystal.h:388
Definition: crystal.h:567
U s_s
Definition: crystal.h:120
Header file for rotation classes and functions.
std::vector< U > dumDgamma_alphas
Definition: crystal.h:431
Tensor2< U > RStar
Definition: crystal.h:552
PolarDecomposition< T > polarDecomposition() const
Polar decomposition of the tensor.
Definition: tensor.cpp:826
hpp::Tensor2< U > F_e
Definition: crystal.h:410
CrystalDatasetIdx
Definition: crystal.h:61
unsigned int algebraic_max_iter
Timestep control by algebraic system convergence Defined on journal page 546 of Kalidindi1992.
Definition: crystal.h:259
std::vector< Tensor2< U > > poleHistogramHistory110
Definition: crystal.h:507
CrystalProperties< U > defaultCrystalProperties()
Definition: crystal.h:132
std::vector< Tensor2< U > > dum2ndOrders
Definition: crystal.h:432
U DT_max
Defined on journal page 545 of Kalidindi1992.
Definition: crystal.h:396
Header file for tensor classes.
bool operator==(const SpectralDatasetID &l, const SpectralDatasetID &r)
Definition: spectralUtils.cpp:132
const std::vector< U > & getTHistory() const
Definition: crystal.h:477
Definition: crystal.h:306
MPI_Comm comm
Definition: crystal.h:515
std::vector< std::vector< U > > m_alphas
Definition: crystal.h:420
std::vector< Crystal< U > > crystal_list
Definition: crystal.h:490
Tensor2< U > TCauchy
Definition: crystal.h:554
std::vector< SpectralCrystal< U > > crystal_list
Definition: crystal.h:588
unsigned int n_alpha
Definition: crystal.h:113
std::vector< Tensor2< U > > poleHistogramHistory100
Definition: crystal.h:508
U DT_tol
Defined on journal page 545 of Kalidindi1992.
Definition: crystal.h:398
std::vector< Tensor2< U > > poleHistogramHistory001
Definition: crystal.h:509
std::vector< U > Dgamma_alphas
Definition: crystal.h:411
U volume
Definition: crystal.h:123
Tensor2< U > getTCauchy() const
Definition: crystal.h:364
CrystalType
Definition: crystal.h:47
Definition: crystal.h:301
CrystalProperties< U > props
Definition: crystal.h:560
U s
Definition: crystal.h:553
U getVolume() const
Definition: crystal.h:546
Tensor2< U > F_p_0
Definition: crystal.h:309
std::vector< U > t_history
Definition: crystal.h:591
Header file for continuum mechanics classes and functions.
hpp::Tensor2< U > F_e_next
Definition: crystal.h:428
CrystalInitialConditions< U > init
Definition: crystal.h:557
U getS0() const
Definition: crystal.h:313
void setS0(const U &s_0)
Definition: crystal.h:314
U Ds_tol
Defined on journal page 545 of Kalidindi1992.
Definition: crystal.h:400
U mu
Definition: crystal.h:114
U c44
Definition: crystal.h:116
Definition: profUtils.h:15
std::vector< Tensor2< U > > poleHistogramHistory011
Definition: crystal.h:510
void setEulerAngles(const EulerAngles< U > &angles)
Definition: crystal.h:316
Tensor2< U > getTCauchy() const
Definition: crystal.h:543
Tensor4< U > cubeSymmetricElasticityTensor(U c11, U c12, U c44)
Construct a fourth order elasticity tensor accounting for cubic symmetry.
Definition: continuum.h:166
hpp::Timer solveTimer
Definition: crystal.h:598
std::vector< Tensor2< U > > poleHistogramHistory111
Definition: crystal.h:506
std::vector< U > Dgamma_alphas_next
Definition: crystal.h:427
int comm_size
Definition: crystal.h:516
The complex generalized spherical harmonic coefficients for real data.
hpp::Tensor2< U > Q
Definition: crystal.h:128
hpp::Tensor2< U > T_next
Definition: crystal.h:424
U h_0
Definition: crystal.h:119
hpp::Tensor2< U > F
Definition: crystal.h:501
U c11
Definition: crystal.h:116
Definition: crystal.h:451
hpp::Tensor2< U > T_cauchy
Definition: crystal.h:495
U getVolume() const
Definition: crystal.h:367
std::vector< std::vector< U > > n_0
Definition: crystal.h:125
std::vector< hpp::Tensor2< U > > dumC_alphas
Definition: crystal.h:434
U a
Definition: crystal.h:121
CrystalInitialConditions< U > init
Definition: crystal.h:389
EulerAngles< T > getEulerZXZAngles(Tensor2< T > R)
Get Euler angles from rotation matrix.
Definition: rotation.h:149
Tensor2< U > crystalRotation
Definition: crystal.h:310
int comm_rank
Definition: crystal.h:517
std::vector< U > t_history
Definition: crystal.h:504
HardeningLaw
Definition: crystal.h:56
#define GPA
Definition: continuum.h:12
U r_min
Defined on journal page 546 of Kalidindi1992.
Definition: crystal.h:254
std::vector< std::vector< U > > n_alphas
Definition: crystal.h:421
const std::vector< U > & getSAlphas() const
Definition: crystal.h:370
CrystalProperties< U > unrotatedProps
Definition: crystal.h:386
Tensor2< U > T_init
Definition: crystal.h:307
Definition: crystal.h:526
A simple deleter for malloc'd memory.
EulerAngles< T > getEulerAnglesFromDeformationGradient(const hpp::Tensor2< T > &F_star)
Get the corresponding Euler angles for the rotation induced by this deformation.
Definition: crystal.h:335
CrystalProperties< U > props
Definition: crystal.h:387
Definition: rotation.h:43
CrystalSolverConfig< U > defaultCrystalSolverConfig()
Definition: crystal.h:276
hpp::Tensor4< U > L
Definition: crystal.h:127
std::vector< U > s_alphas
Definition: crystal.h:404
CrystalInitialConditions< U > defaultCrystalInitialConditions()
Definition: crystal.h:319
CrystalSolverConfig< U > defaultConservativeCrystalSolverConfig()
Definition: crystal.h:287
hpp::Tensor2< U > F_p
Definition: crystal.h:405
std::vector< Tensor4< U > > dum4thOrders
Definition: crystal.h:433
U c12
Definition: crystal.h:116
CrystalType crystal_type
Definition: crystal.h:111
U Dgamma_max
Timestep control by shear rate Defined on journal page 546 of Kalidindi1992.
Definition: crystal.h:252