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