Trilinos based (stochastic) FEM solvers
dirichletStripElongation_StochasticPolyconvexHGO.hpp
Go to the documentation of this file.
1 /*
2 Brian Staber (brian.staber@gmail.com)
3 */
4 
5 #ifndef DIRICHLETSTRIPELONGATION_STOCHASTICPOLYCONVEXHGO_HPP
6 #define DIRICHLETSTRIPELONGATION_STOCHASTICPOLYCONVEXHGO_HPP
7 
8 #include "tensor_calculus.hpp"
9 #include "laplacepp.hpp"
11 
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>
18 
20 {
21 public:
22 
23  double w1, w2, w3, w4;
24  double mean_c1, c1, deltaC1;
25  double mean_c2, c2, deltaC2;
26  double mean_u1, u1, deltaU1;
27  double mean_mu4, mu4, deltaG4;
28  double mean_mu1, mu1;
29  double mean_mu2, mu2;
30  double mean_mu3, mu3;
31  double alpha1, alpha2;
32  double alpha3, alpha4;
33  double tau1, tau2;
34  double alpha5, alpha6;
35  double beta3, beta4;
36  double theta;
37  double epsilon = 1e-6;
38 
39  Epetra_IntSerialDenseVector cells_nodes_p1_med;
40  Epetra_SerialDenseVector w1_gmrf, w2_gmrf, w3_gmrf, w4_gmrf;
41  Epetra_SerialDenseVector a, b;
42  Epetra_SerialDenseVector E1,E2,E3;
43 
44  dirichletStripElongation_StochasticPolyconvexHGO(Epetra_Comm & comm, Teuchos::ParameterList & Parameters){
45 
46  std::string mesh_file = Teuchos::getParameter<std::string>(Parameters.sublist("Mesh"), "mesh_file");
47  //std::string boundary_file = Teuchos::getParameter<std::string>(Parameters.sublist("Mesh"), "boundary_file");
48  unsigned int number_physical_groups = Teuchos::getParameter<unsigned int>(Parameters.sublist("Mesh"), "nb_phys_groups");
49  std::string select_model = Teuchos::getParameter<std::string>(Parameters.sublist("Mesh"), "model");
50 
51  mean_mu1 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "mu1");
52  mean_mu2 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "mu2");
53  mean_mu3 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "mu3");
54  mean_mu4 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "mu4");
55  beta3 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "beta3");
56  beta4 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "beta4");
57  theta = Teuchos::getParameter<double>(Parameters.sublist(select_model), "theta");
58  deltaC1 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "deltaC1");
59  deltaC2 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "deltaC2");
60  deltaU1 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "deltaU1");
61  deltaG4 = Teuchos::getParameter<double>(Parameters.sublist(select_model), "deltaG4");
62 
63  mean_c1 = 2.0*mean_mu3*beta3*beta3;
64  mean_c2 = 2.0*mean_mu1 + std::sqrt(3.0)*3.0*mean_mu2;
65  mean_u1 = 2.0*mean_mu1/mean_c2;
66 
67  double gamma = 2.0*mean_mu1/(std::sqrt(3.0)*3.0*mean_mu2);
68  tau2 = (1.0 - deltaU1*deltaU1)/(deltaU1*deltaU1*gamma*(gamma+1.0));
69  tau1 = (2.0*mean_mu1/(std::sqrt(3.0)*3.0*mean_mu2))*tau2;
70 
71  alpha1 = 1.0/(deltaC1*deltaC1);
72  alpha2 = mean_c1*deltaC1*deltaC1;
73  alpha3 = 1.0/(deltaC2*deltaC2);
74  alpha4 = mean_c2*deltaC2*deltaC2;
75  alpha5 = 1.0/(deltaG4*deltaG4);
76  alpha6 = mean_mu4*deltaG4*deltaG4;
77 
78  Mesh = new mesh(comm, mesh_file, 1000.0);
79  //Mesh->read_boundary_file(boundary_file,number_physical_groups);
80  Comm = Mesh->Comm;
81 
83  OverlapMap = new Epetra_Map(-1,3*Mesh->n_local_nodes,&Mesh->local_dof[0],0,*Comm);
84  ImportToOverlapMap = new Epetra_Import(*OverlapMap,*StandardMap);
86 
87  a.Resize(3); b.Resize(3);
88  E1.Resize(3); E2.Resize(3); E3.Resize(3);
89  E1(0) = 1.0; E1(1) = 0.0; E1(2) = 0.0;
90  E2(0) = 0.0; E2(1) = 1.0; E2(2) = 0.0;
91  E3(0) = 0.0; E3(1) = 0.0; E3(2) = 1.0;
92  for (int i=0; i<3; ++i){
93  a(i) = std::cos(theta)*E1(i) + std::sin(theta)*E2(i);
94  b(i) = std::cos(theta)*E1(i) - std::sin(theta)*E2(i);
95  }
96 
98  }
99 
101  }
102 
103  void get_media(unsigned int & n_cells, unsigned int & n_nodes, std::string & path){
104 
105  std::ifstream connectivity_file_med;
106  connectivity_file_med.open(path);
107 
108  w1_gmrf.Resize(n_nodes);
109  w2_gmrf.Resize(n_nodes);
110  w3_gmrf.Resize(n_nodes);
111  w4_gmrf.Resize(n_nodes);
112  if (connectivity_file_med.is_open()){
113  cells_nodes_p1_med.Resize(4*n_cells);
114  for (unsigned int e=0; e<4*n_cells; ++e){
115  connectivity_file_med >> cells_nodes_p1_med[e];
116  cells_nodes_p1_med[e] = cells_nodes_p1_med[e]-1;
117  }
118  connectivity_file_med.close();
119  }
120  else{
121  std::cout << "Couldn't open the connectivity file for the media.\n";
122  }
123 
124  }
125 
126  void get_matrix_and_rhs(Epetra_Vector & x, Epetra_FECrsMatrix & K, Epetra_FEVector & F){
128  }
129 
131  n_bc_dof = 0;
132  int dof = 1;
133  double coord;
134  unsigned int node;
135  for (unsigned int i=0; i<Mesh->n_local_nodes_without_ghosts; ++i){
136  node = Mesh->local_nodes[i];
137  coord = Mesh->nodes_coord[3*node+dof];
138  if(coord==0.0){
139  n_bc_dof+=3;
140  }
141  if(coord==10.0/1000.0){
142  n_bc_dof+=3;
143  }
144  }
145 
146  int indbc = 0;
147  dof_on_boundary = new int [n_bc_dof];
148  for (unsigned int inode=0; inode<Mesh->n_local_nodes_without_ghosts; ++inode){
149  node = Mesh->local_nodes[inode];
150  coord = Mesh->nodes_coord[3*node+dof];
151  if (coord==0.0){
152  dof_on_boundary[indbc+0] = 3*inode+0;
153  dof_on_boundary[indbc+1] = 3*inode+1;
154  dof_on_boundary[indbc+2] = 3*inode+2;
155  indbc+=3;
156  }
157  if (coord==10.0/1000.0){
158  dof_on_boundary[indbc+0] = 3*inode+0;
159  dof_on_boundary[indbc+1] = 3*inode+1;
160  dof_on_boundary[indbc+2] = 3*inode+2;
161  indbc+=3;
162  }
163  }
164  }
165 
166  void apply_dirichlet_conditions(Epetra_FECrsMatrix & K, Epetra_FEVector & F, double & displacement){
167  Epetra_MultiVector v(*StandardMap,true);
168  v.PutScalar(0.0);
169 
170  int node;
171  int dof = 1;
172  double coord;
173  for (unsigned int inode=0; inode<Mesh->n_local_nodes_without_ghosts; ++inode){
174  node = Mesh->local_nodes[inode];
175  coord = Mesh->nodes_coord[3*node+dof];
176  if (coord==10.0/1000.0){
177  v[0][StandardMap->LID(3*node+dof)] = displacement;
178  }
179  }
180 
181  Epetra_MultiVector rhs_dir(*StandardMap,true);
182  K.Apply(v,rhs_dir);
183  F.Update(-1.0,rhs_dir,1.0);
184 
185  for (unsigned int inode=0; inode<Mesh->n_local_nodes_without_ghosts; ++inode){
186  node = Mesh->local_nodes[inode];
187  coord = Mesh->nodes_coord[3*node+dof];
188  if (coord==0.0){
189  F[0][StandardMap->LID(3*node+0)] = 0.0;
190  F[0][StandardMap->LID(3*node+1)] = 0.0;
191  F[0][StandardMap->LID(3*node+2)] = 0.0;
192  }
193  if (coord==10.0/1000.0){
194  F[0][StandardMap->LID(3*node+0)] = 0.0;
195  F[0][StandardMap->LID(3*node+dof)] = displacement;
196  F[0][StandardMap->LID(3*node+2)] = 0.0;
197  }
198  }
199  ML_Epetra::Apply_OAZToMatrix(dof_on_boundary,n_bc_dof,K);
200  }
201 
202  void get_material_parameters(unsigned int & e_lid, unsigned int & gp){
203 
204  int n_gauss_points = Mesh->n_gauss_cells;
205  int e_gid = Mesh->local_cells[e_lid];
206  int node;
207  double xi = Mesh->xi_cells[gp]; double eta = Mesh->eta_cells[gp]; double zeta = Mesh->zeta_cells[gp];
208  Epetra_SerialDenseVector N(4);
209  tetra4::shape_functions(N,xi,eta,zeta);
210 
211  w1 = 0.0; w2 = 0.0; w3 = 0.0; w4 = 0.0;
212  for (unsigned int j=0; j<4; ++j){
213  node = cells_nodes_p1_med(4*e_gid+j);
214  w1 += N(j)*w1_gmrf(node);
215  w2 += N(j)*w2_gmrf(node);
216  w3 += N(j)*w3_gmrf(node);
217  w4 += N(j)*w4_gmrf(node);
218  }
219 
220  c1 = icdf_gamma(w1,alpha1,alpha2);
221  c2 = icdf_gamma(w2,alpha3,alpha4);
222  u1 = icdf_beta (w3,tau1,tau2);
223  mu4 = icdf_gamma(w4,alpha5,alpha6);
224 
225  mu1 = ( epsilon*mean_mu1 + (1.0/2.0)*c2*u1 )/( 1.0+epsilon );
226  mu2 = ( epsilon*mean_mu2 + (1.0/(std::sqrt(3.0)*3.0))*c2*(1.0-u1) )/( 1.0+epsilon );
227  mu3 = ( epsilon*mean_mu3 + c1/(2.0*beta3*beta3) )/( 1.0+epsilon );
228  mu4 = ( epsilon*mean_mu4 + mu4 )/( 1.0+epsilon );
229 
230  }
231 
232  double icdf_gamma(double & w, double & alpha, double & beta){
233  double erfx = boost::math::erf<double>(w/std::sqrt(2.0));
234  double y = (1.0/2.0)*(1.0 + erfx);
235  double yinv = boost::math::gamma_p_inv<double,double>(alpha,y);
236  double z = yinv*beta;
237  return z;
238  }
239 
240  double icdf_beta(double & w, double & tau1, double & tau2){
241  double erfx = boost::math::erf<double>(w/std::sqrt(2.0));
242  double y = (1.0/2.0)*(1.0 + erfx);
243  double z = boost::math::ibeta_inv<double,double,double>(tau1,tau2,y);
244  return z;
245  }
246 
247  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){
248  model_C(deformation_gradient, det, inverse_cauchy, piola_isc, piola_vol, tangent_piola_isc, tangent_piola_vol);
249  }
250 
251  void get_internal_pressure(double & theta, double & pressure, double & dpressure){
252  double ptheta = std::pow(theta,beta3);
253  pressure = beta3*( (ptheta/theta) - (1.0/(ptheta*theta)) );
254  dpressure = beta3*( (beta3-1.0)*(ptheta/(theta*theta)) + (beta3+1.0)/(ptheta*theta*theta) );
255  }
256 
257  void get_material_parameters_for_recover(unsigned int & e_lid){
258 
259  int e_gid = Mesh->local_cells[e_lid];
260  double xi = 1.0/3.0; double eta = 1.0/3.0; double zeta = 1.0/3.0;
261  Epetra_SerialDenseVector N(4);
262  tetra4::shape_functions(N,xi,eta,zeta);
263 
264  w1 = 0.0; w2 = 0.0; w3 = 0.0; w4 = 0.0;
265  for (unsigned int j=0; j<4; ++j){
266  int node = cells_nodes_p1_med(4*e_gid+j);
267  w1 += N(j)*w1_gmrf(node);
268  w2 += N(j)*w2_gmrf(node);
269  w3 += N(j)*w3_gmrf(node);
270  w4 += N(j)*w4_gmrf(node);
271  }
272 
273  c1 = icdf_gamma(w1,alpha1,alpha2);
274  c2 = icdf_gamma(w2,alpha3,alpha4);
275  u1 = icdf_beta (w3,tau1,tau2);
276  mu4 = icdf_gamma(w4,alpha5,alpha6);
277 
278  mu1 = ( epsilon*mean_mu1 + (1.0/2.0)*c2*u1 )/( 1.0+epsilon );
279  mu2 = ( epsilon*mean_mu2 + (1.0/(std::sqrt(3.0)*3.0))*c2*(1.0-u1) )/( 1.0+epsilon );
280  mu3 = ( epsilon*mean_mu3 + c1/(2.0*beta3*beta3) )/( 1.0+epsilon );
281  mu4 = ( epsilon*mean_mu4 + mu4 )/( 1.0+epsilon );
282 
283  }
284 
285  void get_stress_for_recover(Epetra_SerialDenseMatrix & deformation_gradient, double & det, Epetra_SerialDenseMatrix & piola_stress){
286 
287  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);
288 
289  double alpha = std::pow(det,-2.0/3.0);
290  double beta = 1.0/(det*det);
291  Epetra_SerialDenseMatrix eye(3,3);
292  Epetra_SerialDenseMatrix M1(3,3), M2(3,3);
293  Epetra_SerialDenseMatrix C(3,3), L(3,3);
294  Epetra_SerialDenseMatrix piola_ani1(3,3), piola_ani2(3,3);
295 
296  eye(0,0) = 1.0; eye(0,1) = 0.0; eye(0,2) = 0.0;
297  eye(1,0) = 0.0; eye(1,1) = 1.0; eye(1,2) = 0.0;
298  eye(2,0) = 0.0; eye(2,1) = 0.0; eye(2,2) = 1.0;
299 
300  M1.Multiply('N','T',1.0,a,a,0.0);
301  M2.Multiply('N','T',1.0,b,b,0.0);
302 
303  C.Multiply('T','N',1.0,deformation_gradient,deformation_gradient,0.0);
304 
305  L(0,0) = (1.0/(det*det))*(C(1,1)*C(2,2)-C(1,2)*C(2,1));
306  L(1,1) = (1.0/(det*det))*(C(0,0)*C(2,2)-C(0,2)*C(2,0));
307  L(2,2) = (1.0/(det*det))*(C(0,0)*C(1,1)-C(0,1)*C(1,0));
308  L(1,2) = (1.0/(det*det))*(C(0,2)*C(1,0)-C(0,0)*C(1,2));
309  L(0,2) = (1.0/(det*det))*(C(0,1)*C(1,2)-C(0,2)*C(1,1));
310  L(0,1) = (1.0/(det*det))*(C(0,2)*C(2,1)-C(0,1)*C(2,2));
311  L(2,1) = L(1,2); L(2,0) = L(0,2); L(1,0) = L(0,1);
312 
313  double I1 = C(0,0) + C(1,1) + C(2,2);
314  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);
315  double I2 = (1.0/2.0)*(I1*I1-II1);
316  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);
317  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);
318  double pI2 = std::sqrt(I2);
319 
320  double S4_1 = (I4_1-1.0)*(I4_1-1.0);
321  double S4_2 = (I4_2-1.0)*(I4_2-1.0);
322 
323  double ptheta = std::pow(det,beta3);
324  double pressure = mu3*beta3*( (ptheta/det) - (1.0/(ptheta*det)) );
325 
326  for (unsigned int i=0; i<3; ++i){
327  for (unsigned int j=0; j<3; ++j){
328  piola_stress(i,j) = 2.0*mu1*alpha*(eye(i,j)-(1.0/3.0)*L(i,j))
329  + mu2*beta*( 3.0*pI2*(I1*eye(i,j)-C(i,j)) - 2.0*I2*pI2*L(i,j) )
330  + det*pressure*L(i,j);
331  piola_ani1(i,j) = 4.0*mu4*(I4_1-1.0)*exp(beta4*S4_1)*M1(i,j);
332  piola_ani2(i,j) = 4.0*mu4*(I4_2-1.0)*exp(beta4*S4_2)*M2(i,j);
333  }
334  }
335 
336  if (I4_1>1.0){
337  piola_stress += piola_ani1;
338  }
339  if (I4_2>1.0){
340  piola_stress += piola_ani2;
341  }
342 
343  }
344 
345  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){
346 
347  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);
348 
349  double alpha = std::pow(det,-2.0/3.0);
350 
351  Epetra_SerialDenseVector eye(6);
352  Epetra_SerialDenseMatrix rightCauchy(3,3);
353  Epetra_SerialDenseVector M1(6), M2(6);
354  Epetra_SerialDenseVector C(6), D(6);
355  Epetra_SerialDenseVector piola_nh(6), piola_ani1(6), piola_ani2(6);
356 
357  M1(0) = a(0)*a(0); M2(0) = b(0)*b(0);
358  M1(1) = a(1)*a(1); M2(1) = b(1)*b(1);
359  M1(2) = a(2)*a(2); M2(2) = b(2)*b(2);
360  M1(3) = a(1)*a(2); M2(3) = b(1)*b(2);
361  M1(4) = a(0)*a(2); M2(4) = b(0)*b(2);
362  M1(5) = a(0)*a(1); M2(5) = b(0)*b(1);
363 
364  rightCauchy.Multiply('T','N',1.0,deformation_gradient,deformation_gradient,0.0);
365 
366  eye(0) = 1.0; eye(1) = 1.0; eye(2) = 1.0; eye(3) = 0.0; eye(4) = 0.0; eye(5) = 0.0;
367 
368  C(0) = rightCauchy(0,0); C(1) = rightCauchy(1,1); C(2) = rightCauchy(2,2);
369  C(3) = rightCauchy(1,2); C(4) = rightCauchy(0,2); C(5) = rightCauchy(0,1);
370 
371  L(0) = (1.0/(det*det))*(rightCauchy(1,1)*rightCauchy(2,2)-rightCauchy(1,2)*rightCauchy(2,1));
372  L(1) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(2,2)-rightCauchy(0,2)*rightCauchy(2,0));
373  L(2) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(1,1)-rightCauchy(0,1)*rightCauchy(1,0));
374  L(3) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(1,0)-rightCauchy(0,0)*rightCauchy(1,2));
375  L(4) = (1.0/(det*det))*(rightCauchy(0,1)*rightCauchy(1,2)-rightCauchy(0,2)*rightCauchy(1,1));
376  L(5) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(2,1)-rightCauchy(0,1)*rightCauchy(2,2));
377 
378  double I1 = C(0) + C(1) + C(2);
379  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);
380  double I2 = (1.0/2.0)*(I1*I1-II1);
381  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);
382  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);
383  double pI2 = std::sqrt(I2);
384 
385  double S4_1 = (I4_1-1.0)*(I4_1-1.0);
386  double S4_2 = (I4_2-1.0)*(I4_2-1.0);
387 
388  for (unsigned int i=0; i<6; ++i){
389  D(i) = I1*eye(i) - C(i);
390  piola_nh(i) = 2.0*alpha*mu1*(eye(i)-(1.0/3.0)*I1*L(i));
391  piola_isc(i) = piola_nh(i) + (mu2/(det*det))*( 3.0*pI2*D(i) - 2.0*pI2*I2*L(i) );
392 
393  piola_ani1(i) = 4.0*mu4*(I4_1-1.0)*exp(beta4*S4_1)*M1(i);
394  piola_ani2(i) = 4.0*mu4*(I4_2-1.0)*exp(beta4*S4_2)*M2(i);
395 
396  piola_vol(i) = mu3*det*L(i);
397  }
398 
399  double scalarAB;
400 
401  scalarAB = mu3*det;
402  tensor_product(mu3*det,L,L,tangent_piola_vol,0.0);
403  scalarAB = -2.0*mu3*det;
404  sym_tensor_product(scalarAB,L,L,tangent_piola_vol,1.0);
405 
406  scalarAB = -2.0/3.0;
407  tensor_product(scalarAB,piola_nh,L,tangent_piola_isc,0.0);
408  tensor_product(scalarAB,L,piola_nh,tangent_piola_isc,1.0);
409 
410  scalarAB = -6.0*mu2*pI2/(det*det);
411  tensor_product(scalarAB,D,eye,tangent_piola_isc,1.0);
412  tensor_product(scalarAB,eye,D,tangent_piola_isc,1.0);
413 
414  scalarAB = (-4.0/9.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
415  tensor_product(scalarAB,L,L,tangent_piola_isc,1.0);
416 
417  scalarAB = (4.0/3.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
418  sym_tensor_product(scalarAB,L,L,tangent_piola_isc,1.0);
419 
420  scalarAB = 3.0*mu2/(det*det*pI2);
421  tensor_product(scalarAB,D,D,tangent_piola_isc,1.0);
422 
423  scalarAB = 6.0*mu2*pI2/(det*det);
424  tensor_product(scalarAB,eye,eye,tangent_piola_isc,1.0);
425 
426  scalarAB = -scalarAB;
427  sym_tensor_product(scalarAB,eye,eye,tangent_piola_isc,1.0);
428 
429  if (I4_1>1.0){
430  piola_isc += piola_ani1;
431  scalarAB = (8.0*mu4 + 16.0*mu4*beta4*S4_1)*exp(beta4*S4_1);
432  tensor_product(scalarAB,M1,M1,tangent_piola_isc,1.0);
433  }
434  if (I4_2>1.0){
435  piola_isc += piola_ani2;
436  scalarAB = (8.0*mu4 + 16.0*mu4*beta4*S4_2)*exp(beta4*S4_2);
437  tensor_product(scalarAB,M2,M2,tangent_piola_isc,1.0);
438  }
439  }
440 
441 };
442 
443 #endif
void get_internal_pressure(double &theta, double &pressure, double &dpressure)
void apply_dirichlet_conditions(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
Epetra_Comm * Comm
for j
Definition: costFunction.m:42
std::vector< int > local_nodes
Definition: meshpp.hpp:80
void tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
std::vector< double > nodes_coord
Definition: meshpp.hpp:77
std::vector< int > local_dof
Definition: meshpp.hpp:80
unsigned int n_bc_dof
Epetra_Comm * Comm
Definition: meshpp.hpp:69
Epetra_SerialDenseVector eta_cells
Definition: meshpp.hpp:100
void get_media(unsigned int &n_cells, unsigned int &n_nodes, std::string &path)
Epetra_SerialDenseVector xi_cells
Definition: meshpp.hpp:100
void get_stress_for_recover(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseMatrix &piola_stress)
std::vector< int > local_cells
Definition: meshpp.hpp:81
clc clear all close all mesh
Definition: run.m:5
int n_local_nodes_without_ghosts
Definition: meshpp.hpp:92
int n_local_nodes
Definition: meshpp.hpp:93
void shape_functions(Epetra_SerialDenseVector &N, double &xi, double &eta, double &zeta)
Definition: fepp.cpp:110
L
Definition: costFunction.m:66
Epetra_Import * ImportToOverlapMap
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)
Epetra_Map * StandardMap
unsigned int n_gauss_cells
Definition: meshpp.hpp:98
void get_matrix_and_rhs(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
void sym_tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
std::vector< int > local_dof_without_ghosts
Definition: meshpp.hpp:79
modelParameters beta
Definition: run_station15.m:10
for i
Definition: costFunction.m:38
Epetra_Map * OverlapMap
e
Definition: run.m:10
void assemblePureDirichlet_homogeneousForcing(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
Epetra_SerialDenseVector zeta_cells
Definition: meshpp.hpp:100
dirichletStripElongation_StochasticPolyconvexHGO(Epetra_Comm &comm, Teuchos::ParameterList &Parameters)
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)
output eta
Definition: costFunction.m:33