24 for (
int ddl=0; ddl<3; ++ddl){
25 index[3*inode+ddl] = 3*node+ddl;
30 FEGraph->InsertGlobalIndices(1, &index[
i], 1, &index[
j]);
46 Epetra_Vector green_lagrange(CellsMap);
51 Epetra_SerialDenseMatrix deformation_gradient(3,3);
52 Epetra_SerialDenseMatrix right_cauchy(3,3);
55 Epetra_SerialDenseMatrix dx_shape_functions(
Mesh->
el_type,3);
57 Epetra_SerialDenseMatrix JacobianMatrix(3,3);
74 for (
unsigned int inode=0; inode<
Mesh->
el_type; ++inode){
88 deformation_gradient.Multiply(
'N',
'N',1.0,matrix_x,dx_shape_functions,0.0);
89 right_cauchy.Multiply(
'T',
'N',1.0,deformation_gradient,deformation_gradient,0.0);
90 green_lagrange[e_lid] = 0.5*(right_cauchy(1,1)-1.0);
93 int NumTargetElements = 0;
94 if (
Comm->MyPID()==0){
97 Epetra_Map MapOnRoot(-1,NumTargetElements,0,*
Comm);
98 Epetra_Export ExportOnRoot(CellsMap,MapOnRoot);
99 Epetra_MultiVector lhs_root(MapOnRoot,
true);
100 lhs_root.Export(green_lagrange,ExportOnRoot,Insert);
102 int error = EpetraExt::MultiVectorToMatrixMarketFile(filename.c_str(),lhs_root,0,0,
false);
112 Epetra_Vector sigma11(CellsMap); sigma11.PutScalar(0.0);
113 Epetra_Vector sigma22(CellsMap); sigma22.PutScalar(0.0);
114 Epetra_Vector sigma33(CellsMap); sigma33.PutScalar(0.0);
115 Epetra_Vector sigma12(CellsMap); sigma12.PutScalar(0.0);
116 Epetra_Vector sigma13(CellsMap); sigma13.PutScalar(0.0);
117 Epetra_Vector sigma23(CellsMap); sigma23.PutScalar(0.0);
121 double det_jac_cells, det, gauss_weight,
theta;
123 Epetra_SerialDenseMatrix deformation_gradient(3,3);
124 Epetra_SerialDenseMatrix right_cauchy(3,3);
127 Epetra_SerialDenseMatrix JacobianMatrix(3,3);
128 Epetra_SerialDenseMatrix piola_stress(3,3);
129 Epetra_SerialDenseMatrix cauchy_stress(3,3);
130 Epetra_SerialDenseMatrix dg_times_ps(3,3);
151 for (
unsigned int inode=0; inode<
Mesh->
el_type; ++inode){
165 deformation_gradient.Multiply(
'N',
'N',1.0,matrix_x,dx_shape_functions,0.0);
168 dg_times_ps.Multiply(
'N',
'N',1.0,deformation_gradient,piola_stress,0.0);
169 cauchy_stress.Multiply(
'N',
'T',1.0,dg_times_ps,deformation_gradient,0.0);
171 sigma11[e_lid] = cauchy_stress(0,0);
172 sigma22[e_lid] = cauchy_stress(1,1);
173 sigma33[e_lid] = cauchy_stress(2,2);
174 sigma12[e_lid] = cauchy_stress(0,1);
175 sigma13[e_lid] = cauchy_stress(0,2);
176 sigma23[e_lid] = cauchy_stress(1,2);
179 int NumTargetElements = 0;
180 if (
Comm->MyPID()==0){
183 Epetra_Map MapOnRoot(-1,NumTargetElements,0,*
Comm);
184 Epetra_Export ExportOnRoot(CellsMap,MapOnRoot);
186 Epetra_MultiVector lhs_root11(MapOnRoot,
true);
187 lhs_root11.Export(sigma11,ExportOnRoot,Insert);
188 std::string file11 = filename +
"_sigma11.mtx";
189 int error11 = EpetraExt::MultiVectorToMatrixMarketFile(file11.c_str(),lhs_root11,0,0,
false);
191 Epetra_MultiVector lhs_root22(MapOnRoot,
true);
192 lhs_root22.Export(sigma22,ExportOnRoot,Insert);
193 std::string file22 = filename +
"_sigma22.mtx";
194 int error22 = EpetraExt::MultiVectorToMatrixMarketFile(file22.c_str(),lhs_root22,0,0,
false);
196 Epetra_MultiVector lhs_root33(MapOnRoot,
true);
197 lhs_root33.Export(sigma33,ExportOnRoot,Insert);
198 std::string file33 = filename +
"_sigma33.mtx";
199 int error33 = EpetraExt::MultiVectorToMatrixMarketFile(file33.c_str(),lhs_root33,0,0,
false);
201 Epetra_MultiVector lhs_root12(MapOnRoot,
true);
202 lhs_root12.Export(sigma12,ExportOnRoot,Insert);
203 std::string file12 = filename +
"_sigma12.mtx";
204 int error12 = EpetraExt::MultiVectorToMatrixMarketFile(file12.c_str(),lhs_root12,0,0,
false);
206 Epetra_MultiVector lhs_root13(MapOnRoot,
true);
207 lhs_root13.Export(sigma13,ExportOnRoot,Insert);
208 std::string file13 = filename +
"_sigma13.mtx";
209 int error13 = EpetraExt::MultiVectorToMatrixMarketFile(file13.c_str(),lhs_root13,0,0,
false);
211 Epetra_MultiVector lhs_root23(MapOnRoot,
true);
212 lhs_root23.Export(sigma23,ExportOnRoot,Insert);
213 std::string file23 = filename +
"_sigma23.mtx";
214 int error23 = EpetraExt::MultiVectorToMatrixMarketFile(file23.c_str(),lhs_root23,0,0,
false);
224 double det_jac_cells, det, gauss_weight;
226 Epetra_SerialDenseMatrix deformation_gradient(3,3);
227 Epetra_SerialDenseMatrix right_cauchy(3,3);
228 Epetra_SerialDenseMatrix matrix_x(3,
Mesh->
el_type);
229 Epetra_SerialDenseMatrix dx_shape_functions(
Mesh->
el_type,3);
230 Epetra_SerialDenseMatrix piola_stress(3,3);
231 Epetra_SerialDenseMatrix cauchy_stress(3,3);
232 Epetra_SerialDenseMatrix dg_times_ps(3,3);
234 std::vector<int> local_gauss_points;
242 Epetra_Vector vonmises(CellsMap);
247 for (
unsigned int inode=0; inode<
Mesh->
el_type; ++inode){
254 for (
unsigned int gp=0; gp<n_gauss_points; ++gp){
256 for (
unsigned int inode=0; inode<
Mesh->
el_type; ++inode){
257 dx_shape_functions(inode,0) =
Mesh->
DX_N_cells(gp+n_gauss_points*inode,e_lid);
258 dx_shape_functions(inode,1) =
Mesh->
DY_N_cells(gp+n_gauss_points*inode,e_lid);
259 dx_shape_functions(inode,2) =
Mesh->
DZ_N_cells(gp+n_gauss_points*inode,e_lid);
262 deformation_gradient.Multiply(
'N',
'N',1.0,matrix_x,dx_shape_functions,0.0);
266 dg_times_ps.Multiply(
'N',
'N',1.0,deformation_gradient,piola_stress,0.0);
267 cauchy_stress.Multiply(
'N',
'T',1.0,dg_times_ps,deformation_gradient,0.0);
269 vonmises[
Mesh->
n_gauss_cells*e_lid+gp] = std::sqrt( (cauchy_stress(0,0)-cauchy_stress(1,1))*(cauchy_stress(0,0)-cauchy_stress(1,1)) + (cauchy_stress(1,1)-cauchy_stress(2,2))*(cauchy_stress(1,1)-cauchy_stress(2,2)) + (cauchy_stress(2,2)-cauchy_stress(0,0))*(cauchy_stress(2,2)-cauchy_stress(0,0)) + 6.0*(cauchy_stress(1,2)*cauchy_stress(1,2) + cauchy_stress(2,0)*cauchy_stress(2,0) + cauchy_stress(0,1)*cauchy_stress(0,1)) );
273 int NumTargetElements = 0;
274 if (
Comm->MyPID()==0){
277 Epetra_Map MapOnRoot(-1,NumTargetElements,0,*
Comm);
278 Epetra_Export ExportOnRoot(CellsMap,MapOnRoot);
280 Epetra_MultiVector lhs_root11(MapOnRoot,
true);
281 lhs_root11.Export(vonmises,ExportOnRoot,Insert);
282 std::string file11 = filename +
"_gauss_vonmises.mtx";
283 int error11 = EpetraExt::MultiVectorToMatrixMarketFile(file11.c_str(),lhs_root11,0,0,
false);
289 for (
unsigned inode=0; inode<
Mesh->
el_type; ++inode){
290 B(0,3*inode) = F(0,0)*dx_shape_functions(inode,0);
291 B(0,3*inode+1) = F(1,0)*dx_shape_functions(inode,0);
292 B(0,3*inode+2) = F(2,0)*dx_shape_functions(inode,0);
294 B(1,3*inode) = F(0,1)*dx_shape_functions(inode,1);
295 B(1,3*inode+1) = F(1,1)*dx_shape_functions(inode,1);
296 B(1,3*inode+2) = F(2,1)*dx_shape_functions(inode,1);
298 B(2,3*inode) = F(0,2)*dx_shape_functions(inode,2);
299 B(2,3*inode+1) = F(1,2)*dx_shape_functions(inode,2);
300 B(2,3*inode+2) = F(2,2)*dx_shape_functions(inode,2);
302 B(3,3*inode) = F(0,1)*dx_shape_functions(inode,2) + F(0,2)*dx_shape_functions(inode,1);
303 B(3,3*inode+1) = F(1,1)*dx_shape_functions(inode,2) + F(1,2)*dx_shape_functions(inode,1);
304 B(3,3*inode+2) = F(2,1)*dx_shape_functions(inode,2) + F(2,2)*dx_shape_functions(inode,1);
306 B(4,3*inode) = F(0,0)*dx_shape_functions(inode,2) + F(0,2)*dx_shape_functions(inode,0);
307 B(4,3*inode+1) = F(1,0)*dx_shape_functions(inode,2) + F(1,2)*dx_shape_functions(inode,0);
308 B(4,3*inode+2) = F(2,0)*dx_shape_functions(inode,2) + F(2,2)*dx_shape_functions(inode,0);
310 B(5,3*inode) = F(0,0)*dx_shape_functions(inode,1) + F(0,1)*dx_shape_functions(inode,0);
311 B(5,3*inode+1) = F(1,0)*dx_shape_functions(inode,1) + F(1,1)*dx_shape_functions(inode,0);
312 B(5,3*inode+2) = F(2,0)*dx_shape_functions(inode,1) + F(2,1)*dx_shape_functions(inode,0);
314 BG(0,3*inode) = dx_shape_functions(inode,0);
315 BG(1,3*inode) = dx_shape_functions(inode,1);
316 BG(2,3*inode) = dx_shape_functions(inode,2);
318 BG(3,3*inode+1) = dx_shape_functions(inode,0);
319 BG(4,3*inode+1) = dx_shape_functions(inode,1);
320 BG(5,3*inode+1) = dx_shape_functions(inode,2);
322 BG(6,3*inode+2) = dx_shape_functions(inode,0);
323 BG(7,3*inode+2) = dx_shape_functions(inode,1);
324 BG(8,3*inode+2) = dx_shape_functions(inode,2);
Epetra_SerialDenseVector DZ_N_cells
std::vector< double > nodes_coord
virtual void get_stress_for_recover(Epetra_SerialDenseMatrix &deformation_gradient, double &det, Epetra_SerialDenseMatrix &piola_stress)=0
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta, double &zeta)
void dX_shape_functions(Epetra_SerialDenseMatrix &D, Epetra_SerialDenseMatrix JacobianMatrix, double &jac, Epetra_SerialDenseMatrix &DX)
Epetra_SerialDenseVector DX_N_cells
void compute_center_cauchy_stress(Epetra_Vector &x, std::string &filename)
Epetra_FECrsGraph * FEGraph
std::vector< int > local_cells
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta, double &zeta)
void jacobian_det(Epetra_SerialDenseMatrix &JacobianMatrix, double &jac)
void compute_gauss_vonmises(Epetra_Vector &x, std::string &filename)
Epetra_SerialDenseVector DY_N_cells
std::vector< int > cells_nodes
Epetra_Import * ImportToOverlapMap
unsigned int n_gauss_cells
int compute_green_lagrange(Epetra_Vector &x, double &xi, double &eta, double &zeta, std::string &filename)
void compute_B_matrices(Epetra_SerialDenseMatrix &F, Epetra_SerialDenseMatrix &dx_shape_functions, Epetra_SerialDenseMatrix &B, Epetra_SerialDenseMatrix &BG)
virtual void get_material_parameters_for_recover(unsigned int &e_lid)=0
virtual void get_material_parameters(unsigned int &e_lid, unsigned int &gp)=0
void d_shape_functions(Epetra_SerialDenseMatrix &D, double &xi, double &eta, double &zeta)
Epetra_SerialDenseVector gauss_weight_cells
void jacobian_matrix(Epetra_SerialDenseMatrix &X, Epetra_SerialDenseMatrix &D, Epetra_SerialDenseMatrix &JacobianMatrix)