5 #ifndef COMPRESSIBLE_MOONEY_TRANSVERSE_ISOTROPIC_RANDOM_FIELD_HPP 6 #define COMPRESSIBLE_MOONEY_TRANSVERSE_ISOTROPIC_RANDOM_FIELD_HPP 29 Teuchos::ParameterList & Parameters){
31 std::string mesh_file = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"mesh_file");
32 Mesh =
new mesh(comm, mesh_file, 1.0);
35 StandardMap =
new Epetra_Map(-1,3*Mesh->n_local_nodes_without_ghosts,&Mesh->local_dof_without_ghosts[0],0,*
Comm);
36 OverlapMap =
new Epetra_Map(-1,3*Mesh->n_local_nodes,&Mesh->local_dof[0],0,*
Comm);
43 for (
unsigned int e=0;
e<Mesh->n_cells/32; ++
e){
44 for (
unsigned int j=0;
j<32; ++
j){
51 int order = Teuchos::getParameter<int>(Parameters.sublist(
"Shinozuka"),
"order");
60 if (
Comm->MyPID()==0){
67 Comm->Broadcast(&topcoord,1,0);
73 GRF_Generator->rotation =
plyagl;
77 Epetra_SerialDenseVector & exponents,
78 Epetra_SerialDenseVector & hyperParameters){
83 omega = hyperParameters;
100 GRF_Generator->l1 =
omega(4);
101 GRF_Generator->l2 =
omega(5);
103 GRF_Generator->rng.seed(seeds(0));
104 GRF_Generator->generator_gauss_points(w1_shino,*
Mesh,phase);
106 GRF_Generator->rng.seed(seeds(1));
107 GRF_Generator->generator_gauss_points(w2_shino,*
Mesh,phase);
109 GRF_Generator->rng.seed(seeds(2));
110 GRF_Generator->generator_gauss_points(w3_shino,*
Mesh,phase);
112 GRF_Generator->rng.seed(seeds(3));
113 GRF_Generator->generator_gauss_points(w4_shino,*
Mesh,phase);
115 GRF_Generator->rng.seed(seeds(4));
116 GRF_Generator->generator_gauss_points(w5_shino,*
Mesh,phase);
119 for (
unsigned int i=0;
i<w1_shino.Length(); ++
i){
132 alpha = (2.0*alpha)-1.0; beta =
mean_mu(4)/alpha;
141 double erfx = boost::math::erf<double>(w/std::sqrt(2.0));
142 double y = (1.0/2.0)*(1.0 + erfx);
143 double yinv = boost::math::gamma_p_inv<double,double>(alpha,y);
144 double z = yinv*
beta;
149 Epetra_FECrsMatrix & K,
150 Epetra_FEVector & F){
180 if (coord==topcoord){
191 double & displacement){
200 if (coord==topcoord){
207 F.Update(-1.0,rhs_dir,1.0);
217 if (coord==topcoord){
230 mu1 =
mu1rf(e_lid*n_gauss_cells+gp);
231 mu2 =
mu2rf(e_lid*n_gauss_cells+gp);
232 mu3 =
mu3rf(e_lid*n_gauss_cells+gp);
233 mu4 =
mu4rf(e_lid*n_gauss_cells+gp);
234 mu5 =
mu5rf(e_lid*n_gauss_cells+gp);
235 mu = 2.0*mu1 + 4.0*mu2 + 2.0*
mu3;
237 ptrmbeta4 = std::pow(trm,beta4);
238 ptrmbeta5 = std::pow(trm,beta5);
239 if (phase[e_gid] % 2){
240 cos_plyagl = std::cos(plyagl);
241 sin_plyagl = std::sin(plyagl);
244 cos_plyagl = std::cos(plyagl);
245 sin_plyagl = -std::sin(plyagl);
250 Epetra_SerialDenseVector & piola_stress,
251 Epetra_SerialDenseMatrix & tangent_piola){
253 double det = deformation_gradient(0,0)*deformation_gradient(1,1)*deformation_gradient(2,2)
254 - deformation_gradient(0,0)*deformation_gradient(1,2)*deformation_gradient(2,1)
255 - deformation_gradient(0,1)*deformation_gradient(1,0)*deformation_gradient(2,2)
256 + deformation_gradient(0,1)*deformation_gradient(1,2)*deformation_gradient(2,0)
257 + deformation_gradient(0,2)*deformation_gradient(1,0)*deformation_gradient(2,1)
258 - deformation_gradient(0,2)*deformation_gradient(1,1)*deformation_gradient(2,0);
260 Epetra_SerialDenseMatrix C(3,3), CC(3,3), ddJ5(6,6);
261 Epetra_SerialDenseVector LML(6), eye(6), dJ5(6), M(6),
L(6), c(6);
263 C.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
264 CC.Multiply(
'N',
'N',1.0,C,C,0.0);
266 c(0) = C(0,0); c(1) = C(1,1); c(2) = C(2,2); c(3) = C(1,2); c(4) = C(0,2); c(5) = C(0,1);
268 L(0) = (1.0/(det*det))*(C(1,1)*C(2,2)-C(1,2)*C(2,1));
269 L(1) = (1.0/(det*det))*(C(0,0)*C(2,2)-C(0,2)*C(2,0));
270 L(2) = (1.0/(det*det))*(C(0,0)*C(1,1)-C(0,1)*C(1,0));
271 L(3) = (1.0/(det*det))*(C(0,2)*C(1,0)-C(0,0)*C(1,2));
272 L(4) = (1.0/(det*det))*(C(0,1)*C(1,2)-C(0,2)*C(1,1));
273 L(5) = (1.0/(det*det))*(C(0,2)*C(2,1)-C(0,1)*C(2,2));
275 M(0) = mu4*sin_plyagl*sin_plyagl+mu5*cos_plyagl*
cos_plyagl;
276 M(1) = mu4*cos_plyagl*cos_plyagl+mu5*sin_plyagl*
sin_plyagl;
280 M(5) = (mu4-
mu5)*cos_plyagl*sin_plyagl;
282 LML(0) = M(0)*
L(0)*
L(0)+2.0*M(4)*
L(0)*
L(4)+2.0*M(5)*
L(0)*
L(5)+M(2)*
L(4)*
L(4)+2.0*M(3)*
L(4)*
L(5)+M(1)*
L(5)*
L(5);
283 LML(1) = M(1)*
L(1)*
L(1)+2.0*M(4)*
L(1)*
L(3)+2.0*M(5)*
L(1)*
L(5)+M(2)*
L(3)*
L(3)+2.0*M(4)*
L(3)*
L(5)+M(0)*
L(5)*
L(5);
284 LML(2) = M(2)*
L(2)*
L(2)+2.0*M(3)*
L(2)*
L(3)+2.0*M(4)*
L(2)*
L(4)+M(1)*
L(3)*
L(3)+2.0*M(5)*
L(3)*
L(4)+M(0)*
L(4)*
L(4);
285 LML(3) =
L(2)*(
L(1)*M(3)+
L(3)*M(2)+
L(5)*M(4))+
L(3)*(
L(1)*M(1)+
L(3)*M(3)+
L(5)*M(5))+
L(4)*(
L(5)*M(0)+
L(1)*M(5)+
L(3)*M(4));
286 LML(4) =
L(2)*(
L(0)*M(4)+
L(4)*M(2)+
L(5)*M(3))+
L(3)*(
L(0)*M(5)+
L(5)*M(1)+
L(4)*M(3))+
L(4)*(
L(0)*M(0)+
L(4)*M(4)+
L(5)*M(5));
287 LML(5) =
L(1)*(
L(0)*M(5)+
L(5)*M(1)+
L(4)*M(3))+
L(3)*(
L(0)*M(4)+
L(4)*M(2)+
L(5)*M(3))+
L(5)*(
L(0)*M(0)+
L(4)*M(4)+
L(5)*M(5));
289 eye(0) = 1.0; eye(1) = 1.0; eye(2) = 1.0; eye(3) = 0.0; eye(4) = 0.0; eye(5) = 0.0;
291 double I1 = C(0,0) + C(1,1) + C(2,2);
292 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);
293 double I2 = (1.0/2.0)*(I1*I1-II1);
295 double I4 = C(0,0)*M(0) + C(1,1)*M(1) + C(2,2)*M(2) + 2.0*C(0,1)*M(5) + 2.0*C(0,2)*M(4) + 2.0*C(1,2)*M(3);
296 double I5 = CC(0,0)*M(0) + CC(1,1)*M(1) + CC(2,2)*M(2) + 2.0*CC(0,1)*M(5) + 2.0*CC(0,2)*M(4) + 2.0*CC(1,2)*M(3);
297 double J5 = I5 - I1*I4 + I2*
trm;
298 double pI3 = std::pow(I3,-beta3);
299 double pI4 = std::pow(I4, beta4);
300 double pJ5 = std::pow(J5, beta5);
302 for (
unsigned int i=0;
i<6; ++
i){
303 dJ5(
i) = J5*
L(
i) - I3*LML(
i);
304 piola_stress(
i) = 2.0*mu1*eye(
i) + 2.0*mu2*(I1*eye(
i)-c(
i)) + (2.0*mu3*det*det-mu)*
L(
i)
323 tensor_product(4.0*beta4*pI4/(I4*ptrmbeta4),M,M,tangent_piola,1.0);
324 tensor_product(4.0*beta5*pJ5/(J5*ptrmbeta5),dJ5,dJ5,tangent_piola,1.0);
329 ddJ5.Scale(4.0*pJ5/ptrmbeta5);
330 tangent_piola += ddJ5;
334 Epetra_SerialDenseMatrix & xg,
336 Epetra_SerialDenseVector h(3);
337 std::cout <<
"**Err: Not using that method in this example!\n";
344 unsigned int & e_lid,
346 Epetra_SerialDenseVector f(3);
347 std::cout <<
"**Err: Not using that method in this example!\n";
352 std::cout <<
"**Err: Not using that method in this example!\n";
357 Epetra_SerialDenseMatrix & piola_stress){
358 std::cout <<
"**Err: Not using that method in this example!\n";
void setup_dirichlet_conditions()
void get_material_parameters_for_recover(unsigned int &e_lid)
std::vector< int > local_nodes
void tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
std::vector< double > nodes_coord
Epetra_SerialDenseVector mu5rf
void get_constitutive_tensors(Epetra_SerialDenseMatrix &deformation_gradient, Epetra_SerialDenseVector &piola_stress, Epetra_SerialDenseMatrix &tangent_piola)
Epetra_SerialDenseVector mean_mu
void get_stress_for_recover(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseMatrix &piola_stress)
Epetra_SerialDenseVector omega
void setParameters(Epetra_SerialDenseVector ¶meters, Epetra_SerialDenseVector &exponents, Epetra_SerialDenseVector &hyperParameters)
double icdf_gamma(double &w, double &alpha, double &beta)
Teuchos::RCP< shinozuka_layeredcomp_2d > GRF_Generator
void get_matrix_and_rhs(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
std::vector< int > local_cells
clc clear all close all mesh
void assemblePureDirichlet_homogeneousForcing(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
int n_local_nodes_without_ghosts
void RandomFieldGenerator(Epetra_IntSerialDenseVector &seeds)
Epetra_SerialDenseVector mu2rf
Epetra_Import * ImportToOverlapMap
Epetra_SerialDenseVector get_neumannBc(Epetra_SerialDenseMatrix &matrix_X, Epetra_SerialDenseMatrix &xg, unsigned int &gp)
unsigned int n_gauss_cells
tiMooneyRandomField(Epetra_Comm &comm, Teuchos::ParameterList &Parameters)
Epetra_SerialDenseVector mu4rf
void sym_tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
void get_material_parameters(unsigned int &e_lid, unsigned int &gp)
Epetra_SerialDenseVector mu1rf
void set_plyagl(double &Plyagl)
Epetra_SerialDenseVector mu3rf
void apply_dirichlet_conditions(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
Epetra_SerialDenseVector get_forcing(double &x1, double &x2, double &x3, unsigned int &e_lid, unsigned int &gp)