tscam.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 
00028 using std::cout;
00029 using std::endl;
00030 
00031 int main(int argc, char **argv) try
00032 {
00033     REAL OCR    = 1.0;
00034     REAL DSigX  = 10;
00035     REAL DSigY  = 10;
00036     REAL DSigZ  = 10;
00037     int  FEndiv = 1;
00038     if (argc>=2) OCR    = atof(argv[1]);
00039     if (argc>=3) DSigX  = atof(argv[2]);
00040     if (argc>=4) DSigY  = atof(argv[3]);
00041     if (argc>=5) DSigZ  = atof(argv[4]);
00042     if (argc>=6) FEndiv = atoi(argv[5]);
00043 
00044     cout << "OCR    = " << OCR    << endl;
00045     cout << "DSigX  = " << DSigX  << endl;
00046     cout << "DSigY  = " << DSigY  << endl;
00047     cout << "DSigZ  = " << DSigZ  << endl;
00048     cout << "FEndiv = " << FEndiv << endl;
00049     cout << endl << endl;
00050 
00052     Array<REAL> sub_cam_prms;
00053     sub_cam_prms.push_back(0.0891); // lam
00054     sub_cam_prms.push_back(0.0196); // kap
00055     sub_cam_prms.push_back(0.20);   // nu
00056     sub_cam_prms.push_back(3.2);    // Rcs
00057     sub_cam_prms.push_back(5000);   // c
00058 
00060     Array<REAL>         ini_data;
00061     ini_data.push_back(2);     // Sx
00062     ini_data.push_back(2);     // Sy
00063     ini_data.push_back(2);     // Sz
00064     ini_data.push_back(1.691); // v_ini (specific volume)
00065     ini_data.push_back(1);     // OCR
00066 
00068     SubCam SC(sub_cam_prms, ini_data);
00069 
00070     // Set Integration Schemes Constants Structure
00071     IntegSchemesCtes isc;
00072     isc.Type     (IntegSchemesCtes::FE);
00073     isc.FE_ndiv  (FEndiv);
00074     isc.ME_maxSS (20);
00075     isc.ME_STOL  (1e-1);
00076     isc.ME_dTini (0.1);
00077     isc.EdMax    (20);
00078     EquilibModel::SetIntegSchemesCtes(isc);
00079 
00080     // Actualize
00081     Tensor2 DSig; DSig=DSigX,DSigY,DSigZ, 0,0,0;
00082     Tensor2 DEps;
00083     cout << ".... Actualize ...\n";
00084     SC.BackupState();
00085     SC.Actualize(DSig, DEps);
00086     SC.RestoreState();
00087 
00088     // StressUpdate
00089     Tensor2 dsig;
00090     cout << ".... StressUpdate ...\n";
00091     SC.StressUpdate(DEps, dsig);
00092 
00093     // Output
00094     cout << "DSig     = " << DSig*1     << endl;
00095     cout << "DEps (%) = " << DEps*100.0 << endl;
00096     cout << "dsig     = " << dsig*1     << endl;
00097 
00098     return 0;
00099 }
00100 catch (Exception * e)
00101 {
00102     e->Cout();
00103     if (e->IsFatal()) exit(1);
00104     delete e;
00105 }
00106 catch (char const * s)
00107 {
00108     cout << " Fatal:" << s << "\n";
00109     exit(1);
00110 }

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