Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
UniformController.h
Go to the documentation of this file.
1/* This file is part of MoDELib, the Mechanics Of Defects Evolution Library.
2 *
3 *
4 * MoDELib is distributed without any warranty under the
5 * GNU General Public License (GPL) v2 <http://www.gnu.org/licenses/>.
6 */
7
8#ifndef model_UniformController_H_
9#define model_UniformController_H_
10
11#include <cmath>
12#include <Eigen/Dense>
13
14namespace model
15{
16
17 template <int voigtSize>
19 {
20 typedef Eigen::Matrix<double,voigtSize,1> VectorVoigt;
21 typedef Eigen::Matrix<double,voigtSize,voigtSize> MatrixVoigt;
22
23 const double t0;
34
35 UniformController(const double& t0_in,
36 const MatrixVoigt& A_in,const VectorVoigt& alpha_in,
37 const VectorVoigt& g0_in,const VectorVoigt& g0Dot_in,
38 const VectorVoigt& f0_in,const VectorVoigt& f0Dot_in) :
39 /* init */ t0(t0_in)
40 /* init */,A(A_in)
41 /* init */,alpha(alpha_in)
42 /* init */,g0(g0_in)
43 /* init */,g0Dot(g0Dot_in)
44 /* init */,f0(f0_in)
45 /* init */,f0Dot(f0Dot_in)
46 /* init */,D((alpha.array()*A.diagonal().array()).matrix().asDiagonal())
47 /* init */,MG((A+D).inverse())
48 /* init */,MF(A*MG)
49 /* init */,gs(VectorVoigt::Zero())
50 {
51
52// std::cout<<"A=\n"<<A<<std::endl;
53// std::cout<<"D=\n"<<D<<std::endl;
54// std::cout<<"MG=\n"<<MG<<std::endl;
55// std::cout<<"MF=\n"<<MF<<std::endl;
56// std::cout<<"MG.norm()="<<MG.norm()<<std::endl;
57// std::cout<<"MG finite="<<std::isfinite(MG.norm())<<std::endl;
58//
59// const double norm2MG(MG.squaredNorm());
60// if(norm2MG!=norm2MG)
61// {
62// throw std::runtime_error("UniformController: MG is not finite.");
63// }
64
65 }
66
67 VectorVoigt flux(const double& t) const
68 {
69 return MF*(f0+f0Dot*(t-t0)
70 +D*(g0+g0Dot*(t-t0)-gs)
71 );
72 }
73
74 VectorVoigt grad(const double& t) const
75 {
76 return MG*(f0+f0Dot*(t-t0)
77 +D*(g0+g0Dot*(t-t0))
78 +A*gs
79 );
80 }
81
82// VectorComp operator()(const VectorDim& x,const double& t) const
83// {
84// return grad(t).reshaped(dim,comp).transpose()*x;
85// }
86
87 };
88
89}
90#endif
final point of the source segment t
UniformController(const double &t0_in, const MatrixVoigt &A_in, const VectorVoigt &alpha_in, const VectorVoigt &g0_in, const VectorVoigt &g0Dot_in, const VectorVoigt &f0_in, const VectorVoigt &f0Dot_in)
VectorVoigt flux(const double &t) const
VectorVoigt grad(const double &t) const
Eigen::Matrix< double, voigtSize, 1 > VectorVoigt
Eigen::Matrix< double, voigtSize, voigtSize > MatrixVoigt
Eigen::MatrixXd matrix(const Form &form)