fd_test.cppGo to the documentation of this file.00001 //=============================================================================== 00002 //# COPYRIGHT (C): Woody's license (by BJ): 00003 // ``This source code is Copyrighted in 00004 // U.S., for an indefinite period, and anybody 00005 // caught using it without our permission, will be 00006 // mighty good friends of ourn, cause we don't give 00007 // a darn. Hack it. Compile it. Debug it. Run it. 00008 // Yodel it. Enjoy it. We wrote it, that's all we 00009 // wanted to do.'' 00010 // 00011 //# PROJECT: Object Oriented Finite Element Program 00012 //# PURPOSE: Finite Deformation Hyper-Elastic classes 00013 //# CLASS: 00014 //# 00015 //# VERSION: 0.6_(1803398874989) (golden section) 00016 //# LANGUAGE: C++ 00017 //# TARGET OS: all... 00018 //# DESIGN: Zhao Cheng, Boris Jeremic (jeremic@ucdavis.edu) 00019 //# PROGRAMMER(S): Zhao Cheng, Boris Jeremic 00020 //# 00021 //# 00022 //# DATE: 19AUg2003 00023 //# UPDATE HISTORY: Sept 2003 00024 //# 00025 //# 00026 //=============================================================================== 00027 00028 // fd_test.cpp 00029 00030 #include <string.h> 00031 #include <math.h> 00032 #include <stdio.h> 00033 #include <iostream.h> 00034 00035 //#include <Vector.h> 00036 //#include <Tensor.h> 00037 //#include <BJvector.h> 00038 //#include <BJtensor.h> 00039 00040 #include "FiniteDeformationElastic3D.h" 00041 00042 00043 // standard C++ includes 00044 #include <stdlib.h> 00045 #include <iostream.h> 00046 00047 #include <G3Globals.h> 00048 #include <OPS_Globals.h> 00049 #include <ConsoleErrorHandler.h> 00050 00051 00052 00053 // init the global variabled defined in G3Globals.h 00054 ErrorHandler *g3ErrorHandler =0; 00055 double ops_Dt = 0; 00056 Domain *ops_TheActiveDomain = 0; 00057 Element *ops_TheActiveElement = 0; 00058 00059 00060 00061 // init the global variabled defined in OPS_Globals.h 00062 #include <StandardStream.h> 00063 00064 StandardStream sserr; 00065 OPS_Stream &opserr = sserr; 00066 00067 00068 00069 #include "FDdecoupledElastic3D.h" 00070 #include "FiniteDeformationElastic3D.h" 00071 #include "W.h" 00072 #include "LogWEnergy.h" 00073 #include "NeoHookeanWEnergy.h" 00074 #include "SimoPisterWEnergy.h" 00075 #include "OgdenWEnergy.h" 00076 #include "MooneyRivlinWEnergy.h" 00077 #include "OgdenSimoWEnergy.h" 00078 #include "MooneyRivlinSimoWEnergy.h" 00079 00080 int main() 00081 { 00082 printf("\n\n\n*** Finite Deformations: T E S T ***\n\n"); 00083 00084 double rho_in = 0.0; 00085 double K_in = 1971.67; 00086 double G_in = 422.5; 00087 00089 //int Nogden = 3; 00090 //double cr[3]; 00091 //double mur[3]; 00092 //cr[0] = 6.3e5; 00093 //cr[1] = 0.012e5; 00094 //cr[2] = -0.1e5; 00095 //mur[0] = 1.3; 00096 //mur[1] = 5.0; 00097 //mur[2] = -2.0; 00098 00100 //double c1_in = 1.8484375e5; 00101 //double c2_in = 0.2640625e5; 00102 00103 printf(" rho = %.12e\n",rho_in); 00104 printf(" K = %.12e\n",K_in); 00105 printf(" G = %.12e\n",G_in); 00106 00107 //LogWEnergy thisFDW( E_in, nu_in ); 00108 NeoHookeanWEnergy thisFDW( K_in, G_in ); 00109 //SimoPisterWEnergy thisFDW( E_in, nu_in ); 00110 //OgdenWEnergy thisFDW( E_in, nu_in, Nogden, cr, mur); 00111 //MooneyRivlinWEnergy thisFDW( E_in, nu_in, c1_in, c2_in ); 00112 //OgdenSimoWEnergy thisFDW( E_in, nu_in, Nogden, cr, mur ); 00113 //MooneyRivlinSimoWEnergy thisFDW( E_in, nu_in, c1_in, c2_in ); 00114 00115 00116 FDdecoupledElastic3D thisFDstate( 0, 0, &thisFDW, rho_in); 00117 00118 double gammastart = 0.0; 00119 double gammaend = 0.11; 00120 double deltagamma = 0.1; 00121 printf(" gammastart = %.12e\n",gammastart); 00122 printf(" gammaend = %.12e\n",gammaend); 00123 printf(" deltagamma = %.12e\n",deltagamma); 00124 00125 double gamma = 0.0; 00126 Tensor aStress(2, def_dim_2, 0.0); 00127 00128 for ( gamma = gammastart ; gamma <= gammaend ; gamma = gamma + deltagamma ) 00129 { 00130 printf("\n gamma = %.12e\n",gamma); 00131 00132 // /***********************************************************************************/ 00133 // /* Simple shear */ 00134 // /***********************************************************************************/ 00135 double F11 = 1.0; double F12 = 0.0; double F13 = gamma; 00136 double F21 = 0.0; double F22 = 1.0; double F23 = 0.0; 00137 double F31 = 0.0; double F32 = 0.0; double F33 = 1.0; 00138 00139 // 00140 //**************************************************************************************/ 00141 //* Pure Extension */ 00142 //**************************************************************************************/ 00143 // double F11 = 1.0+gamma; double F12 = 0.0; double F13 = 0.0; 00144 // double F21 = 0.0; double F22 = 1.0; double F23 = 0.0; 00145 // double F31 = 0.0; double F32 = 0.0; double F33 = 1.0; 00146 00147 // 00148 //**************************************************************************************/ 00149 //* Simple Extension */ 00150 //**************************************************************************************/ 00151 // double F11 = 1.0+gamma; double F12 = 0.0; double F13 = 0.0; 00152 // double F21 = 0.0; double F22 = 1.0/sqrt(1.0+gamma); double F23 = 0.0; 00153 // double F31 = 0.0; double F32 = 0.0; double F33 = 1.0/sqrt(1.0+gamma); 00154 00155 // 00159 // double F11 = 1.0-gamma; double F12 = 0.0; double F13 = 0.0; 00160 // double F21 = 0.0; double F22 = 0.999999; double F23 = 0.0; 00161 // double F31 = 0.0; double F32 = 0.0; double F33 = 1.000001; 00162 00163 00164 // 00168 // double dilatancy = 0.2; 00169 // double F11 = 1.0-gamma; double F12 = 0.0; double F13 = 0.0; 00170 // double F21 = 0.0; double F22 = 1.0+gamma*dilatancy; double F23 = 0.0; 00171 // double F31 = 0.0; double F32 = 0.0; double F33 = 1.0+gamma*dilatancy; 00172 00173 00177 // double F11 = 1.0+gamma; double F12 = 0.0; double F13 = 0.0; 00178 // double F21 = 0.0; double F22 = 1.0+gamma; double F23 = 0.0; 00179 // double F31 = 0.0; double F32 = 0.0; double F33 = 1.0+gamma; 00180 00181 00182 double F_values[] = { F11, F12, F13, 00183 F21, F22, F23, 00184 F31, F32, F33 }; 00185 00186 Tensor thisf(2, def_dim_2, F_values); 00187 thisf.print("F","\n"); 00188 thisFDstate.setTrialF(thisf); 00189 // Tensor thisC = thisFDstate.getC(); 00190 // thisC.print("C","\n"); 00191 // tensor eigtensor = thisC.eigenvalues(); 00192 // tensor eigvector = thisC.eigenvectors(); 00193 // eigtensor.print("U","\n"); 00194 // eigvector.print("R","\n"); 00195 00196 // Tensor thisb = thisf("im")*thisf("jm"); 00197 // thisb.null_indices(); 00198 // thisb.print("b","\n"); 00199 // tensor eigtensorb = thisb.eigenvalues(); 00200 // tensor eigvectorb = thisb.eigenvectors(); 00201 // eigtensorb.print("Ub","\n"); 00202 // eigvectorb.print("Rb","\n"); 00203 00204 00205 00206 // double thisJ = thisFDstate.getJ(); 00207 // printf("\nJ = %lf\n", thisJ); 00208 00209 // Tensor Cinv = thisC.inverse(); 00210 // Cinv.print("Cinv","\nInverse of C:"); 00211 // Tensor CinvCinv = Cinv("ij")*Cinv("kl") ; 00212 // CinvCinv.null_indices(); 00213 // Tensor ICinv = ( CinvCinv.transpose0110() + CinvCinv.transpose0111() ) * (-0.5); 00214 // ICinv.print("ICinv","\nICinv:"); 00215 00216 // Vector lambda = thisFDstate.getlambda(); // Need change to "Public" for this function 00217 // printf("\nLambda1,2,3 = %e; %e; %e\n", lambda(0), lambda(1), lambda(2)); 00218 00219 // Tensor thisK = thisFDstate.FDvolStiffness(); 00220 // thisK.print("K","\nTangent:"); 00221 00222 // Tensor thisPK2Stress = thisFDstate.getStressTensor(); 00223 // thisPK2Stress.print("PK2","\n2nd PK Stress Tensor:"); 00224 // tensor eigValuesPK2 = thisPK2Stress.eigenvalues(); 00225 // tensor eigVectorsPK2 = thisPK2Stress.eigenvectors(); 00226 // eigValuesPK2.print("UPK2","\n"); 00227 // eigVectorsPK2.print("RPK2","\n"); 00228 00229 // tensor thisMandel = thisC("ik")*thisPK2Stress("kj"); 00230 // thisMandel.null_indices(); 00231 // thisMandel.print("M","\n"); 00232 // tensor eigValuesM = thisMandel.eigenvalues(); 00233 // tensor eigVectorsM = thisMandel.eigenvectors(); 00234 // eigValuesM.print("UM","\n"); 00235 // eigVectorsM.print("RM","\n"); 00236 00237 00238 // Tensor thisFPKStress = thisFDstate.getPK1StressTensor(); 00239 // thisPK1Stress.print("P","\n1st PK Stress Tensor:"); 00240 stresstensor tStress = thisFDstate.getCauchyStressTensor(); 00241 tStress.print("Sigma","Cauchy Stress tensor:"); 00242 // tensor eigValuest = tStress.eigenvalues(); 00243 // tensor eigVectorst = tStress.eigenvectors(); 00244 // eigValuest.print("Ut","\n"); 00245 // eigVectorst.print("Rt","\n"); 00246 00247 } 00248 00249 return 1; 00250 00251 } 00252 |