5 #ifndef DIRICHLETINLETOUTLET_POLYCONVEXHGO_HPP 6 #define DIRICHLETINLETOUTLET_POLYCONVEXHGO_HPP 22 Epetra_SerialDenseVector
a,
b;
26 std::string mesh_file = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"mesh_file");
27 std::string boundary_file = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"boundary_file");
28 unsigned int number_physical_groups = Teuchos::getParameter<unsigned int>(Parameters.sublist(
"Mesh"),
"nb_phys_groups");
31 Mesh->read_boundary_file(boundary_file,number_physical_groups);
37 Epetra_FECrsMatrix matrix(Copy,*Laplace->
FEGraph);
43 bc_val[0] = 0.0; bc_val[1] = 1.0;
45 bc_indx[0] = 2; bc_indx[1] = 3;
46 Laplace->
solve_aztec(Parameters.sublist(
"Laplace"), matrix, phi, rhs, &bc_indx[0], &bc_val[0]);
49 bc_indx[0] = 0; bc_indx[1] = 1;
50 Laplace->
solve_aztec(Parameters.sublist(
"Laplace"), matrix, psi, rhs, &bc_indx[0], &bc_val[0]);
56 StandardMap =
new Epetra_Map(-1,3*Mesh->n_local_nodes_without_ghosts,&Mesh->local_dof_without_ghosts[0],0,*
Comm);
57 OverlapMap =
new Epetra_Map(-1,3*Mesh->n_local_nodes,&Mesh->local_dof[0],0,*
Comm);
116 v[0][
StandardMap->LID(3*node+0)] = displacement*(xxmax-xx);
123 F.Update(-1.0,rhsDir,1.0);
153 for (
int i=0;
i<3; ++
i){
160 void get_constitutive_tensors_static_condensation(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){
162 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);
164 double alpha = std::pow(det,-2.0/3.0);
166 Epetra_SerialDenseMatrix rightCauchy(3,3);
167 Epetra_SerialDenseVector M1(6), M2(6);
168 Epetra_SerialDenseVector eye(6);
169 Epetra_SerialDenseVector C(6);
170 Epetra_SerialDenseVector D(6);
172 Epetra_SerialDenseVector piola_nh(6);
188 rightCauchy.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
190 eye(0) = 1.0; eye(1) = 1.0; eye(2) = 1.0; eye(3) = 0.0; eye(4) = 0.0; eye(5) = 0.0;
192 C(0) = rightCauchy(0,0); C(1) = rightCauchy(1,1); C(2) = rightCauchy(2,2);
193 C(3) = rightCauchy(1,2); C(4) = rightCauchy(0,2); C(5) = rightCauchy(0,1);
195 L(0) = (1.0/(det*det))*(rightCauchy(1,1)*rightCauchy(2,2)-rightCauchy(1,2)*rightCauchy(2,1));
196 L(1) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(2,2)-rightCauchy(0,2)*rightCauchy(2,0));
197 L(2) = (1.0/(det*det))*(rightCauchy(0,0)*rightCauchy(1,1)-rightCauchy(0,1)*rightCauchy(1,0));
198 L(3) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(1,0)-rightCauchy(0,0)*rightCauchy(1,2));
199 L(4) = (1.0/(det*det))*(rightCauchy(0,1)*rightCauchy(1,2)-rightCauchy(0,2)*rightCauchy(1,1));
200 L(5) = (1.0/(det*det))*(rightCauchy(0,2)*rightCauchy(2,1)-rightCauchy(0,1)*rightCauchy(2,2));
202 double I1 = C(0) + C(1) + C(2);
203 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);
204 double I2 = (1.0/2.0)*(I1*I1-II1);
205 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);
206 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);
207 double pI2 = std::sqrt(I2);
226 for (
unsigned int i=0;
i<6; ++
i){
227 D(
i) = I1*eye(
i) - C(
i);
228 piola_nh(
i) = 2.0*alpha*mu1*(eye(
i)-(1.0/3.0)*I1*
L(
i));
229 piola_isc(
i) = piola_nh(
i) + (mu2/(det*det))*( 3.0*pI2*D(
i) - 2.0*pI2*I2*
L(
i) ) + 4.0*mu4*T4_1*exp(beta4*S4_1)*M1(
i) + 4.0*mu4*T4_2*exp(beta4*S4_2)*M2(
i);
230 piola_vol(
i) = det*
L(
i);
244 scalarAB = -6.0*mu2*pI2/(det*det);
248 scalarAB = (-4.0/9.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
251 scalarAB = (4.0/3.0)*mu1*alpha*I1 + 4.0*mu2*pI2*I2/(det*det);
254 scalarAB = 3.0*mu2/(det*det*pI2);
257 scalarAB = 6.0*mu2*pI2/(det*det);
260 scalarAB = -scalarAB;
263 scalarAB = (8.0*mu4*U4_1 + 16.0*mu4*beta4*S4_1)*exp(beta4*S4_1);
266 scalarAB = (8.0*mu4*U4_2 + 16.0*mu4*beta4*S4_2)*exp(beta4*S4_2);
272 double ptheta = std::pow(theta,beta3);
273 pressure = mu3*beta3*( (ptheta/
theta) - (1.0/(ptheta*theta)) );
274 dpressure = mu3*beta3*( (beta3-1.0)*(ptheta/(theta*
theta)) + (beta3+1.0)/(ptheta*theta*
theta) );
280 void get_stress_for_recover(Epetra_SerialDenseMatrix & deformation_gradient,
double & det, Epetra_SerialDenseMatrix & piola_stress){
dirichletInletOutlet_PolyconvexHGO(Epetra_Comm &comm, Teuchos::ParameterList &Parameters)
void get_material_parameters(unsigned int &e_lid, unsigned int &gp)
std::vector< int > local_nodes
void tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
void apply_dirichlet_conditions(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
std::vector< double > nodes_coord
int print_solution(Epetra_Vector &lhs, std::string fileName)
void get_internal_pressure(double &theta, double &pressure, double &dpressure)
Epetra_SerialDenseVector b
Epetra_FECrsGraph * FEGraph
Epetra_IntSerialDenseMatrix nodes_to_boundaries
std::vector< int > local_cells
clc clear all close all mesh
int n_local_nodes_without_ghosts
Epetra_SerialDenseMatrix laplace_direction_one
Epetra_Import * ImportToOverlapMap
void setup_dirichlet_conditions()
unsigned int n_gauss_cells
void sym_tensor_product(double scalarAB, Epetra_SerialDenseVector &A, Epetra_SerialDenseVector &B, Epetra_SerialDenseMatrix &AoB, double scalarThis)
Epetra_SerialDenseMatrix laplace_direction_two_cross_one
void compute_local_directions(Epetra_Vector &laplace_one, Epetra_Vector &laplace_two)
void get_constitutive_tensors_static_condensation(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)
void assemblePureDirichlet_homogeneousForcing(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
void get_material_parameters_for_recover(unsigned int &e_lid)
void get_matrix_and_rhs(Epetra_Vector &x, Epetra_FECrsMatrix &K, Epetra_FEVector &F)
~dirichletInletOutlet_PolyconvexHGO()
void get_stress_for_recover(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseMatrix &piola_stress)
void solve_aztec(Teuchos::ParameterList &Parameters, Epetra_FECrsMatrix &matrix, Epetra_Vector &lhs, Epetra_FEVector &rhs, int *bc_indx, double *bc_val)
Epetra_SerialDenseVector a