oILAB
Loading...
Searching...
No Matches
GbMaterialTensors.cpp
Go to the documentation of this file.
1//
2// Created by Nikhil Chandra Admal on 6/18/24.
3//
4#include <GbMaterialTensors.h>
5
6namespace gbLAB {
7
8 double GbMaterialTensors::tensorC(const int& k, const int& p, const int& l, const int& q)
9 {
10 return lambda*(k==p)*(l==q) + mu*(k==l)*(p==q) + mu*(k==q)*(p==l);
11 }
12
13 std::complex<double> GbMaterialTensors::tensorFhat(const int& k, const int& l, const int& i, const int& j, const Eigen::Vector3d& xi)
14 {
15 std::complex<double> output(0,0);
16 double xi2Norm= sqrt(std::pow(xi(0),2) + std::pow(xi(2),2));
17 double nu= lambda/(2*(lambda+mu));
18 double nuFactor= 1-nu;
19 // first term
20 if (i==j)
21 {
22 if (k!=1 && l!=1)
23 output= output + xi(k)*xi(l)*M_PI/(2*std::pow(xi2Norm,3));
24 else if (k==1 && l==1)
25 output= output + M_PI/(2*xi2Norm);
26 }
27 // second term
28 std::list<int> ijkl{i,j,k,l};
29 int count= std::count(ijkl.begin(),ijkl.end(),1);
30 if ( count % 2 != 0)
31 return output;
32 else if(count == 0)
33 output= output - xi(i)*xi(j)*xi(k)*xi(l)/(2*nuFactor) * 3 * M_PI / (8*std::pow(xi2Norm,5));
34 else if(count == 4)
35 output= output - 1.0/(2*nuFactor) * 3 * M_PI / (8*xi2Norm);
36 else if(count == 2)
37 {
38 ijkl.remove(1);
39 double temp=1.0;
40 for(const auto elem : ijkl)
41 temp= temp*xi(elem);
42 output= output - temp/(2*nuFactor) * M_PI / (8*std::pow(xi2Norm,3));
43 }
44
45 return -output/(4*std::pow(M_PI,2)*mu);
46 }
47
48
49 std::complex<double> GbMaterialTensors::tensorGhat(const int& i, const int& k, const int& t, const int& r, const Eigen::VectorXd& xi)
50 {
51 std::complex<double> output(0,0);
52 int l= 1;
53 int s= 1;
54 for (int u=0; u<3; ++u)
55 for (int b=0; b<3; ++b)
56 for (int c=0; c<3; ++c)
57 output= output + tensorC(i,l,u,r)*tensorC(b,c,t,s)*tensorFhat(c,k,u,b,xi) -
58 tensorC(i,l,u,s)*tensorC(b,c,t,r)*tensorFhat(c,k,u,b,xi) -
59 tensorC(i,k,u,r)*tensorC(b,c,t,s)*tensorFhat(c,l,u,b,xi) +
60 tensorC(i,k,u,s)*tensorC(b,c,t,r)*tensorFhat(c,l,u,b,xi);
61 return output;
62 }
63
64 std::complex<double> GbMaterialTensors::tensorHhat(const int& t, const int& i, const Eigen::VectorXd &xi)
65 {
66 std::complex<double> output(0,0);
67 for(int k=0; k<3; ++k)
68 for(int r=0; r<3; ++r)
69 output= output - 4*std::pow(M_PI,2)* (tensorGhat(i,k,t,r,xi) + tensorGhat(t,k,i,r,xi)) * xi(r)*xi(k);
70 return output;
71 }
72
75}
76
static std::complex< double > tensorFhat(const int &k, const int &l, const int &i, const int &j, const Eigen::Vector3d &xi)
static std::complex< double > tensorGhat(const int &i, const int &k, const int &t, const int &r, const Eigen::VectorXd &xi)
static std::complex< double > tensorHhat(const int &t, const int &i, const Eigen::VectorXd &xi)
static double tensorC(const int &k, const int &p, const int &l, const int &q)