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