t2scam.cpp

00001 /*************************************************************************************
00002  * MechSys - A C++ library to simulate (Continuum) Mechanical Systems                *
00003  * Copyright (C) 2005 Dorival de Moraes Pedroso <dorival.pedroso at gmail.com>       *
00004  * Copyright (C) 2005 Raul Dario Durand Farfan  <raul.durand at gmail.com>           *
00005  *                                                                                   *
00006  * This file is part of MechSys.                                                     *
00007  *                                                                                   *
00008  * MechSys is free software; you can redistribute it and/or modify it under the      *
00009  * terms of the GNU General Public License as published by the Free Software         *
00010  * Foundation; either version 2 of the License, or (at your option) any later        *
00011  * version.                                                                          *
00012  *                                                                                   *
00013  * MechSys is distributed in the hope that it will be useful, but WITHOUT ANY        *
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A   *
00015  * PARTICULAR PURPOSE. See the GNU General Public License for more details.          *
00016  *                                                                                   *
00017  * You should have received a copy of the GNU General Public License along with      *
00018  * MechSys; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, *
00019  * Fifth Floor, Boston, MA 02110-1301, USA                                           *
00020  *************************************************************************************/
00021 
00022 #include <iostream>
00023 
00024 #include "util/array.h"
00025 #include "util/exception.h"
00026 #include "models/subcam.h"
00027 #include "tensors/tensors.h"
00028 #include "tensors/functions.h"
00029 #include "fem/solver/intsolverdata.h"
00030 
00031 using Tensors::Tensor2;
00032 using Tensors::Tensor4;
00033 using std::cout;
00034 using std::endl;
00035 
00036 int main(int argc, char **argv) try
00037 {
00038     REAL OCR    = 1.0;
00039     REAL DSigX  = 10;
00040     REAL DSigY  = 10;
00041     REAL DSigZ  = 10;
00042     int  FEndiv = 1;
00043     if (argc>=2) OCR    = atof(argv[1]);
00044     if (argc>=3) DSigX  = atof(argv[2]);
00045     if (argc>=4) DSigY  = atof(argv[3]);
00046     if (argc>=5) DSigZ  = atof(argv[4]);
00047     if (argc>=6) FEndiv = atoi(argv[5]);
00048 
00049     cout << "OCR    = " << OCR    << endl;
00050     cout << "DSigX  = " << DSigX  << endl;
00051     cout << "DSigY  = " << DSigY  << endl;
00052     cout << "DSigZ  = " << DSigZ  << endl;
00053     cout << "FEndiv = " << FEndiv << endl;
00054     cout << endl << endl;
00055 
00056     // Parameters
00057     Array<REAL> prms; prms.resize(5);
00058     prms[0] = 0.25  ; // lam
00059     prms[1] = 0.05  ; // kap
00060     prms[2] = 20.0  ; // phics (deg)
00061     prms[3] = 10000 ; // G (kPa)
00062     prms[4] =  5000 ; // c
00063 
00064     // Initial Data
00065     Array<REAL> inidata; inidata.resize(5); //{ SigX SigY SigZ vini OCR }
00066     inidata[0] = 24;  // =z0 (kPa)
00067     inidata[1] = 24;  // =z0 (kPa)
00068     inidata[2] = 24;  // =z0 (kPa)
00069     inidata[3] = 1.8; // v_ini
00070     inidata[4] = OCR; // OCR
00071 
00072     // SubCam Model
00073     SubCam scam(prms, inidata);
00074 
00075     // Set Integration Schemes Constants Structure
00076     IntegSchemesCtes isc;
00077     isc.Type     (IntegSchemesCtes::FE);
00078     isc.FE_ndiv  (FEndiv);
00079     isc.ME_maxSS (100000);
00080     isc.ME_STOL  (1e-5);
00081     isc.ME_dTini (0.1);
00082     isc.EdMax    (20);
00083     EquilibModel::SetIntegSchemesCtes(isc);
00084 
00085     // TgStiffness
00086     Tensor4 Dep;
00087     scam.TgStiffness(Dep);
00088     cout << "Dep =\n" << Dep << endl;
00089     cout << endl << endl;
00090 
00091     // Actualize
00092     Tensor2 DSig; DSig=DSigX,DSigY,DSigZ, 0,0,0;
00093     Tensor2 DEps;
00094     cout << ".... Actualize ...\n";
00095     scam.BackupState();
00096     scam.Actualize(DSig, DEps);
00097     scam.RestoreState();
00098 
00099     // StressUpdate
00100     Tensor2 dsig;
00101     cout << ".... StressUpdate ...\n";
00102     scam.StressUpdate(DEps, dsig);
00103 
00104     // Output
00105     cout << "DSig     = " << DSig*1     << endl;
00106     cout << "DEps (%) = " << DEps*100.0 << endl;
00107     cout << "dsig     = " << dsig*1     << endl;
00108 
00109     return 0;
00110 }
00111 catch (Exception * e) // {{{
00112 {
00113     e->Cout();
00114     if (e->IsFatal()) exit(1);
00115     delete e;
00116 }
00117 catch (char const * s)
00118 {
00119     cout << " Fatal:" << s << "\n";
00120     exit(1);
00121 } // }}}
00122 
00123 // vim:fdm=marker

Generated on Wed Jan 24 15:56:27 2007 for MechSys by  doxygen 1.4.7