5 #ifndef LINEARPATCHTEST_HPP 6 #define LINEARPATCHTEST_HPP 18 Krylov = &Parameters.sublist(
"Krylov");
20 std::string mesh_file = Teuchos::getParameter<std::string>(Parameters.sublist(
"Mesh"),
"mesh_file");
21 Mesh =
new mesh(comm, mesh_file, 1.0);
24 StandardMap =
new Epetra_Map(-1,3*Mesh->n_local_nodes_without_ghosts,&Mesh->local_dof_without_ghosts[0],0,*
Comm);
25 OverlapMap =
new Epetra_Map(-1,3*Mesh->n_local_nodes,&Mesh->local_dof[0],0,*
Comm);
35 Epetra_SerialDenseVector
get_neumannBc(Epetra_SerialDenseMatrix & matrix_X, Epetra_SerialDenseMatrix & xg,
unsigned int & gp){
36 std::cout <<
"Not using this method in this application.\n";
37 Epetra_SerialDenseVector f(3);
40 Epetra_SerialDenseVector
get_forcing(
double & x1,
double & x2,
double & x3,
unsigned int & e_lid,
unsigned int & gp){
41 std::cout <<
"Not using this method in this application.\n";
42 Epetra_SerialDenseVector f(3);
47 Epetra_FECrsMatrix linearOperator(Copy,*
FEGraph);
56 print_solution(lhs,
"/Users/brian/Documents/GitHub/Trilinos_results/cee530/linearpatchtest/linearPatchTest.mtx");
62 double errorL2(Epetra_Vector & uStandardMap){
75 Epetra_SerialDenseVector uExact(3), vH(3);
77 Epetra_SerialDenseMatrix u_G(3,n_gauss_points), x_G(3,n_gauss_points);
81 for (
unsigned int inode=0; inode<
Mesh->
el_type; ++inode){
92 for (
unsigned int gp=0; gp<n_gauss_points; ++gp){
95 vH(0) = uExact(0) - u_G(0,gp);
96 vH(1) = uExact(1) - u_G(1,gp);
97 vH(2) = uExact(2) - u_G(2,gp);
109 Comm->SumAll(&error,&totalError,1);
110 totalError = std::sqrt(totalError);
114 Epetra_SerialDenseVector
exactSolution(
double & x1,
double & x2,
double & x3){
115 Epetra_SerialDenseVector
u(3);
116 u(0) = 0.1*x1+0.2*x2+0.4*x3;
117 u(1) = 0.4*x1+0.5*x2+0.1*x3;
118 u(2) = 0.05*x1+0.25*x2+0.65*x3;
131 if(x==0||y==0||z==0||x==1.0||y==1.0||z==1.0){
143 if(x==0||y==0||z==0||x==1.0||y==1.0||z==1.0){
163 if (x==0||y==0||z==0||x==1.0||y==1.0||z==1.0){
164 Epetra_SerialDenseVector
u(3);
174 F.Update(-1.0,rhs_dir,1.0);
181 if (x==0||y==0||z==0||x==1.0||y==1.0||z==1.0){
193 double c1 = 144.8969*1.0e3;
194 double c2 = 14.2500*1.0e3;
195 double c3 = 5.8442*1.0e3;
196 double c4 = 7.5462*1.0e3;
197 double c5 = 12.5580*1.0e3;
202 C(0,0) = c1/16.0 + (9.0*c2)/32.0 + (9.0*c4)/32.0 + (3.0*c5)/8.0 + (3.0*std::sqrt(2.0)*c3)/16.0;
203 C(0,1) = (3.0*c1)/16.0 + (3.0*c2)/32.0 + (3.0*c4)/32.0 - (3.0*c5)/8.0 + (5.0*std::sqrt(2.0)*c3)/16.0;
204 C(0,2) = (3.0*c2)/8.0 - (3.0*c4)/8.0 + (std::sqrt(2.0)*c3)/8.0;
207 C(0,5) = std::sqrt(6)*(c1/16.0 - (3.0*c2)/32.0 - (3.0*c4)/32.0 + c5/8.0 + (std::sqrt(2.0)*c3)/16.0);
209 C(1,0) = (3.0*c1)/16.0 + (3.0*c2)/32.0 + (3.0*c4)/32.0 - (3.0*c5)/8.0 + (5*std::sqrt(2.0)*c3)/16.0;
210 C(1,1) = (9.0*c1)/16.0 + c2/32.0 + c4/32.0 + (3.0*c5)/8.0 + (3.0*std::sqrt(2.0)*c3)/16.0;
211 C(1,2) = c2/8.0 - c4/8.0 + (3.0*std::sqrt(2.0)*c3)/8.0;
214 C(1,5) = -std::sqrt(6.0)*(c2/32.0 - (3.0*c1)/16.0 + c4/32.0 + c5/8.0 + (std::sqrt(2.0)*c3)/16.0);
216 C(2,0) = (3.0*c2)/8.0 - (3.0*c4)/8.0 + std::sqrt(2.0)*c3/8.0;
217 C(2,1) = c2/8.0 - c4/8.0 + (3.0*std::sqrt(2.0)*c3)/8.0;
218 C(2,2) = c2/2.0 + c4/2.0;
221 C(2,5) = (std::sqrt(3.0)*(2.0*c3 - std::sqrt(2.0)*c2 + std::sqrt(2.0)*c4))/8.0;
226 C(3,3) = c4/4.0 + (3.0*c5)/4.0;
227 C(3,4) = -(std::sqrt(3.0)*(c4 - c5))/4.0;
233 C(4,3) = -(std::sqrt(3.0)*(c4 - c5))/4.0;
234 C(4,4) = (3.0*c4)/4.0 + c5/4.0;
237 C(5,0) = std::sqrt(6.0)*(c1/16.0 - (3.0*c2)/32.0 - (3.0*c4)/32.0 + c5/8.0 + std::sqrt(2.0)*c3/16.0);
238 C(5,1) = -std::sqrt(6.0)*(c2/32.0 - (3.0*c1)/16.0 + c4/32.0 + c5/8.0 + (std::sqrt(2.0)*c3)/16.0);
239 C(5,2) = (std::sqrt(3.0)*(2.0*c3 - std::sqrt(2.0)*c2 + std::sqrt(2.0)*c4))/8.0;
242 C(5,5) = (3.0*c1)/8.0 + (3.0*c2)/16.0 + (3.0*c4)/16.0 + c5/4.0 - (3.0*std::sqrt(2.0)*c3)/8.0;
int print_solution(Epetra_Vector &solution, std::string fileName)
std::vector< int > local_nodes
Teuchos::ParameterList * Krylov
std::vector< double > nodes_coord
Epetra_SerialDenseVector get_neumannBc(Epetra_SerialDenseMatrix &matrix_X, Epetra_SerialDenseMatrix &xg, unsigned int &gp)
Epetra_SerialDenseVector N_cells
double solve(bool doprint)
void transverse_isotropic_matrix(Epetra_SerialDenseMatrix &C, double &c1, double &c2, double &c3, double &c4, double &c5)
Epetra_SerialDenseVector detJac_cells
Epetra_FECrsGraph * FEGraph
std::vector< int > local_cells
clc clear all close all mesh
int n_local_nodes_without_ghosts
void setup_dirichlet_conditions()
void get_elasticity_tensor(unsigned int &e_lid, unsigned int &gp, Epetra_SerialDenseMatrix &tangent_matrix)
void get_elasticity_tensor_for_recovery(unsigned int &e_lid, Epetra_SerialDenseMatrix &tangent_matrix)
std::vector< int > cells_nodes
void assemblePureDirichlet_homogeneousForcing(Epetra_FECrsMatrix &K)
Epetra_Import * ImportToOverlapMap
unsigned int n_gauss_cells
Epetra_SerialDenseVector get_forcing(double &x1, double &x2, double &x3, unsigned int &e_lid, unsigned int &gp)
void aztecSolver(Epetra_FECrsMatrix &A, Epetra_FEVector &b, Epetra_Vector &u, Teuchos::ParameterList ¶mList)
Epetra_SerialDenseVector gauss_weight_cells
void apply_dirichlet_conditions(Epetra_FECrsMatrix &K, Epetra_FEVector &F, double &displacement)
Epetra_SerialDenseVector exactSolution(double &x1, double &x2, double &x3)
double errorL2(Epetra_Vector &uStandardMap)
linearPatchTest(Epetra_Comm &comm, Teuchos::ParameterList &Parameters)