tbarx.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/barcelonax.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 OSI    = 10.0;
00040     REAL Pp_ini = -10.0;
00041     REAL DSigX  = 10;
00042     REAL DSigY  = 10;
00043     REAL DSigZ  = 10;
00044     REAL DPp    = -20;
00045     int  FEndiv = 1;
00046     if (argc>=2) OCR    = atof(argv[1]);
00047     if (argc>=3) OSI    = atof(argv[2]);
00048     if (argc>=4) Pp_ini = atof(argv[3]);
00049     if (argc>=5) DSigX  = atof(argv[4]);
00050     if (argc>=6) DSigY  = atof(argv[5]);
00051     if (argc>=7) DSigZ  = atof(argv[6]);
00052     if (argc>=8) DPp    = atof(argv[7]);
00053     if (argc>=9) FEndiv = atoi(argv[8]);
00054 
00055     cout << "OCR    = " << OCR    << endl;
00056     cout << "OSI    = " << OSI    << endl;
00057     cout << "Pp_ini = " << Pp_ini << endl;
00058     cout << "DSigX  = " << DSigX  << endl;
00059     cout << "DSigY  = " << DSigY  << endl;
00060     cout << "DSigZ  = " << DSigZ  << endl;
00061     cout << "DPp    = " << DPp    << endl;
00062     cout << "FEndiv = " << FEndiv << endl;
00063     cout << endl << endl;
00064 
00065     // Parameters
00066     Array<REAL> prms; prms.resize(18);
00067     prms[0]  = 0.25  ; // lam0
00068     prms[1]  = 0.05  ; // kap
00069     prms[2]  = 20.0  ; // phics (deg)
00070     prms[3]  = 10000 ; // G (kPa)
00071     prms[4]  = 0.9   ; // r
00072     prms[5]  = 0.1   ; // bet
00073     prms[6]  = 0.5   ; // k
00074     prms[7]  = 0.002 ; // lams
00075     prms[8]  = 0.001 ; // kaps
00076     prms[9]  = 101.3 ; // patm (kPa)
00077     prms[10] = 1     ; // pref
00078     prms[11] = 10    ; // B
00079     // Hydraulic
00080     prms[12] = 0.1;    // a
00081     prms[13] = 0.5;    // b
00082     prms[14] = 1.0;    // c
00083     prms[15] = 2.0;    // m
00084     prms[16] = 10e-8;  // ks
00085     prms[17] = 10;     // gamaW (kN/m³)
00086 
00087     // Initial Data
00088     Array<REAL> inidata; inidata.resize(7); //{ SigX SigY SigZ vini OCR OSI Pp }
00089     inidata[0] = 24;     // =z0 (kPa)
00090     inidata[1] = 24;     // =z0 (kPa)
00091     inidata[2] = 24;     // =z0 (kPa)
00092     inidata[3] = 1.8;    // v_ini
00093     inidata[4] = OCR;    // OCR
00094     inidata[5] = OSI;    // OSI (kPa)
00095     inidata[6] = Pp_ini; // Pp (kPa);  ==> Suc = 0-(-10) = +10 (kPa)
00096 
00097     // Barcelona Model
00098     BarcelonaX barx(prms, inidata);
00099 
00100     // Set Integration Schemes Constants Structure
00101     IntegSchemesCtes isc;
00102     isc.Type     (IntegSchemesCtes::FE);
00103     isc.FE_ndiv  (FEndiv);
00104     isc.ME_maxSS (20);
00105     isc.ME_STOL  (1e-1);
00106     isc.ME_dTini (0.1);
00107     isc.EdMax    (20);
00108     CoupledModel::SetIntegSchemesCtes(isc);
00109 
00110     // TgStiffness
00111     Tensor4 Dep;
00112     Tensor2 dep;
00113     barx.TgStiffness(Dep,dep);
00114     cout << "Dep =\n" << Dep << endl;
00115     cout << "dep ="   << dep << endl;
00116     cout << endl << endl;
00117 
00118     // Actualize
00119     Tensor2 DSig; DSig=DSigX,DSigY,DSigZ, 0,0,0;
00120     Tensor2 DEps;
00121     REAL    DnSr;
00122     cout << ".... Actualize ...\n";
00123     barx.BackupState();
00124     barx.Actualize(DSig,DPp, DEps,DnSr);
00125     barx.RestoreState();
00126 
00127     // StressUpdate
00128     Tensor2 dsig;
00129     REAL    dnsr;
00130     cout << ".... StressUpdate ...\n";
00131     barx.StressUpdate(DEps,DPp, dsig,dnsr);
00132 
00133     // Output
00134     cout << "DSig     = " << DSig*1     << endl;
00135     cout << "DEps (%) = " << DEps*100.0 << endl;
00136     cout << "dsig     = " << dsig*1     << endl;
00137     cout << "DnSr     = " << DnSr       << endl;
00138     cout << "dnsr     = " << dnsr       << endl;
00139 
00140     return 0;
00141 }
00142 catch (Exception * e) // {{{
00143 {
00144     e->Cout();
00145     if (e->IsFatal()) exit(1);
00146     delete e;
00147 }
00148 catch (char const * s)
00149 {
00150     cout << " Fatal:" << s << "\n";
00151     exit(1);
00152 } // }}}
00153 
00154 // vim:fdm=marker

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