5 #ifndef NEUMANNINNERSURFACE_STOCHASTICPOLYCONVEXHGO_HPP 6 #define NEUMANNINNERSURFACE_STOCHASTICPOLYCONVEXHGO_HPP 12 #include <boost/random/mersenne_twister.hpp> 13 #include <boost/random/uniform_real_distribution.hpp> 14 #include <boost/math/special_functions/erf.hpp> 15 #include <boost/random/normal_distribution.hpp> 16 #include <boost/math/special_functions/gamma.hpp> 17 #include <boost/math/special_functions/beta.hpp> 43 Epetra_SerialDenseVector
a,
b;
45 Epetra_SerialDenseVector
N;
49 std::string mesh_file = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"mesh_file");
50 std::string boundary_file = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"boundary_file");
51 unsigned int number_physical_groups = Teuchos::getParameter<unsigned int>(Parameters.sublist(
"Mesh"),
"nb_phys_groups");
52 std::string select_model = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"model");
54 mean_mu1 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"mu1");
55 mean_mu2 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"mu2");
56 mean_mu3 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"mu3");
57 mean_mu4 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"mu4");
58 beta3 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"beta3");
59 beta4 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"beta4");
60 theta = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"theta");
61 deltaC1 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"deltaC1");
62 deltaC2 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"deltaC2");
63 deltaU1 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"deltaU1");
64 deltaG4 = Teuchos::getParameter<double>(Parameters.sublist(select_model),
"deltaG4");
66 mean_c1 = 2.0*mean_mu3*beta3*
beta3;
67 mean_c2 = 2.0*mean_mu1 + std::sqrt(3.0)*3.0*
mean_mu2;
70 double gamma = 2.0*mean_mu1/(std::sqrt(3.0)*3.0*
mean_mu2);
71 tau2 = (1.0 - deltaU1*
deltaU1)/(deltaU1*deltaU1*gamma*(gamma+1.0));
72 tau1 = (2.0*mean_mu1/(std::sqrt(3.0)*3.0*
mean_mu2))*
tau2;
75 alpha2 = mean_c1*deltaC1*
deltaC1;
77 alpha4 = mean_c2*deltaC2*
deltaC2;
79 alpha6 = mean_mu4*deltaG4*
deltaG4;
81 Mesh =
new mesh(comm, mesh_file, 1000.0);
88 Epetra_FECrsMatrix matrix(Copy,*Laplace->
FEGraph);
94 bc_val[0] = 0.0; bc_val[1] = 1.0;
96 bc_indx[0] = 2; bc_indx[1] = 3;
97 Laplace->
solve_aztec(Parameters.sublist(
"Laplace"), matrix, phi, rhs, &bc_indx[0], &bc_val[0]);
100 bc_indx[0] = 0; bc_indx[1] = 1;
101 Laplace->
solve_aztec(Parameters.sublist(
"Laplace"), matrix, psi, rhs, &bc_indx[0], &bc_val[0]);
125 void get_media(
unsigned int & n_cells,
unsigned int & n_nodes, std::string & path){
127 std::ifstream connectivity_file_med;
128 connectivity_file_med.open(path);
130 w1_gmrf.Resize(n_nodes);
131 w2_gmrf.Resize(n_nodes);
132 w3_gmrf.Resize(n_nodes);
133 w4_gmrf.Resize(n_nodes);
134 if (connectivity_file_med.is_open()){
135 cells_nodes_p1_med.Resize(4*n_cells);
136 for (
unsigned int e=0;
e<4*n_cells; ++
e){
137 connectivity_file_med >> cells_nodes_p1_med[
e];
138 cells_nodes_p1_med[
e] = cells_nodes_p1_med[
e]-1;
140 connectivity_file_med.close();
143 std::cout <<
"Couldn't open the connectivity file for the media.\n";
174 w1 = 0.0; w2 = 0.0; w3 = 0.0; w4 = 0.0;
175 for (
unsigned int j=0;
j<4; ++
j){
188 mu1 = ( epsilon*mean_mu1 + (1.0/2.0)*c2*
u1 )/( 1.0+epsilon );
189 mu2 = ( epsilon*mean_mu2 + (1.0/(std::sqrt(3.0)*3.0))*c2*(1.0-u1) )/( 1.0+epsilon );
190 mu3 = ( epsilon*mean_mu3 + c1/(2.0*beta3*
beta3) )/( 1.0+
epsilon );
191 mu4 = ( epsilon*mean_mu4 +
mu4 )/( 1.0+epsilon );
193 for (
int i=0;
i<3; ++
i){
197 a(
i) = cos(theta)*
E1(
i) + sin(theta)*
E2(
i);
198 b(
i) = cos(theta)*
E1(
i) - sin(theta)*
E2(
i);
204 double erfx = boost::math::erf<double>(w/std::sqrt(2.0));
205 double y = (1.0/2.0)*(1.0 + erfx);
206 double yinv = boost::math::gamma_p_inv<double,double>(alpha,y);
207 double z = yinv*
beta;
211 double icdf_beta(
double & w,
double & tau1,
double & tau2){
212 double erfx = boost::math::erf<double>(w/std::sqrt(2.0));
213 double y = (1.0/2.0)*(1.0 + erfx);
214 double z = boost::math::ibeta_inv<double,double,double>(
tau1,
tau2,y);
218 void get_constitutive_tensors_static_condensation(Epetra_SerialDenseMatrix & deformation_gradient,
double & det, Epetra_SerialDenseVector & inverse_cauchy, Epetra_SerialDenseVector & piola_isc, Epetra_SerialDenseVector & piola_vol, Epetra_SerialDenseMatrix & tangent_piola_isc, Epetra_SerialDenseMatrix & tangent_piola_vol){
219 model_C(deformation_gradient, det, inverse_cauchy, piola_isc, piola_vol, tangent_piola_isc, tangent_piola_vol);
223 double ptheta = std::pow(theta,beta3);
224 pressure = beta3*( (ptheta/
theta) - (1.0/(ptheta*theta)) );
225 dpressure = beta3*( (beta3-1.0)*(ptheta/(theta*
theta)) + (beta3+1.0)/(ptheta*theta*
theta) );
231 double xi = 1.0/3.0;
double eta = 1.0/3.0;
double zeta = 1.0/3.0;
234 w1 = 0.0; w2 = 0.0; w3 = 0.0; w4 = 0.0;
235 for (
unsigned int j=0;
j<4; ++
j){
248 mu1 = ( epsilon*mean_mu1 + (1.0/2.0)*c2*
u1 )/( 1.0+epsilon );
249 mu2 = ( epsilon*mean_mu2 + (1.0/(std::sqrt(3.0)*3.0))*c2*(1.0-u1) )/( 1.0+epsilon );
250 mu3 = ( epsilon*mean_mu3 + c1/(2.0*beta3*
beta3) )/( 1.0+
epsilon );
251 mu4 = ( epsilon*mean_mu4 +
mu4 )/( 1.0+epsilon );
253 for (
int i=0;
i<3; ++
i){
257 a(
i) = cos(theta)*
E1(
i) + sin(theta)*
E2(
i);
258 b(
i) = cos(theta)*
E1(
i) - sin(theta)*
E2(
i);
263 void get_stress_for_recover(Epetra_SerialDenseMatrix & deformation_gradient,
double & det, Epetra_SerialDenseMatrix & piola_stress){
265 det = deformation_gradient(0,0)*deformation_gradient(1,1)*deformation_gradient(2,2)
266 -deformation_gradient(0,0)*deformation_gradient(1,2)*deformation_gradient(2,1)
267 -deformation_gradient(0,1)*deformation_gradient(1,0)*deformation_gradient(2,2)
268 +deformation_gradient(0,1)*deformation_gradient(1,2)*deformation_gradient(2,0)
269 +deformation_gradient(0,2)*deformation_gradient(1,0)*deformation_gradient(2,1)
270 -deformation_gradient(0,2)*deformation_gradient(1,1)*deformation_gradient(2,0);
272 double alpha = std::pow(det,-2.0/3.0);
273 double beta = 1.0/(det*det);
274 Epetra_SerialDenseMatrix eye(3,3);
275 Epetra_SerialDenseMatrix M1(3,3), M2(3,3);
276 Epetra_SerialDenseMatrix C(3,3),
L(3,3);
277 Epetra_SerialDenseMatrix piola_ani1(3,3), piola_ani2(3,3);
279 eye(0,0) = 1.0; eye(0,1) = 0.0; eye(0,2) = 0.0;
280 eye(1,0) = 0.0; eye(1,1) = 1.0; eye(1,2) = 0.0;
281 eye(2,0) = 0.0; eye(2,1) = 0.0; eye(2,2) = 1.0;
283 M1.Multiply(
'N',
'T',1.0,a,a,0.0);
284 M2.Multiply(
'N',
'T',1.0,b,b,0.0);
286 C.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
288 L(0,0) = (1.0/(det*det))*(C(1,1)*C(2,2)-C(1,2)*C(2,1));
289 L(1,1) = (1.0/(det*det))*(C(0,0)*C(2,2)-C(0,2)*C(2,0));
290 L(2,2) = (1.0/(det*det))*(C(0,0)*C(1,1)-C(0,1)*C(1,0));
291 L(1,2) = (1.0/(det*det))*(C(0,2)*C(1,0)-C(0,0)*C(1,2));
292 L(0,2) = (1.0/(det*det))*(C(0,1)*C(1,2)-C(0,2)*C(1,1));
293 L(0,1) = (1.0/(det*det))*(C(0,2)*C(2,1)-C(0,1)*C(2,2));
294 L(2,1) =
L(1,2);
L(2,0) =
L(0,2);
L(1,0) =
L(0,1);
296 double I1 = C(0,0) + C(1,1) + C(2,2);
297 double II1 = C(0,0)*C(0,0) + C(1,1)*C(1,1) + C(2,2)*C(2,2) + 2.0*C(1,2)*C(1,2) + 2.0*C(0,2)*C(0,2) + 2.0*C(0,1)*C(0,1);
298 double I2 = (1.0/2.0)*(I1*I1-II1);
299 double I4_1 = C(0,0)*M1(0,0) + C(1,1)*M1(1,1) + C(2,2)*M1(2,2) + 2.0*C(0,1)*M1(0,1) + 2.0*C(0,2)*M1(0,2) + 2.0*C(1,2)*M1(1,2);
300 double I4_2 = C(0,0)*M2(0,0) + C(1,1)*M2(1,1) + C(2,2)*M2(2,2) + 2.0*C(0,1)*M2(0,1) + 2.0*C(0,2)*M2(0,2) + 2.0*C(1,2)*M2(1,2);
301 double pI2 = std::sqrt(I2);
303 double S4_1 = (I4_1-1.0)*(I4_1-1.0);
304 double S4_2 = (I4_2-1.0)*(I4_2-1.0);
306 double ptheta = std::pow(det,beta3);
307 double pressure = mu3*beta3*( (ptheta/det) - (1.0/(ptheta*det)) );
309 for (
unsigned int i=0;
i<3; ++
i){
310 for (
unsigned int j=0;
j<3; ++
j){
311 piola_stress(
i,
j) = 2.0*mu1*alpha*(eye(
i,
j)-(1.0/3.0)*
L(
i,
j))
312 + mu2*beta*( 3.0*pI2*(I1*eye(
i,
j)-C(
i,
j)) - 2.0*I2*pI2*
L(
i,
j) )
313 + det*pressure*
L(
i,
j);
314 piola_ani1(
i,
j) = 4.0*mu4*(I4_1-1.0)*exp(beta4*S4_1)*M1(
i,
j);
315 piola_ani2(
i,
j) = 4.0*mu4*(I4_2-1.0)*exp(beta4*S4_2)*M2(
i,
j);
320 piola_stress += piola_ani1;
323 piola_stress += piola_ani2;
349 const int nodesblk_gid0 = 480-1;
350 const int nodesblk_gid1 = 538-1;
351 const int nodesblk_gid2 = 577-1;
433 Epetra_IntSerialDenseVector nodesblk_gid(3);
434 nodesblk_gid(0) = 480-1;
435 nodesblk_gid(1) = 481-1;
436 nodesblk_gid(2) = 479-1;
456 if (node==nodesblk_gid(0)||node==nodesblk_gid(1)||node==nodesblk_gid(2)){
470 if (node==nodesblk_gid(0)||node==nodesblk_gid(1)||node==nodesblk_gid(2)){
484 void apply_clamp(Epetra_FECrsMatrix & K, Epetra_FEVector & F,
double & displacement){
499 void apply_slipbc(Epetra_FECrsMatrix & K, Epetra_FEVector & F,
double & displacement){
500 const int nodesblk_gid0 = 480-1;
501 const int nodesblk_gid1 = 538-1;
502 const int nodesblk_gid2 = 577-1;
551 Epetra_IntSerialDenseVector nodesblk_gid(3);
552 nodesblk_gid(0) = 480-1;
553 nodesblk_gid(1) = 481-1;
554 nodesblk_gid(2) = 479-1;
561 if (node==nodesblk_gid(0)||node==nodesblk_gid(1)||node==nodesblk_gid(2)){
575 void model_C(Epetra_SerialDenseMatrix & deformation_gradient,
double & det, Epetra_SerialDenseVector &
L, Epetra_SerialDenseVector & piola_isc, Epetra_SerialDenseVector & piola_vol, Epetra_SerialDenseMatrix & tangent_piola_isc, Epetra_SerialDenseMatrix & tangent_piola_vol){
577 det = deformation_gradient(0,0)*deformation_gradient(1,1)*deformation_gradient(2,2)
578 -deformation_gradient(0,0)*deformation_gradient(1,2)*deformation_gradient(2,1)
579 -deformation_gradient(0,1)*deformation_gradient(1,0)*deformation_gradient(2,2)
580 +deformation_gradient(0,1)*deformation_gradient(1,2)*deformation_gradient(2,0)
581 +deformation_gradient(0,2)*deformation_gradient(1,0)*deformation_gradient(2,1)
582 -deformation_gradient(0,2)*deformation_gradient(1,1)*deformation_gradient(2,0);
584 double alpha = std::pow(det,-2.0/3.0);
586 Epetra_SerialDenseVector eye(6);
587 Epetra_SerialDenseMatrix rightCauchy(3,3);
588 Epetra_SerialDenseVector M1(6), M2(6);
589 Epetra_SerialDenseVector C(6), D(6);
590 Epetra_SerialDenseVector piola_nh(6), piola_ani1(6), piola_ani2(6);
592 M1(0) =
a(0)*
a(0); M2(0) =
b(0)*
b(0);
593 M1(1) =
a(1)*
a(1); M2(1) =
b(1)*
b(1);
594 M1(2) =
a(2)*
a(2); M2(2) =
b(2)*
b(2);
595 M1(3) =
a(1)*
a(2); M2(3) =
b(1)*
b(2);
596 M1(4) =
a(0)*
a(2); M2(4) =
b(0)*
b(2);
597 M1(5) =
a(0)*
a(1); M2(5) =
b(0)*
b(1);
599 rightCauchy.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
601 eye(0) = 1.0; eye(1) = 1.0; eye(2) = 1.0; eye(3) = 0.0; eye(4) = 0.0; eye(5) = 0.0;
603 C(0) = rightCauchy(0,0); C(1) = rightCauchy(1,1); C(2) = rightCauchy(2,2);
604 C(3) = rightCauchy(1,2); C(4) = rightCauchy(0,2); C(5) = rightCauchy(0,1);
606 L(0) = (1.0/(det*det))*(rightCauchy(1,1)*rightCauchy(2,2)-rightCauchy(1,2)*rightCauchy(2,1));
607 L(1) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(2,2)-rightCauchy(0,2)*rightCauchy(2,0));
608 L(2) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(1,1)-rightCauchy(0,1)*rightCauchy(1,0));
609 L(3) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(1,0)-rightCauchy(0,0)*rightCauchy(1,2));
610 L(4) = (1.0/(det*det))*(rightCauchy(0,1)*rightCauchy(1,2)-rightCauchy(0,2)*rightCauchy(1,1));
611 L(5) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(2,1)-rightCauchy(0,1)*rightCauchy(2,2));
613 double I1 = C(0) + C(1) + C(2);
614 double II1 = C(0)*C(0) + C(1)*C(1) + C(2)*C(2) + 2.0*C(3)*C(3) + 2.0*C(4)*C(4) + 2.0*C(5)*C(5);
615 double I2 = (1.0/2.0)*(I1*I1-II1);
616 double I4_1 = C(0)*M1(0) + C(1)*M1(1) + C(2)*M1(2) + 2.0*C(5)*M1(5) + 2.0*C(4)*M1(4) + 2.0*C(3)*M1(3);
617 double I4_2 = C(0)*M2(0) + C(1)*M2(1) + C(2)*M2(2) + 2.0*C(5)*M2(5) + 2.0*C(4)*M2(4) + 2.0*C(3)*M2(3);
618 double pI2 = std::sqrt(I2);
620 double S4_1 = (I4_1-1.0)*(I4_1-1.0);
621 double S4_2 = (I4_2-1.0)*(I4_2-1.0);
623 for (
unsigned int i=0;
i<6; ++
i){
624 D(
i) = I1*eye(
i) - C(
i);
625 piola_nh(
i) = 2.0*alpha*mu1*(eye(
i)-(1.0/3.0)*I1*
L(
i));
626 piola_isc(
i) = piola_nh(
i) + (mu2/(det*det))*( 3.0*pI2*D(
i) - 2.0*pI2*I2*
L(
i) );
628 piola_ani1(
i) = 4.0*mu4*(I4_1-1.0)*exp(beta4*S4_1)*M1(
i);
629 piola_ani2(
i) = 4.0*mu4*(I4_2-1.0)*exp(beta4*S4_2)*M2(
i);
631 piola_vol(
i) = mu3*det*
L(
i);
638 scalarAB = -2.0*mu3*det;
645 scalarAB = -6.0*mu2*pI2/(det*det);
649 scalarAB = (-4.0/9.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
652 scalarAB = (4.0/3.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
655 scalarAB = 3.0*mu2/(det*det*pI2);
658 scalarAB = 6.0*mu2*pI2/(det*det);
661 scalarAB = -scalarAB;
665 piola_isc += piola_ani1;
666 scalarAB = (8.0*mu4 + 16.0*mu4*beta4*S4_1)*exp(beta4*S4_1);
670 piola_isc += piola_ani2;
671 scalarAB = (8.0*mu4 + 16.0*mu4*beta4*S4_2)*exp(beta4*S4_2);
676 void model_B(Epetra_SerialDenseMatrix & deformation_gradient,
double & det, Epetra_SerialDenseVector & piola_isc, Epetra_SerialDenseVector & piola_vol, Epetra_SerialDenseMatrix & tangent_piola_isc, Epetra_SerialDenseMatrix & tangent_piola_vol){
678 det = deformation_gradient(0,0)*deformation_gradient(1,1)*deformation_gradient(2,2)-deformation_gradient(0,0)*deformation_gradient(1,2)*deformation_gradient(2,1)-deformation_gradient(0,1)*deformation_gradient(1,0)*deformation_gradient(2,2)+deformation_gradient(0,1)*deformation_gradient(1,2)*deformation_gradient(2,0)+deformation_gradient(0,2)*deformation_gradient(1,0)*deformation_gradient(2,1)-deformation_gradient(0,2)*deformation_gradient(1,1)*deformation_gradient(2,0);
680 double alpha = std::pow(det,-2.0/3.0);
682 Epetra_SerialDenseMatrix rightCauchy(3,3);
683 Epetra_SerialDenseVector M1(6), M2(6);
684 Epetra_SerialDenseVector eye(6);
685 Epetra_SerialDenseVector C(6), D(6),
L(6);
686 Epetra_SerialDenseVector dI4_1(6), dI4_2(6);
687 Epetra_SerialDenseVector piola_nh(6), piola_ani1(6), piola_ani2(6);
689 M1(0) =
a(0)*
a(0); M2(0) =
b(0)*
b(0);
690 M1(1) =
a(1)*
a(1); M2(1) =
b(1)*
b(1);
691 M1(2) =
a(2)*
a(2); M2(2) =
b(2)*
b(2);
692 M1(3) =
a(1)*
a(2); M2(3) =
b(1)*
b(2);
693 M1(4) =
a(0)*
a(2); M2(4) =
b(0)*
b(2);
694 M1(5) =
a(0)*
a(1); M2(5) =
b(0)*
b(1);
696 rightCauchy.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
698 eye(0) = 1.0; eye(1) = 1.0; eye(2) = 1.0; eye(3) = 0.0; eye(4) = 0.0; eye(5) = 0.0;
700 C(0) = rightCauchy(0,0); C(1) = rightCauchy(1,1); C(2) = rightCauchy(2,2);
701 C(3) = rightCauchy(1,2); C(4) = rightCauchy(0,2); C(5) = rightCauchy(0,1);
703 L(0) = (1.0/(det*det))*(rightCauchy(1,1)*rightCauchy(2,2)-rightCauchy(1,2)*rightCauchy(2,1));
704 L(1) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(2,2)-rightCauchy(0,2)*rightCauchy(2,0));
705 L(2) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(1,1)-rightCauchy(0,1)*rightCauchy(1,0));
706 L(3) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(1,0)-rightCauchy(0,0)*rightCauchy(1,2));
707 L(4) = (1.0/(det*det))*(rightCauchy(0,1)*rightCauchy(1,2)-rightCauchy(0,2)*rightCauchy(1,1));
708 L(5) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(2,1)-rightCauchy(0,1)*rightCauchy(2,2));
710 double I1 = C(0) + C(1) + C(2);
711 double II1 = C(0)*C(0) + C(1)*C(1) + C(2)*C(2) + 2.0*C(3)*C(3) + 2.0*C(4)*C(4) + 2.0*C(5)*C(5);
712 double I2 = (1.0/2.0)*(I1*I1-II1);
713 double I4_1 = C(0)*M1(0) + C(1)*M1(1) + C(2)*M1(2) + 2.0*C(5)*M1(5) + 2.0*C(4)*M1(4) + 2.0*C(3)*M1(3);
714 double I4_2 = C(0)*M2(0) + C(1)*M2(1) + C(2)*M2(2) + 2.0*C(5)*M2(5) + 2.0*C(4)*M2(4) + 2.0*C(3)*M2(3);
715 double pI2 = std::sqrt(I2);
717 double S4_1 = (alpha*I4_1-1.0)*(alpha*I4_1-1.0);
718 double S4_2 = (alpha*I4_2-1.0)*(alpha*I4_2-1.0);
720 for (
unsigned int i=0;
i<6; ++
i){
721 D(
i) = I1*eye(
i) - C(
i);
722 dI4_1(
i) = M1(
i)-(1.0/3.0)*I4_1*
L(
i);
723 dI4_2(
i) = M2(
i)-(1.0/3.0)*I4_2*
L(
i);
724 piola_nh(
i) = 2.0*alpha*mu1*(eye(
i)-(1.0/3.0)*I1*
L(
i));
725 piola_isc(
i) = piola_nh(
i) + (mu2/(det*det))*( 3.0*pI2*D(
i) - 2.0*pI2*I2*
L(
i) );
727 piola_ani1(
i) = 4.0*mu4*alpha*(alpha*I4_1-1.0)*exp(beta4*S4_1)*(M1(
i)-(1.0/3.0)*I4_1*
L(
i));
728 piola_ani2(
i) = 4.0*mu4*alpha*(alpha*I4_2-1.0)*exp(beta4*S4_2)*(M2(
i)-(1.0/3.0)*I4_2*
L(
i));;
730 piola_vol(
i) = det*
L(
i);
744 scalarAB = -6.0*mu2*pI2/(det*det);
748 scalarAB = (-4.0/9.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
751 scalarAB = (4.0/3.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
754 scalarAB = 3.0*mu2/(det*det*pI2);
757 scalarAB = 6.0*mu2*pI2/(det*det);
760 scalarAB = -scalarAB;
764 piola_isc += piola_ani1;
765 scalarAB = -(8.0/3.0)*mu4*alpha*(alpha*I4_1-1.0)*exp(beta4*S4_1);
767 scalarAB = (8.0/3.0)*mu4*alpha*alpha*exp(beta4*S4_1);
769 scalarAB = 16.0*mu4*beta4*alpha*alpha*S4_1*exp(beta4*S4_1);
773 piola_isc += piola_ani2;
774 scalarAB = -(8.0/3.0)*mu4*alpha*(alpha*I4_2-1.0)*exp(beta4*S4_2);
776 scalarAB = (8.0/3.0)*mu4*alpha*alpha*exp(beta4*S4_2);
778 scalarAB = 16.0*mu4*beta4*alpha*alpha*S4_2*exp(beta4*S4_2);
784 void model_A(Epetra_SerialDenseMatrix & deformation_gradient,
double & det, Epetra_SerialDenseVector & piola_isc, Epetra_SerialDenseVector & piola_vol, Epetra_SerialDenseMatrix & tangent_piola_isc, Epetra_SerialDenseMatrix & tangent_piola_vol){
786 det = deformation_gradient(0,0)*deformation_gradient(1,1)*deformation_gradient(2,2)-deformation_gradient(0,0)*deformation_gradient(1,2)*deformation_gradient(2,1)-deformation_gradient(0,1)*deformation_gradient(1,0)*deformation_gradient(2,2)+deformation_gradient(0,1)*deformation_gradient(1,2)*deformation_gradient(2,0)+deformation_gradient(0,2)*deformation_gradient(1,0)*deformation_gradient(2,1)-deformation_gradient(0,2)*deformation_gradient(1,1)*deformation_gradient(2,0);
788 double alpha = std::pow(det,-2.0/3.0);
790 Epetra_SerialDenseMatrix rightCauchy(3,3);
791 Epetra_SerialDenseVector M1(6), M2(6);
792 Epetra_SerialDenseVector eye(6);
793 Epetra_SerialDenseVector C(6),
L(6), CC(6);
794 Epetra_SerialDenseVector CMMC1(6), CMMC2(6);
795 Epetra_SerialDenseVector D(6);
796 Epetra_SerialDenseVector dK3_1(6), dK3_2(6);
797 Epetra_SerialDenseVector piola_nh(6), piola_ani1(6), piola_ani2(6);
813 rightCauchy.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
815 eye(0) = 1.0; eye(1) = 1.0; eye(2) = 1.0; eye(3) = 0.0; eye(4) = 0.0; eye(5) = 0.0;
817 C(0) = rightCauchy(0,0); C(1) = rightCauchy(1,1); C(2) = rightCauchy(2,2);
818 C(3) = rightCauchy(1,2); C(4) = rightCauchy(0,2); C(5) = rightCauchy(0,1);
820 L(0) = (1.0/(det*det))*(rightCauchy(1,1)*rightCauchy(2,2)-rightCauchy(1,2)*rightCauchy(2,1));
821 L(1) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(2,2)-rightCauchy(0,2)*rightCauchy(2,0));
822 L(2) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(1,1)-rightCauchy(0,1)*rightCauchy(1,0));
823 L(3) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(1,0)-rightCauchy(0,0)*rightCauchy(1,2));
824 L(4) = (1.0/(det*det))*(rightCauchy(0,1)*rightCauchy(1,2)-rightCauchy(0,2)*rightCauchy(1,1));
825 L(5) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(2,1)-rightCauchy(0,1)*rightCauchy(2,2));
827 CMMC1(0) = 2.0*C(0)*M1(0) + 2.0*C(4)*M1(4) + 2.0*C(5)*M1(5);
828 CMMC1(1) = 2.0*C(1)*M1(1) + 2.0*C(3)*M1(3) + 2.0*C(5)*M1(5);
829 CMMC1(2) = 2.0*C(2)*M1(2) + 2.0*C(3)*M1(3) + 2.0*C(4)*M1(4);
830 CMMC1(3) = C(1)*M1(3) + C(3)*M1(1) + C(2)*M1(3) + C(3)*M1(2) + C(4)*M1(5) + C(5)*M1(4);
831 CMMC1(4) = C(0)*M1(4) + C(4)*M1(0) + C(2)*M1(4) + C(4)*M1(2) + C(3)*M1(5) + C(5)*M1(3);
832 CMMC1(5) = C(0)*M1(5) + C(5)*M1(0) + C(1)*M1(5) + C(5)*M1(1) + C(3)*M1(4) + C(4)*M1(3);
834 CMMC2(0) = 2.0*C(0)*M2(0) + 2.0*C(4)*M2(4) + 2.0*C(5)*M2(5);
835 CMMC2(1) = 2.0*C(1)*M2(1) + 2.0*C(3)*M2(3) + 2.0*C(5)*M2(5);
836 CMMC2(2) = 2.0*C(2)*M2(2) + 2.0*C(3)*M2(3) + 2.0*C(4)*M2(4);
837 CMMC2(3) = C(1)*M2(3) + C(3)*M2(1) + C(2)*M2(3) + C(3)*M2(2) + C(4)*M2(5) + C(5)*M2(4);
838 CMMC2(4) = C(0)*M2(4) + C(4)*M2(0) + C(2)*M2(4) + C(4)*M2(2) + C(3)*M2(5) + C(5)*M2(3);
839 CMMC2(5) = C(0)*M2(5) + C(5)*M2(0) + C(1)*M2(5) + C(5)*M2(1) + C(3)*M2(4) + C(4)*M2(3);
841 CC(0) = C(0)*C(0) + C(4)*C(4) + C(5)*C(5);
842 CC(1) = C(1)*C(1) + C(3)*C(3) + C(5)*C(5);
843 CC(2) = C(2)*C(2) + C(3)*C(3) + C(4)*C(4);
844 CC(3) = C(1)*C(3) + C(2)*C(3) + C(4)*C(5);
845 CC(4) = C(0)*C(4) + C(2)*C(4) + C(3)*C(5);
846 CC(5) = C(0)*C(5) + C(1)*C(5) + C(3)*C(4);
848 double I1 = C(0) + C(1) + C(2);
849 double II1 = C(0)*C(0) + C(1)*C(1) + C(2)*C(2) + 2.0*C(3)*C(3) + 2.0*C(4)*C(4) + 2.0*C(5)*C(5);
850 double I2 = (1.0/2.0)*(I1*I1-II1);
851 double I4_1 = C(0)*M1(0) + C(1)*M1(1) + C(2)*M1(2) + 2.0*C(5)*M1(5) + 2.0*C(4)*M1(4) + 2.0*C(3)*M1(3);
852 double I4_2 = C(0)*M2(0) + C(1)*M2(1) + C(2)*M2(2) + 2.0*C(5)*M2(5) + 2.0*C(4)*M2(4) + 2.0*C(3)*M2(3);
853 double I5_1 = CC(0)*M1(0) + CC(1)*M1(1) + CC(2)*M1(2) + 2.0*CC(5)*M1(5) + 2.0*CC(4)*M1(4) + 2.0*CC(3)*M1(3);
854 double I5_2 = CC(0)*M2(0) + CC(1)*M2(1) + CC(2)*M2(2) + 2.0*CC(5)*M2(5) + 2.0*CC(4)*M2(4) + 2.0*CC(3)*M2(3);
855 double K3_1 = I1*I4_1-I5_1;
856 double K3_2 = I1*I4_2-I5_2;
857 double pI2 = std::sqrt(I2);
859 for (
unsigned int i=0;
i<6; ++
i){
860 D(
i) = I1*eye(
i) - C(
i);
861 piola_nh(
i) = 2.0*alpha*mu1*(eye(
i)-(1.0/3.0)*I1*
L(
i));
862 piola_isc(
i) = piola_nh(
i) + (mu2/(det*det))*( 3.0*pI2*D(
i) - 2.0*pI2*I2*
L(
i) );
864 dK3_1(
i) = I4_1*eye(
i) + I1*M1(
i) - CMMC1(
i);
865 dK3_2(
i) = I4_2*eye(
i) + I1*M2(
i) - CMMC2(
i);
866 piola_ani1(
i) = 2.0*mu4*beta4*std::pow(K3_1-2.0,beta4-1.0)*dK3_1(
i);
867 piola_ani2(
i) = 2.0*mu4*beta4*std::pow(K3_2-2.0,beta4-1.0)*dK3_2(
i);
869 piola_vol(
i) = det*
L(
i);
883 scalarAB = -6.0*mu2*pI2/(det*det);
887 scalarAB = (-4.0/9.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
890 scalarAB = (4.0/3.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
893 scalarAB = 3.0*mu2/(det*det*pI2);
896 scalarAB = 6.0*mu2*pI2/(det*det);
899 scalarAB = -scalarAB;
903 piola_isc += piola_ani1;
904 scalarAB = 4.0*mu4*beta4*(beta4-1.0)*std::pow(K3_1-2.0,beta4-2.0);
907 scalarAB = 4.0*mu4*beta4*std::pow(K3_1-2.0,beta4-1.0);
910 scalarAB = -scalarAB;
915 piola_isc += piola_ani2;
916 scalarAB = 4.0*mu4*beta4*(beta4-1.0)*std::pow(K3_2-2.0,beta4-2.0);
919 scalarAB = 4.0*mu4*beta4*std::pow(K3_2-2.0,beta4-1.0);
922 scalarAB = -scalarAB;
Epetra_SerialDenseVector E3
Epetra_SerialDenseVector w1_gmrf
void apply_slipbc_and_clamp(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
std::vector< int > local_nodes
void tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
void setup_slipbc_and_clamp()
std::vector< int > local_dof
neumannInnerSurface_StochasticPolyconvexHGO(Epetra_Comm &comm, Teuchos::ParameterList &Parameters)
int print_solution(Epetra_Vector &lhs, std::string fileName)
void compute_center_local_directions(Epetra_Vector &laplace_one, Epetra_Vector &laplace_two)
Epetra_SerialDenseVector w3_gmrf
double icdf_gamma(double &w, double &alpha, double &beta)
void get_material_parameters(unsigned int &e_lid, unsigned int &gp)
Epetra_SerialDenseVector E1
Epetra_IntSerialDenseVector cells_nodes_p1_med
Epetra_SerialDenseVector E2
Epetra_SerialDenseVector eta_cells
void get_constitutive_tensors_static_condensation(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseVector &inverse_cauchy, Epetra_SerialDenseVector &piola_isc, Epetra_SerialDenseVector &piola_vol, Epetra_SerialDenseMatrix &tangent_piola_isc, Epetra_SerialDenseMatrix &tangent_piola_vol)
void get_stress_for_recover(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseMatrix &piola_stress)
void apply_clamp(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
void get_material_parameters_for_recover(unsigned int &e_lid)
~neumannInnerSurface_StochasticPolyconvexHGO()
void apply_slipbc(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
Epetra_SerialDenseVector xi_cells
int read_boundary_file(std::string &fileName_bc, unsigned int &number_physical_groups)
void model_C(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseVector &L, Epetra_SerialDenseVector &piola_isc, Epetra_SerialDenseVector &piola_vol, Epetra_SerialDenseMatrix &tangent_piola_isc, Epetra_SerialDenseMatrix &tangent_piola_vol)
Epetra_FECrsGraph * FEGraph
Epetra_IntSerialDenseMatrix nodes_to_boundaries
Epetra_SerialDenseMatrix laplace_direction_two_center
std::vector< int > local_cells
clc clear all close all mesh
void apply_dirichlet_conditions(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
int n_local_nodes_without_ghosts
Epetra_SerialDenseVector w2_gmrf
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta, double &zeta)
void get_matrix_and_rhs(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
Epetra_SerialDenseMatrix laplace_direction_two
void setup_dirichlet_conditions()
Epetra_SerialDenseMatrix laplace_direction_one
Epetra_Import * ImportToOverlapMap
void model_B(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseVector &piola_isc, Epetra_SerialDenseVector &piola_vol, Epetra_SerialDenseMatrix &tangent_piola_isc, Epetra_SerialDenseMatrix &tangent_piola_vol)
unsigned int n_gauss_cells
void get_internal_pressure(double &theta, double &pressure, double &dpressure)
void sym_tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
Epetra_SerialDenseMatrix laplace_direction_two_cross_one
double icdf_beta(double &w, double &tau1, double &tau2)
void apply_semiselipbc(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
Epetra_SerialDenseMatrix laplace_direction_one_center
std::vector< int > local_dof_without_ghosts
Epetra_SerialDenseMatrix laplace_direction_two_cross_one_center
void compute_local_directions(Epetra_Vector &laplace_one, Epetra_Vector &laplace_two)
void assembleMixedDirichletDeformationDependentNeumann_homogeneousForcing(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
void get_media(unsigned int &n_cells, unsigned int &n_nodes, std::string &path)
Epetra_SerialDenseVector zeta_cells
Epetra_SerialDenseVector N
Epetra_SerialDenseVector w4_gmrf
void solve_aztec(Teuchos::ParameterList &Parameters, Epetra_FECrsMatrix &matrix, Epetra_Vector &lhs, Epetra_FEVector &rhs, int *bc_indx, double *bc_val)
Epetra_SerialDenseVector b
Epetra_SerialDenseVector a
void model_A(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseVector &piola_isc, Epetra_SerialDenseVector &piola_vol, Epetra_SerialDenseMatrix &tangent_piola_isc, Epetra_SerialDenseMatrix &tangent_piola_vol)